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.esm.js
CHANGED
|
@@ -410,7 +410,7 @@ function inferToolDescription(form) {
|
|
|
410
410
|
const heading = getNearestHeadingText(form);
|
|
411
411
|
const pageTitle = document.title?.trim();
|
|
412
412
|
if (heading && pageTitle)
|
|
413
|
-
return `${heading}
|
|
413
|
+
return `${heading}: ${pageTitle}`;
|
|
414
414
|
if (heading)
|
|
415
415
|
return heading;
|
|
416
416
|
if (pageTitle)
|
|
@@ -939,6 +939,7 @@ function buildExecuteHandler(form, config, toolName, metadata) {
|
|
|
939
939
|
attachSubmitInterceptor(form, toolName);
|
|
940
940
|
return async (params) => {
|
|
941
941
|
pendingFillWarnings.set(form, []);
|
|
942
|
+
pendingWarnings.delete(form);
|
|
942
943
|
fillFormFields(form, params);
|
|
943
944
|
const missingNow = getMissingRequired(metadata, params);
|
|
944
945
|
if (missingNow.length > 0)
|
|
@@ -1107,7 +1108,7 @@ function fillFormFields(form, params) {
|
|
|
1107
1108
|
setReactValue(input, String(value ?? ""));
|
|
1108
1109
|
snapshot[key] = input.value;
|
|
1109
1110
|
} else if (input instanceof HTMLSelectElement) {
|
|
1110
|
-
fillSelectElement(input, value);
|
|
1111
|
+
fillSelectElement(input, value, form, key);
|
|
1111
1112
|
snapshot[key] = input.multiple ? Array.from(input.options).filter((o) => o.selected).map((o) => o.value) : input.value;
|
|
1112
1113
|
}
|
|
1113
1114
|
continue;
|
|
@@ -1130,7 +1131,7 @@ function fillFormFields(form, params) {
|
|
|
1130
1131
|
setReactValue(effectiveEl, String(value ?? ""));
|
|
1131
1132
|
snapshot[key] = effectiveEl.value;
|
|
1132
1133
|
} else if (effectiveEl instanceof HTMLSelectElement) {
|
|
1133
|
-
fillSelectElement(effectiveEl, value);
|
|
1134
|
+
fillSelectElement(effectiveEl, value, form, key);
|
|
1134
1135
|
snapshot[key] = effectiveEl.multiple ? Array.from(effectiveEl.options).filter((o) => o.selected).map((o) => o.value) : effectiveEl.value;
|
|
1135
1136
|
} else {
|
|
1136
1137
|
fillAriaField(effectiveEl, value);
|
|
@@ -1139,6 +1140,7 @@ function fillFormFields(form, params) {
|
|
|
1139
1140
|
}
|
|
1140
1141
|
}
|
|
1141
1142
|
lastFilledSnapshot.set(form, snapshot);
|
|
1143
|
+
window["__lastFillWarnings"] = pendingFillWarnings.get(form) ?? [];
|
|
1142
1144
|
}
|
|
1143
1145
|
function fillInput(input, form, key, value) {
|
|
1144
1146
|
const type = input.type.toLowerCase();
|
|
@@ -1205,7 +1207,7 @@ function fillInput(input, form, key, value) {
|
|
|
1205
1207
|
}
|
|
1206
1208
|
setReactValue(input, String(value ?? ""));
|
|
1207
1209
|
}
|
|
1208
|
-
function fillSelectElement(select, value) {
|
|
1210
|
+
function fillSelectElement(select, value, form, key) {
|
|
1209
1211
|
if (select.multiple) {
|
|
1210
1212
|
const vals = Array.isArray(value) ? value.map(String) : [String(value ?? "")];
|
|
1211
1213
|
for (const opt of Array.from(select.options)) {
|
|
@@ -1214,7 +1216,24 @@ function fillSelectElement(select, value) {
|
|
|
1214
1216
|
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1215
1217
|
return;
|
|
1216
1218
|
}
|
|
1217
|
-
|
|
1219
|
+
const strVal = String(value ?? "");
|
|
1220
|
+
select.value = strVal;
|
|
1221
|
+
if (select.value !== strVal) {
|
|
1222
|
+
const lower = strVal.toLowerCase();
|
|
1223
|
+
const byLabel = Array.from(select.options).find(
|
|
1224
|
+
(o) => o.text.trim().toLowerCase() === lower || o.label.trim().toLowerCase() === lower
|
|
1225
|
+
);
|
|
1226
|
+
if (byLabel) {
|
|
1227
|
+
select.value = byLabel.value;
|
|
1228
|
+
} else if (form && key) {
|
|
1229
|
+
pendingFillWarnings.get(form)?.push({
|
|
1230
|
+
field: key,
|
|
1231
|
+
type: "not_filled",
|
|
1232
|
+
message: `"${key}" value "${strVal}" did not match any option in the select`,
|
|
1233
|
+
original: strVal
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1218
1237
|
select.dispatchEvent(new Event("change", { bubbles: true }));
|
|
1219
1238
|
}
|
|
1220
1239
|
function fillAriaField(el, value) {
|