auto-webmcp 0.3.2 → 0.3.4
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/auto-webmcp.cjs.js +24 -5
- package/dist/auto-webmcp.cjs.js.map +2 -2
- package/dist/auto-webmcp.esm.js +24 -5
- package/dist/auto-webmcp.esm.js.map +2 -2
- package/dist/auto-webmcp.iife.js +1 -1
- package/dist/auto-webmcp.iife.js.map +3 -3
- package/dist/interceptor.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/auto-webmcp.cjs.js
CHANGED
|
@@ -429,7 +429,7 @@ function inferToolDescription(form) {
|
|
|
429
429
|
const heading = getNearestHeadingText(form);
|
|
430
430
|
const pageTitle = document.title?.trim();
|
|
431
431
|
if (heading && pageTitle)
|
|
432
|
-
return `${heading}
|
|
432
|
+
return `${heading}: ${pageTitle}`;
|
|
433
433
|
if (heading)
|
|
434
434
|
return heading;
|
|
435
435
|
if (pageTitle)
|
|
@@ -958,6 +958,7 @@ function buildExecuteHandler(form, config, toolName, metadata) {
|
|
|
958
958
|
attachSubmitInterceptor(form, toolName);
|
|
959
959
|
return async (params) => {
|
|
960
960
|
pendingFillWarnings.set(form, []);
|
|
961
|
+
pendingWarnings.delete(form);
|
|
961
962
|
fillFormFields(form, params);
|
|
962
963
|
const missingNow = getMissingRequired(metadata, params);
|
|
963
964
|
if (missingNow.length > 0)
|
|
@@ -1126,7 +1127,7 @@ function fillFormFields(form, params) {
|
|
|
1126
1127
|
setReactValue(input, String(value ?? ""));
|
|
1127
1128
|
snapshot[key] = input.value;
|
|
1128
1129
|
} else if (input instanceof HTMLSelectElement) {
|
|
1129
|
-
fillSelectElement(input, value);
|
|
1130
|
+
fillSelectElement(input, value, form, key);
|
|
1130
1131
|
snapshot[key] = input.multiple ? Array.from(input.options).filter((o) => o.selected).map((o) => o.value) : input.value;
|
|
1131
1132
|
}
|
|
1132
1133
|
continue;
|
|
@@ -1149,7 +1150,7 @@ function fillFormFields(form, params) {
|
|
|
1149
1150
|
setReactValue(effectiveEl, String(value ?? ""));
|
|
1150
1151
|
snapshot[key] = effectiveEl.value;
|
|
1151
1152
|
} else if (effectiveEl instanceof HTMLSelectElement) {
|
|
1152
|
-
fillSelectElement(effectiveEl, value);
|
|
1153
|
+
fillSelectElement(effectiveEl, value, form, key);
|
|
1153
1154
|
snapshot[key] = effectiveEl.multiple ? Array.from(effectiveEl.options).filter((o) => o.selected).map((o) => o.value) : effectiveEl.value;
|
|
1154
1155
|
} else {
|
|
1155
1156
|
fillAriaField(effectiveEl, value);
|
|
@@ -1158,6 +1159,7 @@ function fillFormFields(form, params) {
|
|
|
1158
1159
|
}
|
|
1159
1160
|
}
|
|
1160
1161
|
lastFilledSnapshot.set(form, snapshot);
|
|
1162
|
+
window["__lastFillWarnings"] = pendingFillWarnings.get(form) ?? [];
|
|
1161
1163
|
}
|
|
1162
1164
|
function fillInput(input, form, key, value) {
|
|
1163
1165
|
const type = input.type.toLowerCase();
|
|
@@ -1224,7 +1226,7 @@ function fillInput(input, form, key, value) {
|
|
|
1224
1226
|
}
|
|
1225
1227
|
setReactValue(input, String(value ?? ""));
|
|
1226
1228
|
}
|
|
1227
|
-
function fillSelectElement(select, value) {
|
|
1229
|
+
function fillSelectElement(select, value, form, key) {
|
|
1228
1230
|
if (select.multiple) {
|
|
1229
1231
|
const vals = Array.isArray(value) ? value.map(String) : [String(value ?? "")];
|
|
1230
1232
|
for (const opt of Array.from(select.options)) {
|
|
@@ -1233,7 +1235,24 @@ function fillSelectElement(select, value) {
|
|
|
1233
1235
|
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1234
1236
|
return;
|
|
1235
1237
|
}
|
|
1236
|
-
|
|
1238
|
+
const strVal = String(value ?? "");
|
|
1239
|
+
select.value = strVal;
|
|
1240
|
+
if (select.value !== strVal) {
|
|
1241
|
+
const lower = strVal.toLowerCase();
|
|
1242
|
+
const byLabel = Array.from(select.options).find(
|
|
1243
|
+
(o) => o.text.trim().toLowerCase() === lower || o.label.trim().toLowerCase() === lower
|
|
1244
|
+
);
|
|
1245
|
+
if (byLabel) {
|
|
1246
|
+
select.value = byLabel.value;
|
|
1247
|
+
} else if (form && key) {
|
|
1248
|
+
pendingFillWarnings.get(form)?.push({
|
|
1249
|
+
field: key,
|
|
1250
|
+
type: "not_filled",
|
|
1251
|
+
message: `"${key}" value "${strVal}" did not match any option in the select`,
|
|
1252
|
+
original: strVal
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1237
1256
|
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1238
1257
|
}
|
|
1239
1258
|
function fillAriaField(el, value) {
|