@mcpc-tech/unplugin-dev-inspector-mcp 0.0.46 → 0.0.48
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 +17 -9
- package/client/dist/inspector.iife.js +713 -436
- package/dist/chunk.cjs +3 -3
- package/dist/config-updater.cjs +373 -188
- package/dist/config-updater.js +307 -122
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.js +4 -3
- package/package.json +3 -1
package/dist/config-updater.cjs
CHANGED
|
@@ -127,31 +127,31 @@ var ClientExecServer = class {
|
|
|
127
127
|
const registeredTools = [];
|
|
128
128
|
const conflicts = [];
|
|
129
129
|
const clientToolNames = /* @__PURE__ */ new Set();
|
|
130
|
-
for (const tool$
|
|
131
|
-
const toolName = this.getToolName(clientId, tool$
|
|
130
|
+
for (const tool$3 of tools) {
|
|
131
|
+
const toolName = this.getToolName(clientId, tool$3.name);
|
|
132
132
|
if (this.tools.has(toolName)) {
|
|
133
133
|
const existingOwner = this.toolToClient.get(toolName);
|
|
134
134
|
const isPredefined = this.predefinedTools.has(toolName);
|
|
135
135
|
if (this.useNamespacing) {
|
|
136
136
|
console.error(`[cmcp] Unexpected tool name conflict with namespacing: ${toolName}`);
|
|
137
|
-
conflicts.push(tool$
|
|
137
|
+
conflicts.push(tool$3.name);
|
|
138
138
|
continue;
|
|
139
139
|
} else if (isPredefined && existingOwner === this.clientId) {
|
|
140
|
-
console.log(`[cmcp] Client ${clientId} providing implementation for predefined tool: ${tool$
|
|
140
|
+
console.log(`[cmcp] Client ${clientId} providing implementation for predefined tool: ${tool$3.name}`);
|
|
141
141
|
this.predefinedTools.delete(toolName);
|
|
142
142
|
} else {
|
|
143
|
-
console.warn(`[cmcp] Tool ${tool$
|
|
144
|
-
conflicts.push(tool$
|
|
143
|
+
console.warn(`[cmcp] Tool ${tool$3.name} already exists, owned by client ${existingOwner}. Skipping registration for client ${clientId}`);
|
|
144
|
+
conflicts.push(tool$3.name);
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
this.tools.set(toolName, {
|
|
149
|
-
name: this.useNamespacing ? tool$
|
|
150
|
-
description: this.useNamespacing ? `[${clientId}] ${tool$
|
|
151
|
-
inputSchema: tool$
|
|
149
|
+
name: this.useNamespacing ? tool$3.name : toolName,
|
|
150
|
+
description: this.useNamespacing ? `[${clientId}] ${tool$3.description}` : tool$3.description,
|
|
151
|
+
inputSchema: tool$3.inputSchema
|
|
152
152
|
});
|
|
153
153
|
clientToolNames.add(toolName);
|
|
154
|
-
registeredTools.push(tool$
|
|
154
|
+
registeredTools.push(tool$3.name);
|
|
155
155
|
this.toolToClient.set(toolName, clientId);
|
|
156
156
|
}
|
|
157
157
|
this.clientTools.set(clientId, clientToolNames);
|
|
@@ -183,12 +183,12 @@ var ClientExecServer = class {
|
|
|
183
183
|
registerClientToolSchemas(tools) {
|
|
184
184
|
this.unregisterClientTools(this.clientId);
|
|
185
185
|
const clientToolNames = /* @__PURE__ */ new Set();
|
|
186
|
-
for (const tool$
|
|
187
|
-
const toolName = this.getToolName(this.clientId, tool$
|
|
186
|
+
for (const tool$3 of tools) {
|
|
187
|
+
const toolName = this.getToolName(this.clientId, tool$3.name);
|
|
188
188
|
this.tools.set(toolName, {
|
|
189
|
-
name: tool$
|
|
190
|
-
description: tool$
|
|
191
|
-
inputSchema: tool$
|
|
189
|
+
name: tool$3.name,
|
|
190
|
+
description: tool$3.description,
|
|
191
|
+
inputSchema: tool$3.inputSchema
|
|
192
192
|
});
|
|
193
193
|
this.toolToClient.set(toolName, this.clientId);
|
|
194
194
|
this.predefinedTools.add(toolName);
|
|
@@ -2730,7 +2730,7 @@ function isValidFeed(value) {
|
|
|
2730
2730
|
|
|
2731
2731
|
//#endregion
|
|
2732
2732
|
//#region ../../node_modules/.pnpm/domutils@3.2.2/node_modules/domutils/lib/esm/index.js
|
|
2733
|
-
var esm_exports$
|
|
2733
|
+
var esm_exports$3 = /* @__PURE__ */ require_chunk.__exportAll({
|
|
2734
2734
|
DocumentPosition: () => DocumentPosition,
|
|
2735
2735
|
append: () => append$1,
|
|
2736
2736
|
appendChild: () => appendChild,
|
|
@@ -2777,14 +2777,14 @@ var esm_exports$5 = /* @__PURE__ */ require_chunk.__export({
|
|
|
2777
2777
|
|
|
2778
2778
|
//#endregion
|
|
2779
2779
|
//#region ../../node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/static.js
|
|
2780
|
-
var static_exports = /* @__PURE__ */ require_chunk.
|
|
2780
|
+
var static_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
2781
2781
|
contains: () => contains,
|
|
2782
2782
|
extract: () => extract$1,
|
|
2783
2783
|
html: () => html$1,
|
|
2784
2784
|
merge: () => merge,
|
|
2785
2785
|
parseHTML: () => parseHTML,
|
|
2786
2786
|
root: () => root,
|
|
2787
|
-
text: () => text,
|
|
2787
|
+
text: () => text$1,
|
|
2788
2788
|
xml: () => xml
|
|
2789
2789
|
});
|
|
2790
2790
|
/**
|
|
@@ -2842,7 +2842,7 @@ function xml(dom) {
|
|
|
2842
2842
|
* @param elements - Elements to render.
|
|
2843
2843
|
* @returns The rendered document.
|
|
2844
2844
|
*/
|
|
2845
|
-
function text(elements) {
|
|
2845
|
+
function text$1(elements) {
|
|
2846
2846
|
const elems = elements !== null && elements !== void 0 ? elements : this ? this.root() : [];
|
|
2847
2847
|
let ret = "";
|
|
2848
2848
|
for (let i = 0; i < elems.length; i++) ret += textContent(elems[i]);
|
|
@@ -4514,7 +4514,7 @@ function parseDocument(data$1, options) {
|
|
|
4514
4514
|
|
|
4515
4515
|
//#endregion
|
|
4516
4516
|
//#region ../../node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/attributes.js
|
|
4517
|
-
var attributes_exports = /* @__PURE__ */ require_chunk.
|
|
4517
|
+
var attributes_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
4518
4518
|
addClass: () => addClass,
|
|
4519
4519
|
attr: () => attr,
|
|
4520
4520
|
data: () => data,
|
|
@@ -4542,7 +4542,7 @@ function getAttr(elem, name, xmlMode) {
|
|
|
4542
4542
|
(_a$2 = elem.attribs) !== null && _a$2 !== void 0 || (elem.attribs = {});
|
|
4543
4543
|
if (!name) return elem.attribs;
|
|
4544
4544
|
if (hasOwn(elem.attribs, name)) return !xmlMode && rboolean.test(name) ? name : elem.attribs[name];
|
|
4545
|
-
if (elem.name === "option" && name === "value") return text(elem.children);
|
|
4545
|
+
if (elem.name === "option" && name === "value") return text$1(elem.children);
|
|
4546
4546
|
if (elem.name === "input" && (elem.attribs["type"] === "radio" || elem.attribs["type"] === "checkbox") && name === "value") return "on";
|
|
4547
4547
|
}
|
|
4548
4548
|
/**
|
|
@@ -4752,7 +4752,7 @@ function val(value) {
|
|
|
4752
4752
|
for (const val$1 of values) this.find(`option[value="${val$1}"]`).attr("selected", "");
|
|
4753
4753
|
return this;
|
|
4754
4754
|
}
|
|
4755
|
-
return this.attr("multiple") ? option.toArray().map((el) => text(el.children)) : option.attr("value");
|
|
4755
|
+
return this.attr("multiple") ? option.toArray().map((el) => text$1(el.children)) : option.attr("value");
|
|
4756
4756
|
}
|
|
4757
4757
|
case "input":
|
|
4758
4758
|
case "option": return querying ? this.attr("value") : this.attr("value", value);
|
|
@@ -5486,23 +5486,23 @@ var require_boolbase = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
|
|
|
5486
5486
|
|
|
5487
5487
|
//#endregion
|
|
5488
5488
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/sort.js
|
|
5489
|
-
var import_commonjs
|
|
5489
|
+
var import_commonjs = require_commonjs();
|
|
5490
5490
|
const procedure = new Map([
|
|
5491
|
-
[import_commonjs
|
|
5492
|
-
[import_commonjs
|
|
5493
|
-
[import_commonjs
|
|
5494
|
-
[import_commonjs
|
|
5491
|
+
[import_commonjs.SelectorType.Universal, 50],
|
|
5492
|
+
[import_commonjs.SelectorType.Tag, 30],
|
|
5493
|
+
[import_commonjs.SelectorType.Attribute, 1],
|
|
5494
|
+
[import_commonjs.SelectorType.Pseudo, 0]
|
|
5495
5495
|
]);
|
|
5496
5496
|
function isTraversal$1(token) {
|
|
5497
5497
|
return !procedure.has(token.type);
|
|
5498
5498
|
}
|
|
5499
5499
|
const attributes = new Map([
|
|
5500
|
-
[import_commonjs
|
|
5501
|
-
[import_commonjs
|
|
5502
|
-
[import_commonjs
|
|
5503
|
-
[import_commonjs
|
|
5504
|
-
[import_commonjs
|
|
5505
|
-
[import_commonjs
|
|
5500
|
+
[import_commonjs.AttributeAction.Exists, 10],
|
|
5501
|
+
[import_commonjs.AttributeAction.Equals, 8],
|
|
5502
|
+
[import_commonjs.AttributeAction.Not, 7],
|
|
5503
|
+
[import_commonjs.AttributeAction.Start, 6],
|
|
5504
|
+
[import_commonjs.AttributeAction.End, 6],
|
|
5505
|
+
[import_commonjs.AttributeAction.Any, 5]
|
|
5506
5506
|
]);
|
|
5507
5507
|
/**
|
|
5508
5508
|
* Sort the parts of the passed selector,
|
|
@@ -5528,11 +5528,11 @@ function sortByProcedure(arr) {
|
|
|
5528
5528
|
function getProcedure(token) {
|
|
5529
5529
|
var _a$2, _b;
|
|
5530
5530
|
let proc = (_a$2 = procedure.get(token.type)) !== null && _a$2 !== void 0 ? _a$2 : -1;
|
|
5531
|
-
if (token.type === import_commonjs
|
|
5531
|
+
if (token.type === import_commonjs.SelectorType.Attribute) {
|
|
5532
5532
|
proc = (_b = attributes.get(token.action)) !== null && _b !== void 0 ? _b : 4;
|
|
5533
|
-
if (token.action === import_commonjs
|
|
5533
|
+
if (token.action === import_commonjs.AttributeAction.Equals && token.name === "id") proc = 9;
|
|
5534
5534
|
if (token.ignoreCase) proc >>= 1;
|
|
5535
|
-
} else if (token.type === import_commonjs
|
|
5535
|
+
} else if (token.type === import_commonjs.SelectorType.Pseudo) if (!token.data) proc = 3;
|
|
5536
5536
|
else if (token.name === "has" || token.name === "contains") proc = 0;
|
|
5537
5537
|
else if (Array.isArray(token.data)) {
|
|
5538
5538
|
proc = Math.min(...token.data.map((d) => Math.min(...d.map(getProcedure))));
|
|
@@ -5543,7 +5543,7 @@ function getProcedure(token) {
|
|
|
5543
5543
|
|
|
5544
5544
|
//#endregion
|
|
5545
5545
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/attributes.js
|
|
5546
|
-
var import_boolbase
|
|
5546
|
+
var import_boolbase = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
5547
5547
|
/**
|
|
5548
5548
|
* All reserved characters in a regex, used for escaping.
|
|
5549
5549
|
*
|
|
@@ -5648,7 +5648,7 @@ const attributeRules = {
|
|
|
5648
5648
|
element(next$1, data$1, options) {
|
|
5649
5649
|
const { adapter: adapter$1 } = options;
|
|
5650
5650
|
const { name, value } = data$1;
|
|
5651
|
-
if (/\s/.test(value)) return import_boolbase
|
|
5651
|
+
if (/\s/.test(value)) return import_boolbase.default.falseFunc;
|
|
5652
5652
|
const regex = new RegExp(`(?:^|\\s)${escapeRegex(value)}(?:$|\\s)`, shouldIgnoreCase(data$1, options) ? "i" : "");
|
|
5653
5653
|
return function element(elem) {
|
|
5654
5654
|
const attr$1 = adapter$1.getAttributeValue(elem, name);
|
|
@@ -5663,7 +5663,7 @@ const attributeRules = {
|
|
|
5663
5663
|
const { name } = data$1;
|
|
5664
5664
|
let { value } = data$1;
|
|
5665
5665
|
const len = value.length;
|
|
5666
|
-
if (len === 0) return import_boolbase
|
|
5666
|
+
if (len === 0) return import_boolbase.default.falseFunc;
|
|
5667
5667
|
if (shouldIgnoreCase(data$1, options)) {
|
|
5668
5668
|
value = value.toLowerCase();
|
|
5669
5669
|
return (elem) => {
|
|
@@ -5681,7 +5681,7 @@ const attributeRules = {
|
|
|
5681
5681
|
const { name } = data$1;
|
|
5682
5682
|
let { value } = data$1;
|
|
5683
5683
|
const len = -value.length;
|
|
5684
|
-
if (len === 0) return import_boolbase
|
|
5684
|
+
if (len === 0) return import_boolbase.default.falseFunc;
|
|
5685
5685
|
if (shouldIgnoreCase(data$1, options)) {
|
|
5686
5686
|
value = value.toLowerCase();
|
|
5687
5687
|
return (elem) => {
|
|
@@ -5697,7 +5697,7 @@ const attributeRules = {
|
|
|
5697
5697
|
any(next$1, data$1, options) {
|
|
5698
5698
|
const { adapter: adapter$1 } = options;
|
|
5699
5699
|
const { name, value } = data$1;
|
|
5700
|
-
if (value === "") return import_boolbase
|
|
5700
|
+
if (value === "") return import_boolbase.default.falseFunc;
|
|
5701
5701
|
if (shouldIgnoreCase(data$1, options)) {
|
|
5702
5702
|
const regex = new RegExp(escapeRegex(value), "i");
|
|
5703
5703
|
return function anyIC(elem) {
|
|
@@ -5788,7 +5788,6 @@ function parse$6(formula) {
|
|
|
5788
5788
|
|
|
5789
5789
|
//#endregion
|
|
5790
5790
|
//#region ../../node_modules/.pnpm/nth-check@2.1.1/node_modules/nth-check/lib/esm/compile.js
|
|
5791
|
-
var import_boolbase$5 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
5792
5791
|
/**
|
|
5793
5792
|
* Returns a function that checks if an elements index matches the given rule
|
|
5794
5793
|
* highly optimized to return the fastest solution.
|
|
@@ -5812,10 +5811,10 @@ var import_boolbase$5 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase()
|
|
|
5812
5811
|
function compile$2(parsed) {
|
|
5813
5812
|
const a = parsed[0];
|
|
5814
5813
|
const b = parsed[1] - 1;
|
|
5815
|
-
if (b < 0 && a <= 0) return import_boolbase
|
|
5814
|
+
if (b < 0 && a <= 0) return import_boolbase.default.falseFunc;
|
|
5816
5815
|
if (a === -1) return (index$1) => index$1 <= b;
|
|
5817
5816
|
if (a === 0) return (index$1) => index$1 === b;
|
|
5818
|
-
if (a === 1) return b < 0 ? import_boolbase
|
|
5817
|
+
if (a === 1) return b < 0 ? import_boolbase.default.trueFunc : (index$1) => index$1 >= b;
|
|
5819
5818
|
const absA = Math.abs(a);
|
|
5820
5819
|
const bMod = (b % absA + absA) % absA;
|
|
5821
5820
|
return a > 1 ? (index$1) => index$1 >= b && index$1 % absA === bMod : (index$1) => index$1 <= b && index$1 % absA === bMod;
|
|
@@ -5852,7 +5851,6 @@ function nthCheck(formula) {
|
|
|
5852
5851
|
|
|
5853
5852
|
//#endregion
|
|
5854
5853
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/filters.js
|
|
5855
|
-
var import_boolbase$4 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
5856
5854
|
function getChildFunc(next$1, adapter$1) {
|
|
5857
5855
|
return (elem) => {
|
|
5858
5856
|
const parent$1 = adapter$1.getParent(elem);
|
|
@@ -5873,8 +5871,8 @@ const filters = {
|
|
|
5873
5871
|
},
|
|
5874
5872
|
"nth-child"(next$1, rule, { adapter: adapter$1, equals }) {
|
|
5875
5873
|
const func = nthCheck(rule);
|
|
5876
|
-
if (func === import_boolbase
|
|
5877
|
-
if (func === import_boolbase
|
|
5874
|
+
if (func === import_boolbase.default.falseFunc) return import_boolbase.default.falseFunc;
|
|
5875
|
+
if (func === import_boolbase.default.trueFunc) return getChildFunc(next$1, adapter$1);
|
|
5878
5876
|
return function nthChild(elem) {
|
|
5879
5877
|
const siblings$1 = adapter$1.getSiblings(elem);
|
|
5880
5878
|
let pos = 0;
|
|
@@ -5887,8 +5885,8 @@ const filters = {
|
|
|
5887
5885
|
},
|
|
5888
5886
|
"nth-last-child"(next$1, rule, { adapter: adapter$1, equals }) {
|
|
5889
5887
|
const func = nthCheck(rule);
|
|
5890
|
-
if (func === import_boolbase
|
|
5891
|
-
if (func === import_boolbase
|
|
5888
|
+
if (func === import_boolbase.default.falseFunc) return import_boolbase.default.falseFunc;
|
|
5889
|
+
if (func === import_boolbase.default.trueFunc) return getChildFunc(next$1, adapter$1);
|
|
5892
5890
|
return function nthLastChild(elem) {
|
|
5893
5891
|
const siblings$1 = adapter$1.getSiblings(elem);
|
|
5894
5892
|
let pos = 0;
|
|
@@ -5901,8 +5899,8 @@ const filters = {
|
|
|
5901
5899
|
},
|
|
5902
5900
|
"nth-of-type"(next$1, rule, { adapter: adapter$1, equals }) {
|
|
5903
5901
|
const func = nthCheck(rule);
|
|
5904
|
-
if (func === import_boolbase
|
|
5905
|
-
if (func === import_boolbase
|
|
5902
|
+
if (func === import_boolbase.default.falseFunc) return import_boolbase.default.falseFunc;
|
|
5903
|
+
if (func === import_boolbase.default.trueFunc) return getChildFunc(next$1, adapter$1);
|
|
5906
5904
|
return function nthOfType(elem) {
|
|
5907
5905
|
const siblings$1 = adapter$1.getSiblings(elem);
|
|
5908
5906
|
let pos = 0;
|
|
@@ -5916,8 +5914,8 @@ const filters = {
|
|
|
5916
5914
|
},
|
|
5917
5915
|
"nth-last-of-type"(next$1, rule, { adapter: adapter$1, equals }) {
|
|
5918
5916
|
const func = nthCheck(rule);
|
|
5919
|
-
if (func === import_boolbase
|
|
5920
|
-
if (func === import_boolbase
|
|
5917
|
+
if (func === import_boolbase.default.falseFunc) return import_boolbase.default.falseFunc;
|
|
5918
|
+
if (func === import_boolbase.default.trueFunc) return getChildFunc(next$1, adapter$1);
|
|
5921
5919
|
return function nthLastOfType(elem) {
|
|
5922
5920
|
const siblings$1 = adapter$1.getSiblings(elem);
|
|
5923
5921
|
let pos = 0;
|
|
@@ -5954,7 +5952,7 @@ const filters = {
|
|
|
5954
5952
|
function dynamicStatePseudo(name) {
|
|
5955
5953
|
return function dynamicPseudo(next$1, _rule, { adapter: adapter$1 }) {
|
|
5956
5954
|
const func = adapter$1[name];
|
|
5957
|
-
if (typeof func !== "function") return import_boolbase
|
|
5955
|
+
if (typeof func !== "function") return import_boolbase.default.falseFunc;
|
|
5958
5956
|
return function active(elem) {
|
|
5959
5957
|
return func(elem) && next$1(elem);
|
|
5960
5958
|
};
|
|
@@ -6048,11 +6046,10 @@ const aliases = {
|
|
|
6048
6046
|
|
|
6049
6047
|
//#endregion
|
|
6050
6048
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/subselects.js
|
|
6051
|
-
var import_boolbase$3 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
6052
6049
|
/** Used as a placeholder for :has. Will be replaced with the actual element. */
|
|
6053
6050
|
const PLACEHOLDER_ELEMENT = {};
|
|
6054
6051
|
function ensureIsTag(next$1, adapter$1) {
|
|
6055
|
-
if (next$1 === import_boolbase
|
|
6052
|
+
if (next$1 === import_boolbase.default.falseFunc) return import_boolbase.default.falseFunc;
|
|
6056
6053
|
return (elem) => adapter$1.isTag(elem) && next$1(elem);
|
|
6057
6054
|
}
|
|
6058
6055
|
function getNextSiblings(elem, adapter$1) {
|
|
@@ -6076,7 +6073,7 @@ function copyOptions(options) {
|
|
|
6076
6073
|
}
|
|
6077
6074
|
const is$2 = (next$1, token, options, context$1, compileToken$1) => {
|
|
6078
6075
|
const func = compileToken$1(token, copyOptions(options), context$1);
|
|
6079
|
-
return func === import_boolbase
|
|
6076
|
+
return func === import_boolbase.default.trueFunc ? next$1 : func === import_boolbase.default.falseFunc ? import_boolbase.default.falseFunc : (elem) => func(elem) && next$1(elem);
|
|
6080
6077
|
};
|
|
6081
6078
|
const subselects = {
|
|
6082
6079
|
is: is$2,
|
|
@@ -6084,7 +6081,7 @@ const subselects = {
|
|
|
6084
6081
|
where: is$2,
|
|
6085
6082
|
not(next$1, token, options, context$1, compileToken$1) {
|
|
6086
6083
|
const func = compileToken$1(token, copyOptions(options), context$1);
|
|
6087
|
-
return func === import_boolbase
|
|
6084
|
+
return func === import_boolbase.default.falseFunc ? next$1 : func === import_boolbase.default.trueFunc ? import_boolbase.default.falseFunc : (elem) => !func(elem) && next$1(elem);
|
|
6088
6085
|
},
|
|
6089
6086
|
has(next$1, subselect, options, _context, compileToken$1) {
|
|
6090
6087
|
const { adapter: adapter$1 } = options;
|
|
@@ -6092,9 +6089,9 @@ const subselects = {
|
|
|
6092
6089
|
opts.relativeSelector = true;
|
|
6093
6090
|
const context$1 = subselect.some((s) => s.some(isTraversal$1)) ? [PLACEHOLDER_ELEMENT] : void 0;
|
|
6094
6091
|
const compiled = compileToken$1(subselect, opts, context$1);
|
|
6095
|
-
if (compiled === import_boolbase
|
|
6092
|
+
if (compiled === import_boolbase.default.falseFunc) return import_boolbase.default.falseFunc;
|
|
6096
6093
|
const hasElement = ensureIsTag(compiled, adapter$1);
|
|
6097
|
-
if (context$1 && compiled !== import_boolbase
|
|
6094
|
+
if (context$1 && compiled !== import_boolbase.default.trueFunc) {
|
|
6098
6095
|
const { shouldTestNextSiblings = false } = compiled;
|
|
6099
6096
|
return (elem) => {
|
|
6100
6097
|
if (!next$1(elem)) return false;
|
|
@@ -6110,7 +6107,6 @@ const subselects = {
|
|
|
6110
6107
|
|
|
6111
6108
|
//#endregion
|
|
6112
6109
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/pseudo-selectors/index.js
|
|
6113
|
-
var import_commonjs$3 = require_commonjs();
|
|
6114
6110
|
function compilePseudoSelector(next$1, selector, options, context$1, compileToken$1) {
|
|
6115
6111
|
var _a$2;
|
|
6116
6112
|
const { name, data: data$1 } = selector;
|
|
@@ -6122,7 +6118,7 @@ function compilePseudoSelector(next$1, selector, options, context$1, compileToke
|
|
|
6122
6118
|
const stringPseudo = typeof userPseudo === "string" ? userPseudo : aliases[name];
|
|
6123
6119
|
if (typeof stringPseudo === "string") {
|
|
6124
6120
|
if (data$1 != null) throw new Error(`Pseudo ${name} doesn't have any arguments`);
|
|
6125
|
-
const alias = (0, import_commonjs
|
|
6121
|
+
const alias = (0, import_commonjs.parse)(stringPseudo);
|
|
6126
6122
|
return subselects["is"](next$1, alias, options, context$1, compileToken$1);
|
|
6127
6123
|
}
|
|
6128
6124
|
if (typeof userPseudo === "function") {
|
|
@@ -6140,7 +6136,6 @@ function compilePseudoSelector(next$1, selector, options, context$1, compileToke
|
|
|
6140
6136
|
|
|
6141
6137
|
//#endregion
|
|
6142
6138
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/general.js
|
|
6143
|
-
var import_commonjs$2 = require_commonjs();
|
|
6144
6139
|
function getElementParent(node, adapter$1) {
|
|
6145
6140
|
const parent$1 = adapter$1.getParent(node);
|
|
6146
6141
|
if (parent$1 && adapter$1.isTag(parent$1)) return parent$1;
|
|
@@ -6149,14 +6144,14 @@ function getElementParent(node, adapter$1) {
|
|
|
6149
6144
|
function compileGeneralSelector(next$1, selector, options, context$1, compileToken$1) {
|
|
6150
6145
|
const { adapter: adapter$1, equals } = options;
|
|
6151
6146
|
switch (selector.type) {
|
|
6152
|
-
case import_commonjs
|
|
6153
|
-
case import_commonjs
|
|
6154
|
-
case import_commonjs
|
|
6147
|
+
case import_commonjs.SelectorType.PseudoElement: throw new Error("Pseudo-elements are not supported by css-select");
|
|
6148
|
+
case import_commonjs.SelectorType.ColumnCombinator: throw new Error("Column combinators are not yet supported by css-select");
|
|
6149
|
+
case import_commonjs.SelectorType.Attribute:
|
|
6155
6150
|
if (selector.namespace != null) throw new Error("Namespaced attributes are not yet supported by css-select");
|
|
6156
6151
|
if (!options.xmlMode || options.lowerCaseAttributeNames) selector.name = selector.name.toLowerCase();
|
|
6157
6152
|
return attributeRules[selector.action](next$1, selector, options);
|
|
6158
|
-
case import_commonjs
|
|
6159
|
-
case import_commonjs
|
|
6153
|
+
case import_commonjs.SelectorType.Pseudo: return compilePseudoSelector(next$1, selector, options, context$1, compileToken$1);
|
|
6154
|
+
case import_commonjs.SelectorType.Tag: {
|
|
6160
6155
|
if (selector.namespace != null) throw new Error("Namespaced tag names are not yet supported by css-select");
|
|
6161
6156
|
let { name } = selector;
|
|
6162
6157
|
if (!options.xmlMode || options.lowerCaseTags) name = name.toLowerCase();
|
|
@@ -6164,7 +6159,7 @@ function compileGeneralSelector(next$1, selector, options, context$1, compileTok
|
|
|
6164
6159
|
return adapter$1.getName(elem) === name && next$1(elem);
|
|
6165
6160
|
};
|
|
6166
6161
|
}
|
|
6167
|
-
case import_commonjs
|
|
6162
|
+
case import_commonjs.SelectorType.Descendant: {
|
|
6168
6163
|
if (options.cacheResults === false || typeof WeakSet === "undefined") return function descendant(elem) {
|
|
6169
6164
|
let current = elem;
|
|
6170
6165
|
while (current = getElementParent(current, adapter$1)) if (next$1(current)) return true;
|
|
@@ -6187,14 +6182,14 @@ function compileGeneralSelector(next$1, selector, options, context$1, compileTok
|
|
|
6187
6182
|
while (current = getElementParent(current, adapter$1));
|
|
6188
6183
|
return false;
|
|
6189
6184
|
};
|
|
6190
|
-
case import_commonjs
|
|
6185
|
+
case import_commonjs.SelectorType.Parent: return function parent$1(elem) {
|
|
6191
6186
|
return adapter$1.getChildren(elem).some((elem$1) => adapter$1.isTag(elem$1) && next$1(elem$1));
|
|
6192
6187
|
};
|
|
6193
|
-
case import_commonjs
|
|
6188
|
+
case import_commonjs.SelectorType.Child: return function child(elem) {
|
|
6194
6189
|
const parent$1 = adapter$1.getParent(elem);
|
|
6195
6190
|
return parent$1 != null && adapter$1.isTag(parent$1) && next$1(parent$1);
|
|
6196
6191
|
};
|
|
6197
|
-
case import_commonjs
|
|
6192
|
+
case import_commonjs.SelectorType.Sibling: return function sibling(elem) {
|
|
6198
6193
|
const siblings$1 = adapter$1.getSiblings(elem);
|
|
6199
6194
|
for (let i = 0; i < siblings$1.length; i++) {
|
|
6200
6195
|
const currentSibling = siblings$1[i];
|
|
@@ -6203,7 +6198,7 @@ function compileGeneralSelector(next$1, selector, options, context$1, compileTok
|
|
|
6203
6198
|
}
|
|
6204
6199
|
return false;
|
|
6205
6200
|
};
|
|
6206
|
-
case import_commonjs
|
|
6201
|
+
case import_commonjs.SelectorType.Adjacent:
|
|
6207
6202
|
if (adapter$1.prevElementSibling) return function adjacent(elem) {
|
|
6208
6203
|
const previous = adapter$1.prevElementSibling(elem);
|
|
6209
6204
|
return previous != null && next$1(previous);
|
|
@@ -6218,7 +6213,7 @@ function compileGeneralSelector(next$1, selector, options, context$1, compileTok
|
|
|
6218
6213
|
}
|
|
6219
6214
|
return !!lastElement && next$1(lastElement);
|
|
6220
6215
|
};
|
|
6221
|
-
case import_commonjs
|
|
6216
|
+
case import_commonjs.SelectorType.Universal:
|
|
6222
6217
|
if (selector.namespace != null && selector.namespace !== "*") throw new Error("Namespaced universal selectors are not yet supported by css-select");
|
|
6223
6218
|
return next$1;
|
|
6224
6219
|
}
|
|
@@ -6226,8 +6221,6 @@ function compileGeneralSelector(next$1, selector, options, context$1, compileTok
|
|
|
6226
6221
|
|
|
6227
6222
|
//#endregion
|
|
6228
6223
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/compile.js
|
|
6229
|
-
var import_commonjs$1 = require_commonjs();
|
|
6230
|
-
var import_boolbase$2 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
6231
6224
|
/**
|
|
6232
6225
|
* Compiles a selector to an executable function.
|
|
6233
6226
|
*
|
|
@@ -6235,19 +6228,19 @@ var import_boolbase$2 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase()
|
|
|
6235
6228
|
* @param options Compilation options.
|
|
6236
6229
|
* @param context Optional context for the selector.
|
|
6237
6230
|
*/
|
|
6238
|
-
function compile(selector, options, context$1) {
|
|
6231
|
+
function compile$1(selector, options, context$1) {
|
|
6239
6232
|
return ensureIsTag(compileUnsafe(selector, options, context$1), options.adapter);
|
|
6240
6233
|
}
|
|
6241
6234
|
function compileUnsafe(selector, options, context$1) {
|
|
6242
|
-
return compileToken(typeof selector === "string" ? (0, import_commonjs
|
|
6235
|
+
return compileToken(typeof selector === "string" ? (0, import_commonjs.parse)(selector) : selector, options, context$1);
|
|
6243
6236
|
}
|
|
6244
6237
|
function includesScopePseudo(t) {
|
|
6245
|
-
return t.type === import_commonjs
|
|
6238
|
+
return t.type === import_commonjs.SelectorType.Pseudo && (t.name === "scope" || Array.isArray(t.data) && t.data.some((data$1) => data$1.some(includesScopePseudo)));
|
|
6246
6239
|
}
|
|
6247
|
-
const DESCENDANT_TOKEN = { type: import_commonjs
|
|
6240
|
+
const DESCENDANT_TOKEN = { type: import_commonjs.SelectorType.Descendant };
|
|
6248
6241
|
const FLEXIBLE_DESCENDANT_TOKEN = { type: "_flexibleDescendant" };
|
|
6249
6242
|
const SCOPE_TOKEN = {
|
|
6250
|
-
type: import_commonjs
|
|
6243
|
+
type: import_commonjs.SelectorType.Pseudo,
|
|
6251
6244
|
name: "scope",
|
|
6252
6245
|
data: null
|
|
6253
6246
|
};
|
|
@@ -6257,7 +6250,7 @@ function absolutize(token, { adapter: adapter$1 }, context$1) {
|
|
|
6257
6250
|
return e === PLACEHOLDER_ELEMENT || parent$1 && adapter$1.isTag(parent$1);
|
|
6258
6251
|
}));
|
|
6259
6252
|
for (const t of token) {
|
|
6260
|
-
if (t.length > 0 && isTraversal$1(t[0]) && t[0].type !== import_commonjs
|
|
6253
|
+
if (t.length > 0 && isTraversal$1(t[0]) && t[0].type !== import_commonjs.SelectorType.Descendant) {} else if (hasContext && !t.some(includesScopePseudo)) t.unshift(DESCENDANT_TOKEN);
|
|
6261
6254
|
else continue;
|
|
6262
6255
|
t.unshift(SCOPE_TOKEN);
|
|
6263
6256
|
}
|
|
@@ -6274,21 +6267,21 @@ function compileToken(token, options, context$1) {
|
|
|
6274
6267
|
const query = token.map((rules) => {
|
|
6275
6268
|
if (rules.length >= 2) {
|
|
6276
6269
|
const [first$1, second] = rules;
|
|
6277
|
-
if (first$1.type !== import_commonjs
|
|
6278
|
-
else if (second.type === import_commonjs
|
|
6270
|
+
if (first$1.type !== import_commonjs.SelectorType.Pseudo || first$1.name !== "scope") {} else if (isArrayContext && second.type === import_commonjs.SelectorType.Descendant) rules[1] = FLEXIBLE_DESCENDANT_TOKEN;
|
|
6271
|
+
else if (second.type === import_commonjs.SelectorType.Adjacent || second.type === import_commonjs.SelectorType.Sibling) shouldTestNextSiblings = true;
|
|
6279
6272
|
}
|
|
6280
6273
|
return compileRules(rules, options, finalContext);
|
|
6281
|
-
}).reduce(reduceRules, import_boolbase
|
|
6274
|
+
}).reduce(reduceRules, import_boolbase.default.falseFunc);
|
|
6282
6275
|
query.shouldTestNextSiblings = shouldTestNextSiblings;
|
|
6283
6276
|
return query;
|
|
6284
6277
|
}
|
|
6285
6278
|
function compileRules(rules, options, context$1) {
|
|
6286
6279
|
var _a$2;
|
|
6287
|
-
return rules.reduce((previous, rule) => previous === import_boolbase
|
|
6280
|
+
return rules.reduce((previous, rule) => previous === import_boolbase.default.falseFunc ? import_boolbase.default.falseFunc : compileGeneralSelector(previous, rule, options, context$1, compileToken), (_a$2 = options.rootFunc) !== null && _a$2 !== void 0 ? _a$2 : import_boolbase.default.trueFunc);
|
|
6288
6281
|
}
|
|
6289
6282
|
function reduceRules(a, b) {
|
|
6290
|
-
if (b === import_boolbase
|
|
6291
|
-
if (a === import_boolbase
|
|
6283
|
+
if (b === import_boolbase.default.falseFunc || a === import_boolbase.default.trueFunc) return a;
|
|
6284
|
+
if (a === import_boolbase.default.falseFunc || b === import_boolbase.default.trueFunc) return b;
|
|
6292
6285
|
return function combine(elem) {
|
|
6293
6286
|
return a(elem) || b(elem);
|
|
6294
6287
|
};
|
|
@@ -6296,16 +6289,15 @@ function reduceRules(a, b) {
|
|
|
6296
6289
|
|
|
6297
6290
|
//#endregion
|
|
6298
6291
|
//#region ../../node_modules/.pnpm/css-select@5.2.2/node_modules/css-select/lib/esm/index.js
|
|
6299
|
-
var import_boolbase$1 = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
6300
6292
|
const defaultEquals = (a, b) => a === b;
|
|
6301
6293
|
const defaultOptions = {
|
|
6302
|
-
adapter: esm_exports$
|
|
6294
|
+
adapter: esm_exports$3,
|
|
6303
6295
|
equals: defaultEquals
|
|
6304
6296
|
};
|
|
6305
6297
|
function convertOptionFormats(options) {
|
|
6306
6298
|
var _a$2, _b, _c, _d;
|
|
6307
6299
|
const opts = options !== null && options !== void 0 ? options : defaultOptions;
|
|
6308
|
-
(_a$2 = opts.adapter) !== null && _a$2 !== void 0 || (opts.adapter = esm_exports$
|
|
6300
|
+
(_a$2 = opts.adapter) !== null && _a$2 !== void 0 || (opts.adapter = esm_exports$3);
|
|
6309
6301
|
(_b = opts.equals) !== null && _b !== void 0 || (opts.equals = (_d = (_c = opts.adapter) === null || _c === void 0 ? void 0 : _c.equals) !== null && _d !== void 0 ? _d : defaultEquals);
|
|
6310
6302
|
return opts;
|
|
6311
6303
|
}
|
|
@@ -6317,7 +6309,7 @@ function wrapCompile(func) {
|
|
|
6317
6309
|
/**
|
|
6318
6310
|
* Compiles the query, returns a function.
|
|
6319
6311
|
*/
|
|
6320
|
-
const compile
|
|
6312
|
+
const compile = wrapCompile(compile$1);
|
|
6321
6313
|
const _compileUnsafe = wrapCompile(compileUnsafe);
|
|
6322
6314
|
const _compileToken = wrapCompile(compileToken);
|
|
6323
6315
|
function getSelectorFunc(searchFunc) {
|
|
@@ -6351,7 +6343,7 @@ function appendNextSiblings(elem, adapter$1) {
|
|
|
6351
6343
|
* @returns All matching elements.
|
|
6352
6344
|
*
|
|
6353
6345
|
*/
|
|
6354
|
-
const selectAll = getSelectorFunc((query, elems, options) => query === import_boolbase
|
|
6346
|
+
const selectAll = getSelectorFunc((query, elems, options) => query === import_boolbase.default.falseFunc || !elems || elems.length === 0 ? [] : options.adapter.findAll(query, elems));
|
|
6355
6347
|
/**
|
|
6356
6348
|
* @template Node The generic Node type for the DOM adapter being used.
|
|
6357
6349
|
* @template ElementNode The Node type for elements for the DOM adapter being used.
|
|
@@ -6361,7 +6353,7 @@ const selectAll = getSelectorFunc((query, elems, options) => query === import_bo
|
|
|
6361
6353
|
* @see compile for supported selector queries.
|
|
6362
6354
|
* @returns the first match, or null if there was no match.
|
|
6363
6355
|
*/
|
|
6364
|
-
const selectOne = getSelectorFunc((query, elems, options) => query === import_boolbase
|
|
6356
|
+
const selectOne = getSelectorFunc((query, elems, options) => query === import_boolbase.default.falseFunc || !elems || elems.length === 0 ? null : options.adapter.findOne(query, elems));
|
|
6365
6357
|
|
|
6366
6358
|
//#endregion
|
|
6367
6359
|
//#region ../../node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/positionals.js
|
|
@@ -6412,8 +6404,6 @@ function groupSelectors(selectors) {
|
|
|
6412
6404
|
|
|
6413
6405
|
//#endregion
|
|
6414
6406
|
//#region ../../node_modules/.pnpm/cheerio-select@2.1.0/node_modules/cheerio-select/lib/esm/index.js
|
|
6415
|
-
var import_commonjs = require_commonjs();
|
|
6416
|
-
var import_boolbase = /* @__PURE__ */ require_chunk.__toESM(require_boolbase(), 1);
|
|
6417
6407
|
const UNIVERSAL_SELECTOR = {
|
|
6418
6408
|
type: import_commonjs.SelectorType.Universal,
|
|
6419
6409
|
namespace: null
|
|
@@ -6525,7 +6515,7 @@ function findFilterElements(root$1, selector, options, queryForSelector, totalLi
|
|
|
6525
6515
|
if (remainingHasTraversal) {
|
|
6526
6516
|
if ((0, import_commonjs.isTraversal)(remainingSelector[0])) {
|
|
6527
6517
|
const { type } = remainingSelector[0];
|
|
6528
|
-
if (type === import_commonjs.SelectorType.Sibling || type === import_commonjs.SelectorType.Adjacent) result = prepareContext(result, esm_exports$
|
|
6518
|
+
if (type === import_commonjs.SelectorType.Sibling || type === import_commonjs.SelectorType.Adjacent) result = prepareContext(result, esm_exports$3, true);
|
|
6529
6519
|
remainingSelector.unshift(UNIVERSAL_SELECTOR);
|
|
6530
6520
|
}
|
|
6531
6521
|
options = {
|
|
@@ -6543,7 +6533,7 @@ function findElements(root$1, sel, options, limit) {
|
|
|
6543
6533
|
return find$1(root$1, _compileToken(sel, options, root$1), limit);
|
|
6544
6534
|
}
|
|
6545
6535
|
function find$1(root$1, query, limit = Infinity) {
|
|
6546
|
-
const elems = prepareContext(root$1, esm_exports$
|
|
6536
|
+
const elems = prepareContext(root$1, esm_exports$3, query.shouldTestNextSiblings);
|
|
6547
6537
|
return find$2((node) => isTag(node) && query(node), elems, true, limit);
|
|
6548
6538
|
}
|
|
6549
6539
|
function filterElements(elements, sel, options) {
|
|
@@ -6560,7 +6550,7 @@ function filterElements(elements, sel, options) {
|
|
|
6560
6550
|
*
|
|
6561
6551
|
* @module cheerio/traversing
|
|
6562
6552
|
*/
|
|
6563
|
-
var traversing_exports = /* @__PURE__ */ require_chunk.
|
|
6553
|
+
var traversing_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
6564
6554
|
_findBySelector: () => _findBySelector,
|
|
6565
6555
|
add: () => add,
|
|
6566
6556
|
addBack: () => addBack,
|
|
@@ -7432,7 +7422,7 @@ function update(newChilds, parent$1) {
|
|
|
7432
7422
|
*
|
|
7433
7423
|
* @module cheerio/manipulation
|
|
7434
7424
|
*/
|
|
7435
|
-
var manipulation_exports = /* @__PURE__ */ require_chunk.
|
|
7425
|
+
var manipulation_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
7436
7426
|
_makeDomArray: () => _makeDomArray,
|
|
7437
7427
|
after: () => after,
|
|
7438
7428
|
append: () => append,
|
|
@@ -7447,7 +7437,7 @@ var manipulation_exports = /* @__PURE__ */ require_chunk.__export({
|
|
|
7447
7437
|
prependTo: () => prependTo,
|
|
7448
7438
|
remove: () => remove,
|
|
7449
7439
|
replaceWith: () => replaceWith,
|
|
7450
|
-
text: () => text
|
|
7440
|
+
text: () => text,
|
|
7451
7441
|
toString: () => toString,
|
|
7452
7442
|
unwrap: () => unwrap,
|
|
7453
7443
|
wrap: () => wrap,
|
|
@@ -8117,9 +8107,9 @@ function html(str) {
|
|
|
8117
8107
|
function toString() {
|
|
8118
8108
|
return this._render(this);
|
|
8119
8109
|
}
|
|
8120
|
-
function text
|
|
8121
|
-
if (str === void 0) return text(this);
|
|
8122
|
-
if (typeof str === "function") return domEach(this, (el, i) => this._make(el).text(str.call(el, i, text([el]))));
|
|
8110
|
+
function text(str) {
|
|
8111
|
+
if (str === void 0) return text$1(this);
|
|
8112
|
+
if (typeof str === "function") return domEach(this, (el, i) => this._make(el).text(str.call(el, i, text$1([el]))));
|
|
8123
8113
|
return domEach(this, (el) => {
|
|
8124
8114
|
if (!hasChildren(el)) return;
|
|
8125
8115
|
for (const child of el.children) child.next = child.prev = child.parent = null;
|
|
@@ -8148,7 +8138,7 @@ function clone() {
|
|
|
8148
8138
|
|
|
8149
8139
|
//#endregion
|
|
8150
8140
|
//#region ../../node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/css.js
|
|
8151
|
-
var css_exports = /* @__PURE__ */ require_chunk.
|
|
8141
|
+
var css_exports = /* @__PURE__ */ require_chunk.__exportAll({ css: () => css });
|
|
8152
8142
|
/**
|
|
8153
8143
|
* Set multiple CSS properties for every matched element.
|
|
8154
8144
|
*
|
|
@@ -8239,8 +8229,8 @@ function parse$2(styles) {
|
|
|
8239
8229
|
|
|
8240
8230
|
//#endregion
|
|
8241
8231
|
//#region ../../node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/forms.js
|
|
8242
|
-
var forms_exports = /* @__PURE__ */ require_chunk.
|
|
8243
|
-
serialize: () => serialize
|
|
8232
|
+
var forms_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
8233
|
+
serialize: () => serialize,
|
|
8244
8234
|
serializeArray: () => serializeArray
|
|
8245
8235
|
});
|
|
8246
8236
|
const submittableSelector = "input,select,textarea,keygen";
|
|
@@ -8260,7 +8250,7 @@ const rCRLF = /\r?\n/g;
|
|
|
8260
8250
|
* @returns The serialized form.
|
|
8261
8251
|
* @see {@link https://api.jquery.com/serialize/}
|
|
8262
8252
|
*/
|
|
8263
|
-
function serialize
|
|
8253
|
+
function serialize() {
|
|
8264
8254
|
return this.serializeArray().map((data$1) => `${encodeURIComponent(data$1.name)}=${encodeURIComponent(data$1.value)}`).join("&").replace(r20, "+");
|
|
8265
8255
|
}
|
|
8266
8256
|
/**
|
|
@@ -8300,7 +8290,7 @@ function serializeArray() {
|
|
|
8300
8290
|
|
|
8301
8291
|
//#endregion
|
|
8302
8292
|
//#region ../../node_modules/.pnpm/cheerio@1.1.2/node_modules/cheerio/dist/esm/api/extract.js
|
|
8303
|
-
var extract_exports = /* @__PURE__ */ require_chunk.
|
|
8293
|
+
var extract_exports = /* @__PURE__ */ require_chunk.__exportAll({ extract: () => extract });
|
|
8304
8294
|
function getExtractDescr(descr) {
|
|
8305
8295
|
var _a$2;
|
|
8306
8296
|
if (typeof descr === "string") return {
|
|
@@ -52272,7 +52262,7 @@ var init_trace_api = require_chunk.__esmMin((() => {
|
|
|
52272
52262
|
|
|
52273
52263
|
//#endregion
|
|
52274
52264
|
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/index.js
|
|
52275
|
-
var esm_exports$2 = /* @__PURE__ */ require_chunk.
|
|
52265
|
+
var esm_exports$2 = /* @__PURE__ */ require_chunk.__exportAll({
|
|
52276
52266
|
DiagConsoleLogger: () => DiagConsoleLogger,
|
|
52277
52267
|
DiagLogLevel: () => DiagLogLevel,
|
|
52278
52268
|
INVALID_SPANID: () => INVALID_SPANID,
|
|
@@ -54705,7 +54695,7 @@ var init_stable_metrics = require_chunk.__esmMin((() => {
|
|
|
54705
54695
|
|
|
54706
54696
|
//#endregion
|
|
54707
54697
|
//#region ../../node_modules/.pnpm/@opentelemetry+semantic-conventions@1.28.0/node_modules/@opentelemetry/semantic-conventions/build/esm/index.js
|
|
54708
|
-
var esm_exports$1 = /* @__PURE__ */ require_chunk.
|
|
54698
|
+
var esm_exports$1 = /* @__PURE__ */ require_chunk.__exportAll({
|
|
54709
54699
|
ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED: () => ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED,
|
|
54710
54700
|
ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED: () => ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED,
|
|
54711
54701
|
ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED: () => ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED,
|
|
@@ -60197,14 +60187,14 @@ var require_range = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
|
|
|
60197
60187
|
const replaceCaret = (comp, options) => {
|
|
60198
60188
|
debug("caret", comp, options);
|
|
60199
60189
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
60200
|
-
const z$
|
|
60190
|
+
const z$4 = options.includePrerelease ? "-0" : "";
|
|
60201
60191
|
return comp.replace(r, (_, M, m, p$1, pr) => {
|
|
60202
60192
|
debug("caret", comp, _, M, m, p$1, pr);
|
|
60203
60193
|
let ret;
|
|
60204
60194
|
if (isX(M)) ret = "";
|
|
60205
|
-
else if (isX(m)) ret = `>=${M}.0.0${z$
|
|
60206
|
-
else if (isX(p$1)) if (M === "0") ret = `>=${M}.${m}.0${z$
|
|
60207
|
-
else ret = `>=${M}.${m}.0${z$
|
|
60195
|
+
else if (isX(m)) ret = `>=${M}.0.0${z$4} <${+M + 1}.0.0-0`;
|
|
60196
|
+
else if (isX(p$1)) if (M === "0") ret = `>=${M}.${m}.0${z$4} <${M}.${+m + 1}.0-0`;
|
|
60197
|
+
else ret = `>=${M}.${m}.0${z$4} <${+M + 1}.0.0-0`;
|
|
60208
60198
|
else if (pr) {
|
|
60209
60199
|
debug("replaceCaret pr", pr);
|
|
60210
60200
|
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p$1}-${pr} <${M}.${m}.${+p$1 + 1}-0`;
|
|
@@ -60212,8 +60202,8 @@ var require_range = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
|
|
|
60212
60202
|
else ret = `>=${M}.${m}.${p$1}-${pr} <${+M + 1}.0.0-0`;
|
|
60213
60203
|
} else {
|
|
60214
60204
|
debug("no pr");
|
|
60215
|
-
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p$1}${z$
|
|
60216
|
-
else ret = `>=${M}.${m}.${p$1}${z$
|
|
60205
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p$1}${z$4} <${M}.${m}.${+p$1 + 1}-0`;
|
|
60206
|
+
else ret = `>=${M}.${m}.${p$1}${z$4} <${M}.${+m + 1}.0-0`;
|
|
60217
60207
|
else ret = `>=${M}.${m}.${p$1} <${+M + 1}.0.0-0`;
|
|
60218
60208
|
}
|
|
60219
60209
|
debug("caret return", ret);
|
|
@@ -63734,7 +63724,7 @@ var init_otlp_network_export_delegate = require_chunk.__esmMin((() => {
|
|
|
63734
63724
|
|
|
63735
63725
|
//#endregion
|
|
63736
63726
|
//#region ../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.56.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index.js
|
|
63737
|
-
var esm_exports = /* @__PURE__ */ require_chunk.
|
|
63727
|
+
var esm_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
63738
63728
|
CompressionAlgorithm: () => CompressionAlgorithm,
|
|
63739
63729
|
OTLPExporterBase: () => OTLPExporterBase,
|
|
63740
63730
|
OTLPExporterError: () => OTLPExporterError,
|
|
@@ -75689,8 +75679,8 @@ var require_root = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
|
|
|
75689
75679
|
* @memberof opentelemetry.proto.collector
|
|
75690
75680
|
* @namespace
|
|
75691
75681
|
*/
|
|
75692
|
-
var logs = {};
|
|
75693
|
-
logs.v1 = (function() {
|
|
75682
|
+
var logs$1 = {};
|
|
75683
|
+
logs$1.v1 = (function() {
|
|
75694
75684
|
/**
|
|
75695
75685
|
* Namespace v1.
|
|
75696
75686
|
* @memberof opentelemetry.proto.collector.logs
|
|
@@ -76330,7 +76320,7 @@ var require_root = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
|
|
|
76330
76320
|
})();
|
|
76331
76321
|
return v1;
|
|
76332
76322
|
})();
|
|
76333
|
-
return logs;
|
|
76323
|
+
return logs$1;
|
|
76334
76324
|
})();
|
|
76335
76325
|
return collector;
|
|
76336
76326
|
})();
|
|
@@ -80921,8 +80911,8 @@ var require_root = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
|
|
|
80921
80911
|
* @memberof opentelemetry.proto
|
|
80922
80912
|
* @namespace
|
|
80923
80913
|
*/
|
|
80924
|
-
var logs = {};
|
|
80925
|
-
logs.v1 = (function() {
|
|
80914
|
+
var logs$1 = {};
|
|
80915
|
+
logs$1.v1 = (function() {
|
|
80926
80916
|
/**
|
|
80927
80917
|
* Namespace v1.
|
|
80928
80918
|
* @memberof opentelemetry.proto.logs
|
|
@@ -82179,7 +82169,7 @@ var require_root = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
|
|
|
82179
82169
|
})();
|
|
82180
82170
|
return v1;
|
|
82181
82171
|
})();
|
|
82182
|
-
return logs;
|
|
82172
|
+
return logs$1;
|
|
82183
82173
|
})();
|
|
82184
82174
|
return proto;
|
|
82185
82175
|
})();
|
|
@@ -82404,7 +82394,7 @@ var init_is_export_retryable = require_chunk.__esmMin((() => {}));
|
|
|
82404
82394
|
|
|
82405
82395
|
//#endregion
|
|
82406
82396
|
//#region ../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.56.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/transport/http-transport-utils.js
|
|
82407
|
-
var http_transport_utils_exports = /* @__PURE__ */ require_chunk.
|
|
82397
|
+
var http_transport_utils_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
82408
82398
|
compressAndSend: () => compressAndSend,
|
|
82409
82399
|
createHttpAgent: () => createHttpAgent,
|
|
82410
82400
|
sendWithHttp: () => sendWithHttp
|
|
@@ -83104,7 +83094,7 @@ var init_convert_legacy_node_http_options = require_chunk.__esmMin((() => {
|
|
|
83104
83094
|
|
|
83105
83095
|
//#endregion
|
|
83106
83096
|
//#region ../../node_modules/.pnpm/@opentelemetry+otlp-exporter-base@0.56.0_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/otlp-exporter-base/build/esm/index-node-http.js
|
|
83107
|
-
var index_node_http_exports = /* @__PURE__ */ require_chunk.
|
|
83097
|
+
var index_node_http_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
83108
83098
|
convertLegacyHttpOptions: () => convertLegacyHttpOptions,
|
|
83109
83099
|
createOtlpHttpExportDelegate: () => createOtlpHttpExportDelegate,
|
|
83110
83100
|
getSharedConfigurationFromEnvironment: () => getSharedConfigurationFromEnvironment
|
|
@@ -83490,13 +83480,13 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
83490
83480
|
acquiredKeys.push(defKey);
|
|
83491
83481
|
allClients[serverId] = client;
|
|
83492
83482
|
const { tools } = await client.listTools();
|
|
83493
|
-
tools.forEach((tool$
|
|
83494
|
-
const toolNameWithScope = `${name}.${tool$
|
|
83495
|
-
const internalToolName = tool$
|
|
83483
|
+
tools.forEach((tool$3) => {
|
|
83484
|
+
const toolNameWithScope = `${name}.${tool$3.name}`;
|
|
83485
|
+
const internalToolName = tool$3.name;
|
|
83496
83486
|
const toolId = sanitizePropertyKey(`${serverId}_${internalToolName}`);
|
|
83497
83487
|
if (filterIn && !filterIn({
|
|
83498
83488
|
action: internalToolName,
|
|
83499
|
-
tool: tool$
|
|
83489
|
+
tool: tool$3,
|
|
83500
83490
|
mcpName: name,
|
|
83501
83491
|
toolNameWithScope,
|
|
83502
83492
|
internalToolName,
|
|
@@ -83507,7 +83497,7 @@ async function composeMcpDepTools(mcpConfig, filterIn) {
|
|
|
83507
83497
|
arguments: args
|
|
83508
83498
|
}, void 0, { timeout: def.toolCallTimeout });
|
|
83509
83499
|
allTools[toolId] = {
|
|
83510
|
-
...tool$
|
|
83500
|
+
...tool$3,
|
|
83511
83501
|
execute,
|
|
83512
83502
|
_originalName: toolNameWithScope
|
|
83513
83503
|
};
|
|
@@ -83559,10 +83549,10 @@ var createConfigPlugin = () => ({
|
|
|
83559
83549
|
name: "built-in-config",
|
|
83560
83550
|
version: "1.0.0",
|
|
83561
83551
|
enforce: "pre",
|
|
83562
|
-
transformTool: (tool$
|
|
83552
|
+
transformTool: (tool$3, context2) => {
|
|
83563
83553
|
const config = context2.server.findToolConfig?.(context2.toolName);
|
|
83564
|
-
if (config?.description) tool$
|
|
83565
|
-
return tool$
|
|
83554
|
+
if (config?.description) tool$3.description = config.description;
|
|
83555
|
+
return tool$3;
|
|
83566
83556
|
}
|
|
83567
83557
|
});
|
|
83568
83558
|
var config_plugin_default = createConfigPlugin();
|
|
@@ -83570,16 +83560,16 @@ var createToolNameMappingPlugin = () => ({
|
|
|
83570
83560
|
name: "built-in-tool-name-mapping",
|
|
83571
83561
|
version: "1.0.0",
|
|
83572
83562
|
enforce: "pre",
|
|
83573
|
-
transformTool: (tool$
|
|
83563
|
+
transformTool: (tool$3, context2) => {
|
|
83574
83564
|
const server = context2.server;
|
|
83575
83565
|
const toolName = context2.toolName;
|
|
83576
|
-
const originalName = tool$
|
|
83566
|
+
const originalName = tool$3._originalName || toolName;
|
|
83577
83567
|
const dotNotation = originalName.replace(/_/g, ".");
|
|
83578
83568
|
const underscoreNotation = originalName.replace(/\./g, "_");
|
|
83579
83569
|
if (dotNotation !== originalName && server.toolNameMapping) server.toolNameMapping.set(dotNotation, toolName);
|
|
83580
83570
|
if (underscoreNotation !== originalName && server.toolNameMapping) server.toolNameMapping.set(underscoreNotation, toolName);
|
|
83581
83571
|
if (originalName !== toolName && server.toolNameMapping) server.toolNameMapping.set(originalName, toolName);
|
|
83582
|
-
return tool$
|
|
83572
|
+
return tool$3;
|
|
83583
83573
|
}
|
|
83584
83574
|
});
|
|
83585
83575
|
var tool_name_mapping_plugin_default = createToolNameMappingPlugin();
|
|
@@ -83928,10 +83918,10 @@ var CompiledPrompts = {
|
|
|
83928
83918
|
};
|
|
83929
83919
|
var PromptUtils = {
|
|
83930
83920
|
generateToolList: (tools) => {
|
|
83931
|
-
return tools.filter((tool$
|
|
83921
|
+
return tools.filter((tool$3) => !tool$3.hide).map((tool$3) => `<tool name="${tool$3.name}"${tool$3.description ? ` description="${tool$3.description}"` : ""}/>`).join("\n");
|
|
83932
83922
|
},
|
|
83933
83923
|
generateHiddenToolList: (tools) => {
|
|
83934
|
-
return tools.filter((tool$
|
|
83924
|
+
return tools.filter((tool$3) => tool$3.hide).map((tool$3) => `<tool name="${tool$3.name}" hide/>`).join("\n");
|
|
83935
83925
|
},
|
|
83936
83926
|
formatWorkflowSteps: (steps) => {
|
|
83937
83927
|
if (!steps.length) return "";
|
|
@@ -85281,11 +85271,11 @@ var SamplingExecutor = class extends BaseSamplingExecutor {
|
|
|
85281
85271
|
}
|
|
85282
85272
|
buildDepGroups() {
|
|
85283
85273
|
const depGroups = {};
|
|
85284
|
-
this.toolNameToDetailList.forEach(([toolName, tool$
|
|
85285
|
-
if (tool$
|
|
85274
|
+
this.toolNameToDetailList.forEach(([toolName, tool$3]) => {
|
|
85275
|
+
if (tool$3?.inputSchema) depGroups[toolName] = {
|
|
85286
85276
|
type: "object",
|
|
85287
|
-
description: tool$
|
|
85288
|
-
...tool$
|
|
85277
|
+
description: tool$3.description || `Tool: ${toolName}`,
|
|
85278
|
+
...tool$3.inputSchema
|
|
85289
85279
|
};
|
|
85290
85280
|
else {
|
|
85291
85281
|
const toolSchema = this.server.getHiddenToolSchema(toolName);
|
|
@@ -85331,9 +85321,9 @@ var SamplingExecutor = class extends BaseSamplingExecutor {
|
|
|
85331
85321
|
}
|
|
85332
85322
|
buildSystemPrompt(userRequest, agenticSchema, context2) {
|
|
85333
85323
|
const toolList = this.allToolNames.map((name) => {
|
|
85334
|
-
const tool$
|
|
85324
|
+
const tool$3 = this.toolNameToDetailList.find(([toolName]) => toolName === name);
|
|
85335
85325
|
const toolSchema = this.server.getHiddenToolSchema(name);
|
|
85336
|
-
if (tool$
|
|
85326
|
+
if (tool$3 && tool$3[1]) return `- ${name}: ${tool$3[1].description || `Tool: ${name}`}`;
|
|
85337
85327
|
else if (toolSchema) return `- ${name}: ${toolSchema.description}`;
|
|
85338
85328
|
return `- ${name}`;
|
|
85339
85329
|
}).join("\n");
|
|
@@ -85720,11 +85710,11 @@ var PluginManager = class {
|
|
|
85720
85710
|
/**
|
|
85721
85711
|
* Apply transformTool hooks to a tool during composition
|
|
85722
85712
|
*/
|
|
85723
|
-
async applyTransformToolHooks(tool$
|
|
85713
|
+
async applyTransformToolHooks(tool$3, context2) {
|
|
85724
85714
|
const transformPlugins = this.plugins.filter((p2) => p2.transformTool && shouldApplyPlugin(p2, context2.mode));
|
|
85725
|
-
if (transformPlugins.length === 0) return tool$
|
|
85715
|
+
if (transformPlugins.length === 0) return tool$3;
|
|
85726
85716
|
const sortedPlugins = sortPluginsByOrder(transformPlugins);
|
|
85727
|
-
let currentTool = tool$
|
|
85717
|
+
let currentTool = tool$3;
|
|
85728
85718
|
for (const plugin of sortedPlugins) if (plugin.transformTool) try {
|
|
85729
85719
|
const result = await plugin.transformTool(currentTool, context2);
|
|
85730
85720
|
if (result) currentTool = result;
|
|
@@ -85917,11 +85907,11 @@ var ToolManager = class {
|
|
|
85917
85907
|
* Get tool schema if it's hidden (for internal access)
|
|
85918
85908
|
*/
|
|
85919
85909
|
getHiddenToolSchema(name) {
|
|
85920
|
-
const tool$
|
|
85910
|
+
const tool$3 = this.toolRegistry.get(name);
|
|
85921
85911
|
const config = this.toolConfigs.get(name);
|
|
85922
|
-
if (tool$
|
|
85923
|
-
description: tool$
|
|
85924
|
-
schema: tool$
|
|
85912
|
+
if (tool$3 && config?.visibility?.hidden && tool$3.schema) return {
|
|
85913
|
+
description: tool$3.description,
|
|
85914
|
+
schema: tool$3.schema
|
|
85925
85915
|
};
|
|
85926
85916
|
}
|
|
85927
85917
|
/**
|
|
@@ -85948,16 +85938,16 @@ var ToolManager = class {
|
|
|
85948
85938
|
*/
|
|
85949
85939
|
getRegisteredToolsAsComposed() {
|
|
85950
85940
|
const composedTools = {};
|
|
85951
|
-
for (const [name, tool$
|
|
85941
|
+
for (const [name, tool$3] of this.toolRegistry.entries()) {
|
|
85952
85942
|
if (this.toolConfigs.get(name)?.visibility?.public === true) continue;
|
|
85953
85943
|
composedTools[name] = {
|
|
85954
85944
|
name,
|
|
85955
|
-
description: tool$
|
|
85956
|
-
inputSchema: jsonSchema$2(tool$
|
|
85945
|
+
description: tool$3.description,
|
|
85946
|
+
inputSchema: jsonSchema$2(tool$3.schema || {
|
|
85957
85947
|
type: "object",
|
|
85958
85948
|
properties: {}
|
|
85959
85949
|
}),
|
|
85960
|
-
execute: tool$
|
|
85950
|
+
execute: tool$3.callback
|
|
85961
85951
|
};
|
|
85962
85952
|
}
|
|
85963
85953
|
return composedTools;
|
|
@@ -86011,14 +86001,14 @@ async function processToolsWithPlugins(server, _externalTools, mode) {
|
|
|
86011
86001
|
function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicToolNames, server) {
|
|
86012
86002
|
const depGroups = {};
|
|
86013
86003
|
const toolManager = server.toolManager;
|
|
86014
|
-
toolNameToDetailList.forEach(([toolName, tool$
|
|
86004
|
+
toolNameToDetailList.forEach(([toolName, tool$3]) => {
|
|
86015
86005
|
const resolvedName = toolManager.resolveToolName(toolName);
|
|
86016
86006
|
if (hiddenToolNames.includes(resolvedName ?? "") || publicToolNames.includes(resolvedName ?? "")) return;
|
|
86017
|
-
if (!tool$
|
|
86007
|
+
if (!tool$3) {
|
|
86018
86008
|
const allToolNames = [...toolNameToDetailList.map(([n]) => n)];
|
|
86019
86009
|
throw new Error(`Action ${toolName} not found, available action list: ${allToolNames.join(", ")}`);
|
|
86020
86010
|
}
|
|
86021
|
-
const baseSchema = tool$
|
|
86011
|
+
const baseSchema = tool$3.inputSchema.jsonSchema ?? tool$3.inputSchema ?? {
|
|
86022
86012
|
type: "object",
|
|
86023
86013
|
properties: {},
|
|
86024
86014
|
required: []
|
|
@@ -86029,7 +86019,7 @@ function buildDependencyGroups(toolNameToDetailList, hiddenToolNames, publicTool
|
|
|
86029
86019
|
const sanitizedKey = sanitizePropertyKey(toolName);
|
|
86030
86020
|
depGroups[sanitizedKey] = {
|
|
86031
86021
|
type: "object",
|
|
86032
|
-
description: tool$
|
|
86022
|
+
description: tool$3.description,
|
|
86033
86023
|
properties: updatedProperties,
|
|
86034
86024
|
required: [...baseRequired],
|
|
86035
86025
|
additionalProperties: false
|
|
@@ -86264,9 +86254,9 @@ var ComposableMCPServer = class extends _modelcontextprotocol_sdk_server_index_j
|
|
|
86264
86254
|
const requestedToolNames = /* @__PURE__ */ new Set();
|
|
86265
86255
|
const availableToolNames = /* @__PURE__ */ new Set();
|
|
86266
86256
|
const allPlaceholderUsages = [];
|
|
86267
|
-
tagToResults.tool.forEach((tool$
|
|
86268
|
-
if (tool$
|
|
86269
|
-
const originalName = tool$
|
|
86257
|
+
tagToResults.tool.forEach((tool$3) => {
|
|
86258
|
+
if (tool$3.attribs.name) {
|
|
86259
|
+
const originalName = tool$3.attribs.name;
|
|
86270
86260
|
const toolName = sanitizePropertyKey(originalName);
|
|
86271
86261
|
if (toolName.endsWith(`_${ALL_TOOLS_PLACEHOLDER2}`) || toolName === ALL_TOOLS_PLACEHOLDER2) allPlaceholderUsages.push(originalName);
|
|
86272
86262
|
else requestedToolNames.add(toolName);
|
|
@@ -86285,18 +86275,18 @@ var ComposableMCPServer = class extends _modelcontextprotocol_sdk_server_index_j
|
|
|
86285
86275
|
if (actionIndex !== -1) matchingStep.actions[actionIndex] = toolId;
|
|
86286
86276
|
return true;
|
|
86287
86277
|
}
|
|
86288
|
-
return tagToResults.tool.find((tool$
|
|
86289
|
-
if (tool$
|
|
86290
|
-
return tool$
|
|
86278
|
+
return tagToResults.tool.find((tool$3) => {
|
|
86279
|
+
if (tool$3.attribs.name === `${mcpName}.${ALL_TOOLS_PLACEHOLDER2}` || tool$3.attribs.name === `${mcpName}`) return true;
|
|
86280
|
+
return tool$3.attribs.name === toolNameWithScope || tool$3.attribs.name === toolId;
|
|
86291
86281
|
});
|
|
86292
86282
|
});
|
|
86293
|
-
Object.entries(tools).forEach(([toolId, tool$
|
|
86294
|
-
this.toolManager.registerTool(toolId, tool$
|
|
86283
|
+
Object.entries(tools).forEach(([toolId, tool$3]) => {
|
|
86284
|
+
this.toolManager.registerTool(toolId, tool$3.description || "", tool$3.inputSchema, tool$3.execute);
|
|
86295
86285
|
});
|
|
86296
86286
|
const registeredTools = this.toolManager.getRegisteredToolsAsComposed();
|
|
86297
86287
|
const allTools = { ...tools };
|
|
86298
|
-
Object.entries(registeredTools).forEach(([toolName, tool$
|
|
86299
|
-
if (!allTools[toolName]) allTools[toolName] = tool$
|
|
86288
|
+
Object.entries(registeredTools).forEach(([toolName, tool$3]) => {
|
|
86289
|
+
if (!allTools[toolName]) allTools[toolName] = tool$3;
|
|
86300
86290
|
availableToolNames.add(toolName);
|
|
86301
86291
|
});
|
|
86302
86292
|
if (allPlaceholderUsages.length > 0) {
|
|
@@ -86339,9 +86329,9 @@ var ComposableMCPServer = class extends _modelcontextprotocol_sdk_server_index_j
|
|
|
86339
86329
|
const hiddenToolNames = this.getHiddenToolNames();
|
|
86340
86330
|
const contextToolNames = toolNameToDetailList.map(([name2]) => name2).filter((n) => !hiddenToolNames.includes(n));
|
|
86341
86331
|
publicToolNames.forEach((toolId) => {
|
|
86342
|
-
const tool$
|
|
86343
|
-
if (!tool$
|
|
86344
|
-
this.tool(toolId, tool$
|
|
86332
|
+
const tool$3 = allTools[toolId];
|
|
86333
|
+
if (!tool$3) throw new Error(`Public tool ${toolId} not found in registry, available: ${Object.keys(allTools).join(", ")}`);
|
|
86334
|
+
this.tool(toolId, tool$3.description || "", jsonSchema$2(tool$3.inputSchema), tool$3.execute, { internal: false });
|
|
86345
86335
|
});
|
|
86346
86336
|
await this.pluginManager.triggerComposeEnd({
|
|
86347
86337
|
toolName: name,
|
|
@@ -86573,6 +86563,48 @@ function getPublicBaseUrl(options) {
|
|
|
86573
86563
|
}
|
|
86574
86564
|
var init_helpers = require_chunk.__esmMin((() => {}));
|
|
86575
86565
|
|
|
86566
|
+
//#endregion
|
|
86567
|
+
//#region src/utils/log-storage.ts
|
|
86568
|
+
const logs = [];
|
|
86569
|
+
const networkRequests = [];
|
|
86570
|
+
let nextLogId = 1;
|
|
86571
|
+
let nextRequestId = 1;
|
|
86572
|
+
const MAX_LOGS = 1e3;
|
|
86573
|
+
const MAX_REQUESTS = 1e3;
|
|
86574
|
+
function addLog(type, args) {
|
|
86575
|
+
const log = {
|
|
86576
|
+
id: nextLogId++,
|
|
86577
|
+
type,
|
|
86578
|
+
args,
|
|
86579
|
+
timestamp: Date.now()
|
|
86580
|
+
};
|
|
86581
|
+
logs.push(log);
|
|
86582
|
+
if (logs.length > MAX_LOGS) logs.shift();
|
|
86583
|
+
return log;
|
|
86584
|
+
}
|
|
86585
|
+
function addNetworkRequest(request) {
|
|
86586
|
+
const req = {
|
|
86587
|
+
id: nextRequestId++,
|
|
86588
|
+
timestamp: Date.now(),
|
|
86589
|
+
...request
|
|
86590
|
+
};
|
|
86591
|
+
networkRequests.push(req);
|
|
86592
|
+
if (networkRequests.length > MAX_REQUESTS) networkRequests.shift();
|
|
86593
|
+
return req;
|
|
86594
|
+
}
|
|
86595
|
+
function getLogs() {
|
|
86596
|
+
return [...logs];
|
|
86597
|
+
}
|
|
86598
|
+
function getNetworkRequests() {
|
|
86599
|
+
return [...networkRequests];
|
|
86600
|
+
}
|
|
86601
|
+
function getLogById(id) {
|
|
86602
|
+
return logs.find((l) => l.id === id);
|
|
86603
|
+
}
|
|
86604
|
+
function getRequestById(id) {
|
|
86605
|
+
return networkRequests.find((r) => r.id === id);
|
|
86606
|
+
}
|
|
86607
|
+
|
|
86576
86608
|
//#endregion
|
|
86577
86609
|
//#region src/mcp.ts
|
|
86578
86610
|
init_helpers();
|
|
@@ -86700,13 +86732,49 @@ Default dev server URL: ${process.env.DEV_INSPECTOR_PUBLIC_BASE_URL || `http://$
|
|
|
86700
86732
|
] };
|
|
86701
86733
|
});
|
|
86702
86734
|
async function refreshChromeState() {
|
|
86703
|
-
if (chromeDisabled)
|
|
86704
|
-
|
|
86705
|
-
|
|
86706
|
-
|
|
86707
|
-
|
|
86708
|
-
|
|
86709
|
-
|
|
86735
|
+
if (chromeDisabled) {
|
|
86736
|
+
const requests = getNetworkRequests();
|
|
86737
|
+
const logs$1 = getLogs();
|
|
86738
|
+
const requestOptions$1 = requests.map((r) => {
|
|
86739
|
+
const truncatedUrl = r.url.length > 60 ? r.url.substring(0, 57) + "..." : r.url;
|
|
86740
|
+
return `reqid=${r.id} ${r.method} ${truncatedUrl} [${r.status}]`;
|
|
86741
|
+
}).reverse().join("\n");
|
|
86742
|
+
const messageOptions$1 = logs$1.map((l) => {
|
|
86743
|
+
const text$2 = l.args.map(String).join(" ");
|
|
86744
|
+
const truncatedText = text$2.length > 60 ? text$2.substring(0, 57) + "..." : text$2;
|
|
86745
|
+
return `msgid=${l.id} [${l.type}] ${truncatedText}`;
|
|
86746
|
+
}).reverse().join("\n");
|
|
86747
|
+
mcpServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.ListPromptsRequestSchema, async (_request) => {
|
|
86748
|
+
return { prompts: [
|
|
86749
|
+
{ ...PROMPT_SCHEMAS.capture_element },
|
|
86750
|
+
{ ...PROMPT_SCHEMAS.view_inspections },
|
|
86751
|
+
{
|
|
86752
|
+
...PROMPT_SCHEMAS.get_network_requests,
|
|
86753
|
+
arguments: [{
|
|
86754
|
+
name: "reqid",
|
|
86755
|
+
description: `Optional. The request ID to get details for. If omitted, only refreshes and lists requests.\n\nAvailable requests:\n${requestOptions$1 || "No requests available"}`,
|
|
86756
|
+
required: false
|
|
86757
|
+
}]
|
|
86758
|
+
},
|
|
86759
|
+
{
|
|
86760
|
+
...PROMPT_SCHEMAS.get_console_messages,
|
|
86761
|
+
arguments: [{
|
|
86762
|
+
name: "msgid",
|
|
86763
|
+
description: `Optional. The message ID to get details for. If omitted, only refreshes and lists messages.\n\nAvailable messages:\n${messageOptions$1 || "No messages available"}`,
|
|
86764
|
+
required: false
|
|
86765
|
+
}]
|
|
86766
|
+
}
|
|
86767
|
+
] };
|
|
86768
|
+
});
|
|
86769
|
+
await mcpServer.sendPromptListChanged();
|
|
86770
|
+
return { messages: [{
|
|
86771
|
+
role: "user",
|
|
86772
|
+
content: {
|
|
86773
|
+
type: "text",
|
|
86774
|
+
text: `Refreshed state (Local Interception).\n\nNetwork Requests:\n${requestOptions$1 || "No requests"}\n\nConsole Messages:\n${messageOptions$1 || "No messages"}`
|
|
86775
|
+
}
|
|
86776
|
+
}] };
|
|
86777
|
+
}
|
|
86710
86778
|
const networkResult = await callMcpMethod(mcpServer, "tools/call", {
|
|
86711
86779
|
name: "chrome_devtools",
|
|
86712
86780
|
arguments: {
|
|
@@ -86766,13 +86834,55 @@ Default dev server URL: ${process.env.DEV_INSPECTOR_PUBLIC_BASE_URL || `http://$
|
|
|
86766
86834
|
}
|
|
86767
86835
|
mcpServer.setRequestHandler(_modelcontextprotocol_sdk_types_js.GetPromptRequestSchema, async (request) => {
|
|
86768
86836
|
const promptName = request.params.name;
|
|
86769
|
-
if (chromeDisabled
|
|
86770
|
-
|
|
86771
|
-
|
|
86772
|
-
|
|
86773
|
-
|
|
86837
|
+
if (chromeDisabled) {
|
|
86838
|
+
if (promptName === "get_network_requests") {
|
|
86839
|
+
const refreshResult = await refreshChromeState();
|
|
86840
|
+
const reqidStr = request.params.arguments?.reqid;
|
|
86841
|
+
if (!reqidStr) return refreshResult;
|
|
86842
|
+
const req = getRequestById(parseInt(reqidStr));
|
|
86843
|
+
if (req) return { messages: [{
|
|
86844
|
+
role: "user",
|
|
86845
|
+
content: {
|
|
86846
|
+
type: "text",
|
|
86847
|
+
text: req.details || JSON.stringify(req, null, 2)
|
|
86848
|
+
}
|
|
86849
|
+
}] };
|
|
86850
|
+
return { messages: [{
|
|
86851
|
+
role: "user",
|
|
86852
|
+
content: {
|
|
86853
|
+
type: "text",
|
|
86854
|
+
text: "Request not found"
|
|
86855
|
+
}
|
|
86856
|
+
}] };
|
|
86857
|
+
}
|
|
86858
|
+
if (promptName === "get_console_messages") {
|
|
86859
|
+
const refreshResult = await refreshChromeState();
|
|
86860
|
+
const msgidStr = request.params.arguments?.msgid;
|
|
86861
|
+
if (!msgidStr) return refreshResult;
|
|
86862
|
+
const log = getLogById(parseInt(msgidStr));
|
|
86863
|
+
if (log) return { messages: [{
|
|
86864
|
+
role: "user",
|
|
86865
|
+
content: {
|
|
86866
|
+
type: "text",
|
|
86867
|
+
text: JSON.stringify(log, null, 2)
|
|
86868
|
+
}
|
|
86869
|
+
}] };
|
|
86870
|
+
return { messages: [{
|
|
86871
|
+
role: "user",
|
|
86872
|
+
content: {
|
|
86873
|
+
type: "text",
|
|
86874
|
+
text: "Log not found"
|
|
86875
|
+
}
|
|
86876
|
+
}] };
|
|
86774
86877
|
}
|
|
86775
|
-
|
|
86878
|
+
if (promptName === "launch_chrome_devtools") return { messages: [{
|
|
86879
|
+
role: "user",
|
|
86880
|
+
content: {
|
|
86881
|
+
type: "text",
|
|
86882
|
+
text: "Chrome integration is disabled. Enable it by unsetting DEV_INSPECTOR_DISABLE_CHROME or setting it to 0/false."
|
|
86883
|
+
}
|
|
86884
|
+
}] };
|
|
86885
|
+
}
|
|
86776
86886
|
switch (promptName) {
|
|
86777
86887
|
case "capture_element": return { messages: (await callMcpMethod(mcpServer, "tools/call", {
|
|
86778
86888
|
name: "capture_element_context",
|
|
@@ -87239,6 +87349,7 @@ function isInitializeRequest(body) {
|
|
|
87239
87349
|
//#endregion
|
|
87240
87350
|
//#region src/middleware/inspector-middleware.ts
|
|
87241
87351
|
const __dirname$1 = (0, path.dirname)((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
87352
|
+
const MAX_BODY_SIZE = 10 * 1024 * 1024;
|
|
87242
87353
|
/**
|
|
87243
87354
|
* Get the inspector client script content
|
|
87244
87355
|
* Tries multiple paths to locate the bundled inspector script
|
|
@@ -87317,6 +87428,57 @@ function setupInspectorMiddleware(middlewares, config) {
|
|
|
87317
87428
|
res.end(JSON.stringify(config || {}));
|
|
87318
87429
|
return;
|
|
87319
87430
|
}
|
|
87431
|
+
if (req.url === "/__inspector__/log" && req.method === "POST") {
|
|
87432
|
+
let body = "";
|
|
87433
|
+
let bodySize = 0;
|
|
87434
|
+
req.on("data", (chunk) => {
|
|
87435
|
+
bodySize += chunk.length;
|
|
87436
|
+
if (bodySize > MAX_BODY_SIZE) {
|
|
87437
|
+
res.statusCode = 413;
|
|
87438
|
+
res.end("Request body too large");
|
|
87439
|
+
req.destroy();
|
|
87440
|
+
return;
|
|
87441
|
+
}
|
|
87442
|
+
body += chunk.toString();
|
|
87443
|
+
});
|
|
87444
|
+
req.on("end", () => {
|
|
87445
|
+
if (bodySize > MAX_BODY_SIZE) return;
|
|
87446
|
+
try {
|
|
87447
|
+
const { type, data: data$1 } = JSON.parse(body);
|
|
87448
|
+
if (type === "console") addLog(data$1.type, data$1.args);
|
|
87449
|
+
else if (type === "network") addNetworkRequest(data$1);
|
|
87450
|
+
res.statusCode = 200;
|
|
87451
|
+
res.end("ok");
|
|
87452
|
+
} catch {
|
|
87453
|
+
res.statusCode = 400;
|
|
87454
|
+
res.end("Invalid JSON");
|
|
87455
|
+
}
|
|
87456
|
+
});
|
|
87457
|
+
return;
|
|
87458
|
+
}
|
|
87459
|
+
const requestDetailsMatch = req.url?.match(/^\/__inspector__\/request-details\/(\d+)$/);
|
|
87460
|
+
if (requestDetailsMatch && req.method === "GET") {
|
|
87461
|
+
const reqid = parseInt(requestDetailsMatch[1]);
|
|
87462
|
+
if (!Number.isInteger(reqid) || reqid <= 0) {
|
|
87463
|
+
res.statusCode = 400;
|
|
87464
|
+
res.end("Invalid request ID");
|
|
87465
|
+
return;
|
|
87466
|
+
}
|
|
87467
|
+
const request = getRequestById(reqid);
|
|
87468
|
+
if (request && request.details) {
|
|
87469
|
+
res.statusCode = 200;
|
|
87470
|
+
res.setHeader("Content-Type", "text/plain");
|
|
87471
|
+
res.end(request.details);
|
|
87472
|
+
} else if (request) {
|
|
87473
|
+
res.statusCode = 200;
|
|
87474
|
+
res.setHeader("Content-Type", "application/json");
|
|
87475
|
+
res.end(JSON.stringify(request, null, 2));
|
|
87476
|
+
} else {
|
|
87477
|
+
res.statusCode = 404;
|
|
87478
|
+
res.end("Request not found");
|
|
87479
|
+
}
|
|
87480
|
+
return;
|
|
87481
|
+
}
|
|
87320
87482
|
next$1();
|
|
87321
87483
|
});
|
|
87322
87484
|
}
|
|
@@ -88399,6 +88561,26 @@ function createACPProvider(config) {
|
|
|
88399
88561
|
return new ACPProvider(config);
|
|
88400
88562
|
}
|
|
88401
88563
|
|
|
88564
|
+
//#endregion
|
|
88565
|
+
//#region src/middleware/tools/context-selector.ts
|
|
88566
|
+
/**
|
|
88567
|
+
* Context selector tool schema - used by AI to select relevant context items
|
|
88568
|
+
*/
|
|
88569
|
+
const contextSelectorSchema = zod.z.object({
|
|
88570
|
+
consoleIds: zod.z.array(zod.z.number()).optional().describe("IDs of relevant console messages to include"),
|
|
88571
|
+
networkIds: zod.z.array(zod.z.number()).optional().describe("IDs of relevant network requests to include"),
|
|
88572
|
+
includeElement: zod.z.boolean().optional().describe("Whether to include the source element info (HTML/tag)"),
|
|
88573
|
+
includeStyles: zod.z.boolean().optional().describe("Whether to include the computed styles"),
|
|
88574
|
+
reasoning: zod.z.string().optional().describe("Brief explanation of why these items are relevant and what has been selected")
|
|
88575
|
+
});
|
|
88576
|
+
const contextSelectorTool = (0, ai.tool)({
|
|
88577
|
+
description: "Select relevant console messages and network requests based on the source context. Call this tool with the IDs of items you think are relevant to the inspected element.",
|
|
88578
|
+
inputSchema: contextSelectorSchema,
|
|
88579
|
+
execute: async () => {
|
|
88580
|
+
return `Selected`;
|
|
88581
|
+
}
|
|
88582
|
+
});
|
|
88583
|
+
|
|
88402
88584
|
//#endregion
|
|
88403
88585
|
//#region src/utils/npm-package.ts
|
|
88404
88586
|
/**
|
|
@@ -88672,7 +88854,7 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
88672
88854
|
}
|
|
88673
88855
|
try {
|
|
88674
88856
|
const body = await readBody(req);
|
|
88675
|
-
const { messages, agent, envVars, sessionId, isAutomated } = JSON.parse(body);
|
|
88857
|
+
const { messages, agent, envVars, sessionId, isAutomated, inferContext } = JSON.parse(body);
|
|
88676
88858
|
const cwd$1 = process.cwd();
|
|
88677
88859
|
let provider;
|
|
88678
88860
|
let shouldCleanupProvider = true;
|
|
@@ -88710,7 +88892,10 @@ function setupAcpMiddleware(middlewares, serverContext, acpOptions) {
|
|
|
88710
88892
|
}
|
|
88711
88893
|
let mcpTools = {};
|
|
88712
88894
|
const getTransport = () => getInspectorTransport() || getActiveTransport();
|
|
88713
|
-
|
|
88895
|
+
if (inferContext) {
|
|
88896
|
+
console.log("[dev-inspector] [acp] Context inference mode - adding context_selector tool");
|
|
88897
|
+
mcpTools = { context_selector: contextSelectorTool };
|
|
88898
|
+
} else mcpTools = await loadMcpToolsV5(getTransport);
|
|
88714
88899
|
const mode = agent.acpMode ?? acpOptions?.acpMode;
|
|
88715
88900
|
const model = agent.acpModel ?? acpOptions?.acpModel;
|
|
88716
88901
|
const delay = agent.acpDelay ?? acpOptions?.acpDelay;
|