autokap 1.3.19 → 1.3.21

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.
@@ -322,11 +322,29 @@ async function executeOpcode(opcode, index, adapter, verifier, breaker, recovery
322
322
  return softSkipResult(opcode, index, startTime, reason, telemetry);
323
323
  return handleFailure(opcode, index, adapter, verifier, isInteraction, breaker, recoveryChain, telemetry, healerPatches, options, executionState, variantId, currentVariant, startTime, deadlineMs, effectiveTimeoutMs, reason);
324
324
  }
325
- // Verify action had effect (for interaction opcodes)
325
+ // Verify action had effect (for interaction opcodes). The verifier
326
+ // catches silent failures: e.g. CLICK on a stale selector that found
327
+ // nothing and the page-state-passing postcondition is coincidentally
328
+ // satisfied by an unrelated state. For most interactions, no DOM
329
+ // change after the action means the action didn't really happen.
330
+ //
331
+ // PRESS_KEY is the exception. Keys are CONDITIONAL by nature: Escape
332
+ // is a no-op when no modal is open; Enter is a no-op when no form is
333
+ // focused; Tab is a no-op when no focusable target exists. A preset
334
+ // may legitimately script PRESS_KEY against a page that has already
335
+ // reached the target state via earlier opcodes (e.g. SLEEP let an
336
+ // auto-close timer run). The postcondition has already passed by this
337
+ // point — trust it for PRESS_KEY and skip the no-effect penalty.
326
338
  if (isInteraction) {
327
339
  const verification = await verifier.verifyAfterAction(adapter);
328
340
  if (!verification.hadEffect && opcode.postcondition.type !== 'always' && opcode.postcondition.type !== 'any_change') {
329
- return handleFailure(opcode, index, adapter, verifier, isInteraction, breaker, recoveryChain, telemetry, healerPatches, options, executionState, variantId, currentVariant, startTime, deadlineMs, effectiveTimeoutMs, `action had no effect: ${verification.summary}`);
341
+ if (opcode.kind === 'PRESS_KEY') {
342
+ logger.debug(`[opcode ${index}] PRESS_KEY had no DOM effect (${verification.summary}) — ` +
343
+ `postcondition passed, treating as redundant-but-successful`);
344
+ }
345
+ else {
346
+ return handleFailure(opcode, index, adapter, verifier, isInteraction, breaker, recoveryChain, telemetry, healerPatches, options, executionState, variantId, currentVariant, startTime, deadlineMs, effectiveTimeoutMs, `action had no effect: ${verification.summary}`);
347
+ }
330
348
  }
331
349
  }
332
350
  // Record successful mock data application
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autokap",
3
- "version": "1.3.19",
3
+ "version": "1.3.21",
4
4
  "description": "AI-powered CLI tool for capturing clean screenshots of websites",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",