@runcofactor/cli 0.15.1 → 0.15.2

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.js CHANGED
@@ -827,7 +827,7 @@ async function executeCommand(command, rest) {
827
827
  return;
828
828
  }
829
829
  if (command === "workflow") {
830
- const { runWorkflow } = await import("./workflow-4J23FV7K.js");
830
+ const { runWorkflow } = await import("./workflow-ZGJU4QCV.js");
831
831
  await runWorkflow(rest);
832
832
  return;
833
833
  }
@@ -175,14 +175,20 @@ Every cached browser action's locator must pass offline verification against
175
175
  the trace-reconstructed DOM of the action's before-state:
176
176
 
177
177
  1. Materialize the substrate for the action (its before-snapshot).
178
- 2. Derive the locator from the substrate (the deterministic builder owns the
178
+ 2. Pick the target `ref` from THAT substrate, not from the trace action's
179
+ `params.selector`. Trace `aria-ref=e...` values are only hints: ref numbers
180
+ can change when the DOM is reconstructed, so copying the trace selector can
181
+ point at a different element. Read the substrate around the intended target
182
+ and choose the ref in the reconstructed tree.
183
+ 3. Derive the locator from the substrate (the deterministic builder owns the
179
184
  predicate ladder — do not hand-craft selectors when the builder succeeds).
180
- 3. Verify: the strategy must resolve to EXACTLY the recorded target element
185
+ 4. Verify: the strategy must resolve to EXACTLY the recorded target element
181
186
  (handle identity, count of one) and must not lean on volatile identifier
182
187
  tokens.
183
188
 
184
189
  On failure, in order:
185
- - Re-check the target ref — did you pick the right element in the substrate?
190
+ - Re-check the target ref — did you pick the right element in the substrate,
191
+ or accidentally reuse a trace `aria-ref` that now names something else?
186
192
  - Try the builder against a corrected ref or with the run's variable values
187
193
  (a row may only be distinguishable via a bound variable).
188
194
  - If the element is one of several identical widgets (responsive duplicates,
@@ -5625,6 +5625,16 @@ function buildCacheRecipe(opts) {
5625
5625
  agentMacroResolutions: opts.agentMacroResolutions,
5626
5626
  variableValues: opts.variableValues
5627
5627
  });
5628
+ const selectorlessElementActions = actionsJson.map((action, index) => ({ action, stepOrder: ordered[index]?.[0] })).filter(({ action }) => action.requiresAgent);
5629
+ if (selectorlessElementActions.length > 0) {
5630
+ throw new RecipeValidationError(
5631
+ "Recipe contains cached actions without verified selectors",
5632
+ selectorlessElementActions.map(({ action, stepOrder }) => {
5633
+ const orderLabel = stepOrder === void 0 ? "unknown step" : `step ${stepOrder}`;
5634
+ return `${orderLabel}: ${action.actionType} requires a verified selector; call build_locator or mark the step as a gap`;
5635
+ })
5636
+ );
5637
+ }
5628
5638
  const actionIndexByOrder = new Map(ordered.map(([order], i) => [order, i]));
5629
5639
  if (opts.requiredTokens?.length) {
5630
5640
  const present = collectTokens({ playbook: opts.playbookSteps, actions: actionsJson });
@@ -5956,4 +5966,4 @@ export {
5956
5966
  verifySelectorAgainstRef,
5957
5967
  waitForTraceDomHydration
5958
5968
  };
5959
- //# sourceMappingURL=src-2FK3JHGW.js.map
5969
+ //# sourceMappingURL=src-7LAXXTVG.js.map