@sedum-dev/core 0.1.0-alpha.17 → 0.1.0-alpha.18

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/index.d.ts CHANGED
@@ -2696,7 +2696,8 @@ interface LocatorOptions {
2696
2696
  /**
2697
2697
  * Before returning a model-resolved target, show it outlined in a
2698
2698
  * screenshot and refuse it as ambiguous when several elements fit the
2699
- * sentence equally well. Cache hits are not checked again.
2699
+ * sentence equally well. Cache hits and picks that code made by an
2700
+ * ordinal or price rank ("the first", "the cheapest") are not checked.
2700
2701
  */
2701
2702
  readonly targetCheck?: TargetCheckOptions;
2702
2703
  readonly operation: Operation;
package/dist/index.js CHANGED
@@ -4446,8 +4446,10 @@ function resolveInCode(sentence, pick, candidates, loose = false) {
4446
4446
  ))
4447
4447
  return null;
4448
4448
  const selected = rankedSelection(ranked, group, items);
4449
- if (selected !== void 0) return selected;
4450
- return matchItemReference({ ...context, group, items });
4449
+ if (selected !== void 0)
4450
+ return selected && { target: selected, ranked: true };
4451
+ const referenced = matchItemReference({ ...context, group, items });
4452
+ return referenced && { target: referenced, ranked: false };
4451
4453
  }
4452
4454
  function statedGroupPick(sentence, candidates) {
4453
4455
  const request = new StatedGroupRequest(sentence, candidates);
@@ -5099,7 +5101,8 @@ var RuntimeSelection = class {
5099
5101
  const fallback = codeFallback ? codeAfterNone(options.sentence, this.candidates) : null;
5100
5102
  if (fallback) {
5101
5103
  this.gate("resolved_in_code_after_none");
5102
- return this.accept(fallback);
5104
+ this.context.state.ranked = fallback.ranked;
5105
+ return this.accept(fallback.target);
5103
5106
  }
5104
5107
  if (!options.visionResolver || options.operation !== "click")
5105
5108
  return this.unresolved("none");
@@ -5121,9 +5124,12 @@ var RuntimeSelection = class {
5121
5124
  const { options, codeFallback } = this.context;
5122
5125
  const anchor = codeFallback && !nameStated(options.sentence, selected) ? statedGroupPick(options.sentence, this.candidates) ?? selected : selected;
5123
5126
  const inCode = (pick) => resolveInCode(options.sentence, pick, this.candidates) ?? (codeFallback ? resolveInCode(options.sentence, anchor, this.candidates, true) : null);
5124
- const section = options.sectionMatch !== false && !inCode(selected) ? resolveBySection(options.sentence, selected, this.candidates) : null;
5125
- const target = section ?? inCode(selected);
5126
- return target ? { target, gate: section ? "resolved_by_section" : "resolved_in_code" } : null;
5127
+ const coded = inCode(selected);
5128
+ const section = options.sectionMatch !== false && !coded ? resolveBySection(options.sentence, selected, this.candidates) : null;
5129
+ if (section) return { target: section, gate: "resolved_by_section" };
5130
+ if (!coded) return null;
5131
+ this.context.state.ranked = coded.ranked;
5132
+ return { target: coded.target, gate: "resolved_in_code" };
5127
5133
  }
5128
5134
  async verifiedItem(selected) {
5129
5135
  const { options, verifyItems, itemVerifier } = this.context;
@@ -5441,6 +5447,7 @@ async function resolveTarget(page, resolver, options) {
5441
5447
  refresh
5442
5448
  }).resolve();
5443
5449
  if (result.kind !== "resolved" || !options.targetCheck) return result;
5450
+ if (selection.ranked) return result;
5444
5451
  const verdict2 = await checkResolvedTarget({
5445
5452
  page,
5446
5453
  target: result.target,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedum-dev/core",
3
- "version": "0.1.0-alpha.17",
3
+ "version": "0.1.0-alpha.18",
4
4
  "repository": "https://github.com/sedum-dev/sedum",
5
5
  "publishConfig": {
6
6
  "access": "public"