auto-webmcp 0.3.3 → 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.
@@ -1108,7 +1108,7 @@ function fillFormFields(form, params) {
1108
1108
  setReactValue(input, String(value ?? ""));
1109
1109
  snapshot[key] = input.value;
1110
1110
  } else if (input instanceof HTMLSelectElement) {
1111
- fillSelectElement(input, value);
1111
+ fillSelectElement(input, value, form, key);
1112
1112
  snapshot[key] = input.multiple ? Array.from(input.options).filter((o) => o.selected).map((o) => o.value) : input.value;
1113
1113
  }
1114
1114
  continue;
@@ -1131,7 +1131,7 @@ function fillFormFields(form, params) {
1131
1131
  setReactValue(effectiveEl, String(value ?? ""));
1132
1132
  snapshot[key] = effectiveEl.value;
1133
1133
  } else if (effectiveEl instanceof HTMLSelectElement) {
1134
- fillSelectElement(effectiveEl, value);
1134
+ fillSelectElement(effectiveEl, value, form, key);
1135
1135
  snapshot[key] = effectiveEl.multiple ? Array.from(effectiveEl.options).filter((o) => o.selected).map((o) => o.value) : effectiveEl.value;
1136
1136
  } else {
1137
1137
  fillAriaField(effectiveEl, value);
@@ -1140,6 +1140,7 @@ function fillFormFields(form, params) {
1140
1140
  }
1141
1141
  }
1142
1142
  lastFilledSnapshot.set(form, snapshot);
1143
+ window["__lastFillWarnings"] = pendingFillWarnings.get(form) ?? [];
1143
1144
  }
1144
1145
  function fillInput(input, form, key, value) {
1145
1146
  const type = input.type.toLowerCase();
@@ -1206,7 +1207,7 @@ function fillInput(input, form, key, value) {
1206
1207
  }
1207
1208
  setReactValue(input, String(value ?? ""));
1208
1209
  }
1209
- function fillSelectElement(select, value) {
1210
+ function fillSelectElement(select, value, form, key) {
1210
1211
  if (select.multiple) {
1211
1212
  const vals = Array.isArray(value) ? value.map(String) : [String(value ?? "")];
1212
1213
  for (const opt of Array.from(select.options)) {
@@ -1215,7 +1216,24 @@ function fillSelectElement(select, value) {
1215
1216
  select.dispatchEvent(new Event("change", { bubbles: true }));
1216
1217
  return;
1217
1218
  }
1218
- select.value = String(value ?? "");
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
+ }
1219
1237
  select.dispatchEvent(new Event("change", { bubbles: true }));
1220
1238
  }
1221
1239
  function fillAriaField(el, value) {