@nuanu-ai/agentbrowse 0.2.21 → 0.2.23
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/README.md +52 -9
- package/dist/commands/act.d.ts.map +1 -1
- package/dist/commands/act.js +100 -73
- package/dist/commands/action-acceptance.d.ts +4 -1
- package/dist/commands/action-acceptance.d.ts.map +1 -1
- package/dist/commands/action-acceptance.js +127 -37
- package/dist/commands/action-executor-helpers.d.ts.map +1 -1
- package/dist/commands/action-executor-helpers.js +12 -4
- package/dist/commands/action-fallbacks.d.ts.map +1 -1
- package/dist/commands/action-result-resolution.d.ts.map +1 -1
- package/dist/commands/action-result-resolution.js +1 -1
- package/dist/commands/action-value-projection.d.ts.map +1 -1
- package/dist/commands/close.d.ts +12 -1
- package/dist/commands/close.d.ts.map +1 -1
- package/dist/commands/close.js +19 -21
- package/dist/commands/datepicker-action-executor.d.ts.map +1 -1
- package/dist/commands/datepicker-action-executor.js +1 -1
- package/dist/commands/descriptor-validation.d.ts.map +1 -1
- package/dist/commands/descriptor-validation.js +13 -172
- package/dist/commands/extract-scoped-dialog-text.d.ts.map +1 -1
- package/dist/commands/extract-scoped-dialog-text.js +1 -4
- package/dist/commands/extract-snapshot-sanitizer.d.ts.map +1 -1
- package/dist/commands/extract-stagehand-executor.d.ts.map +1 -1
- package/dist/commands/extract.d.ts.map +1 -1
- package/dist/commands/extract.js +23 -4
- package/dist/commands/launch.d.ts +22 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +122 -59
- package/dist/commands/observe-accessibility.d.ts +22 -0
- package/dist/commands/observe-accessibility.d.ts.map +1 -0
- package/dist/commands/observe-accessibility.js +497 -0
- package/dist/commands/observe-display-label.d.ts +4 -0
- package/dist/commands/observe-display-label.d.ts.map +1 -0
- package/dist/commands/observe-display-label.js +26 -0
- package/dist/commands/observe-dom-label-contract.d.ts +2 -0
- package/dist/commands/observe-dom-label-contract.d.ts.map +1 -0
- package/dist/commands/observe-dom-label-contract.js +521 -0
- package/dist/commands/observe-fallback-semantics.d.ts +6 -0
- package/dist/commands/observe-fallback-semantics.d.ts.map +1 -0
- package/dist/commands/observe-fallback-semantics.js +86 -0
- package/dist/commands/observe-inventory.d.ts +23 -18
- package/dist/commands/observe-inventory.d.ts.map +1 -1
- package/dist/commands/observe-inventory.js +172 -719
- package/dist/commands/observe-label-policy.d.ts +8 -0
- package/dist/commands/observe-label-policy.d.ts.map +1 -0
- package/dist/commands/observe-label-policy.js +21 -0
- package/dist/commands/observe-page-state.d.ts +1 -1
- package/dist/commands/observe-page-state.d.ts.map +1 -1
- package/dist/commands/observe-persistence.d.ts.map +1 -1
- package/dist/commands/observe-persistence.js +10 -3
- package/dist/commands/observe-projection.d.ts +2 -1
- package/dist/commands/observe-projection.d.ts.map +1 -1
- package/dist/commands/observe-projection.js +5 -2
- package/dist/commands/observe-semantics.d.ts.map +1 -1
- package/dist/commands/observe-semantics.js +18 -1
- package/dist/commands/observe-signals.d.ts +48 -0
- package/dist/commands/observe-signals.d.ts.map +1 -0
- package/dist/commands/observe-signals.js +461 -0
- package/dist/commands/observe-stagehand.d.ts.map +1 -1
- package/dist/commands/observe-stagehand.js +5 -18
- package/dist/commands/observe-surfaces.d.ts.map +1 -1
- package/dist/commands/observe-surfaces.js +5 -4
- package/dist/commands/observe.d.ts +0 -6
- package/dist/commands/observe.d.ts.map +1 -1
- package/dist/commands/observe.js +30 -6
- package/dist/commands/observe.test-harness.d.ts +0 -6
- package/dist/commands/observe.test-harness.d.ts.map +1 -1
- package/dist/commands/screenshot.d.ts.map +1 -1
- package/dist/commands/select-action-executor.d.ts.map +1 -1
- package/dist/commands/select-action-executor.js +1 -1
- package/dist/commands/semantic-observe.d.ts.map +1 -1
- package/dist/commands/semantic-observe.js +1 -4
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/text-input-action-executor.d.ts.map +1 -1
- package/dist/commands/text-input-action-executor.js +1 -1
- package/dist/control-semantics.d.ts.map +1 -1
- package/dist/control-semantics.js +2 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -9
- package/dist/owned-process.d.ts +4 -0
- package/dist/owned-process.d.ts.map +1 -0
- package/dist/owned-process.js +57 -0
- package/dist/playwright-runtime.d.ts.map +1 -1
- package/dist/playwright-runtime.js +3 -4
- package/dist/runtime-state.d.ts +3 -0
- package/dist/runtime-state.d.ts.map +1 -1
- package/dist/runtime-state.js +3 -0
- package/dist/secrets/catalog-applicability.d.ts.map +1 -1
- package/dist/secrets/form-matcher.d.ts.map +1 -1
- package/dist/secrets/form-matcher.js +2 -1
- package/dist/secrets/mock-agentpay-backend.d.ts +1 -1
- package/dist/secrets/mock-agentpay-backend.d.ts.map +1 -1
- package/dist/secrets/mock-agentpay-backend.js +2 -4
- package/dist/secrets/mock-agentpay-cabinet.d.ts.map +1 -1
- package/dist/secrets/mock-agentpay-cabinet.js +6 -1
- package/dist/secrets/protected-field-values.d.ts.map +1 -1
- package/dist/secrets/protected-field-values.js +1 -1
- package/dist/secrets/protected-fill.d.ts.map +1 -1
- package/dist/secrets/protected-fill.js +16 -4
- package/dist/session.d.ts +13 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +52 -7
- package/dist/solver/captcha-detector.d.ts.map +1 -1
- package/dist/solver/types.d.ts +2 -0
- package/dist/solver/types.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@ Browser automation CLI for AI agents.
|
|
|
5
5
|
`agentbrowse` controls a CDP-reachable browser for external agents that need
|
|
6
6
|
explicit browser primitives. It navigates pages, observes UI surfaces and
|
|
7
7
|
target refs, performs actions, extracts structured data, captures screenshots,
|
|
8
|
-
and
|
|
8
|
+
supports protected stored-secret fill flows, and can solve captchas when the
|
|
9
|
+
active session supports them.
|
|
9
10
|
|
|
10
11
|
This package publishes the public `agentbrowse` CLI.
|
|
11
12
|
|
|
@@ -32,12 +33,30 @@ agentbrowse launch https://example.com
|
|
|
32
33
|
|
|
33
34
|
## Commands
|
|
34
35
|
|
|
36
|
+
Configure AgentPay gateway access:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
agentbrowse init ap_...
|
|
40
|
+
agentbrowse init ap_... --api-url https://your-project.supabase.co/functions/v1/api
|
|
41
|
+
```
|
|
42
|
+
|
|
35
43
|
Launch browser and optionally navigate:
|
|
36
44
|
|
|
37
45
|
```bash
|
|
38
46
|
agentbrowse launch https://example.com
|
|
47
|
+
agentbrowse launch https://example.com --headless
|
|
39
48
|
```
|
|
40
49
|
|
|
50
|
+
By default, `launch` runs in headful mode. Use `--headless` only when you
|
|
51
|
+
intentionally want a hidden browser:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
agentbrowse launch https://example.com --headless
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
If you want to state the default mode explicitly in scripts, use
|
|
58
|
+
`--headful`.
|
|
59
|
+
|
|
41
60
|
Navigate current session:
|
|
42
61
|
|
|
43
62
|
```bash
|
|
@@ -48,6 +67,7 @@ Observe available actions/elements:
|
|
|
48
67
|
|
|
49
68
|
```bash
|
|
50
69
|
agentbrowse observe
|
|
70
|
+
agentbrowse observe "open checkout and find the pay button"
|
|
51
71
|
```
|
|
52
72
|
|
|
53
73
|
Act on a previously observed target:
|
|
@@ -68,10 +88,11 @@ agentbrowse extract '{"shipping":"string"}' t21
|
|
|
68
88
|
`extract` is for bounded structured page data; do not use it to enumerate
|
|
69
89
|
buttons, links, inputs, or refs when `observe` already provides that inventory.
|
|
70
90
|
|
|
71
|
-
|
|
91
|
+
Capture a screenshot:
|
|
72
92
|
|
|
73
93
|
```bash
|
|
74
|
-
agentbrowse
|
|
94
|
+
agentbrowse screenshot
|
|
95
|
+
agentbrowse screenshot --path ./checkout.png
|
|
75
96
|
```
|
|
76
97
|
|
|
77
98
|
Inspect or close the current session:
|
|
@@ -81,11 +102,25 @@ agentbrowse status
|
|
|
81
102
|
agentbrowse close
|
|
82
103
|
```
|
|
83
104
|
|
|
84
|
-
|
|
105
|
+
Refresh stored-secret metadata for the current page or a specific URL:
|
|
85
106
|
|
|
86
107
|
```bash
|
|
87
|
-
agentbrowse
|
|
88
|
-
agentbrowse
|
|
108
|
+
agentbrowse get-secrets-catalog
|
|
109
|
+
agentbrowse get-secrets-catalog https://example.com/checkout
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Create and complete a protected stored-secret fill:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
agentbrowse create-intent f12 ss_card_visa
|
|
116
|
+
agentbrowse poll-intent intent_123
|
|
117
|
+
agentbrowse fill-secret f12 intent_123
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Solve captcha when the active session supports it:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
agentbrowse solve-captcha --timeout 90
|
|
89
124
|
```
|
|
90
125
|
|
|
91
126
|
## Configure
|
|
@@ -103,18 +138,26 @@ overrides.
|
|
|
103
138
|
## Runtime model
|
|
104
139
|
|
|
105
140
|
- `agentbrowse` persists the active browser session under `~/.agentpay`
|
|
141
|
+
- `agentbrowse init` persists AgentPay gateway configuration for future runs
|
|
106
142
|
- mock stored secrets for live/manual runs come from one canonical file:
|
|
107
143
|
`~/.agentpay/mock-stored-secrets.json`
|
|
108
|
-
- repo JSON fixtures under `src/secrets/` are fallback seeds and test inputs,
|
|
144
|
+
- repo JSON fixtures under `src/secrets/` are fallback seeds and test inputs,
|
|
145
|
+
not an additional runtime config source
|
|
109
146
|
- all commands require AgentPay gateway configuration; prefer `agentbrowse init`
|
|
110
147
|
and use env vars only as runtime overrides
|
|
111
148
|
- the external AI agent remains the orchestration owner
|
|
112
149
|
- `agentbrowse` is a single-step browser toolset, not an internal reactive form loop
|
|
113
150
|
- runtime may enrich `observe` output with semantic hints and validation evidence, but it should not silently auto-submit, auto-retry, or maintain hidden durable field-state machines on behalf of the agent
|
|
151
|
+
- protected fills use an explicit intent flow:
|
|
152
|
+
- `get-secrets-catalog(url?)`
|
|
153
|
+
- `create-intent(fillRef, storedSecretRef)`
|
|
154
|
+
- `poll-intent(intentId)`
|
|
155
|
+
- `fill-secret(fillRef, intentId)`
|
|
114
156
|
- main workflow is:
|
|
115
157
|
- `observe(goal?)`
|
|
116
158
|
- `act(targetRef, action, value?)`
|
|
117
159
|
- `extract(schema, scopeRef?)`
|
|
160
|
+
- screenshots are explicit via `screenshot [--path <file>]`
|
|
118
161
|
- `solve-captcha` requires both:
|
|
119
162
|
- a session with captcha-solving capability
|
|
120
163
|
- AgentPay gateway configuration
|
|
@@ -137,7 +180,7 @@ Default verification for this package is no longer unit-only:
|
|
|
137
180
|
|
|
138
181
|
See package docs:
|
|
139
182
|
|
|
140
|
-
- [
|
|
141
|
-
- [
|
|
183
|
+
- [Package docs index](https://github.com/nuanu-ai/mercuryo-agent-pay/tree/main/packages/browse-cli/docs)
|
|
184
|
+
- [CLI usage guide](https://github.com/nuanu-ai/mercuryo-agent-pay/blob/main/packages/browse-cli/docs/testing/cli-usage-guide.md)
|
|
142
185
|
|
|
143
186
|
Releases are published automatically from `main` after checks pass. `@nuanu-ai/agentbrowse` is the only CLI package published by the current npm release workflow.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/commands/act.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"act.d.ts","sourceRoot":"","sources":["../../src/commands/act.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAqCnD,OAAO,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAyHxF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,CAAC;AA4V7B,wBAAsB,GAAG,CACvB,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAmsBf"}
|
package/dist/commands/act.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { saveSession } from '../session.js';
|
|
5
5
|
import { clearProtectedExposure, getProtectedExposure, getSurface, getTarget, incrementMetric, locatorCandidateKey, markTargetLifecycle, recordActionResult, registerPage, setTargetAvailability, setCurrentPage, updateTarget, } from '../runtime-state.js';
|
|
6
6
|
import { outputContractFailure, outputFailure, outputJSON } from '../output.js';
|
|
7
|
-
import { capturePageObservation, captureLocatorContextHash, captureLocatorState, createAcceptanceProbe, diagnoseNoObservableProgress, locatorStateChanged, pageObservationChanged, rankLocatorCandidates, shouldVerifyObservableProgress, waitForAcceptanceProbe, } from './action-acceptance.js';
|
|
7
|
+
import { capturePageObservation, captureLocatorContextHash, captureLocatorState, createAcceptanceProbe, diagnoseNoObservableProgress, genericClickObservationChanged, locatorStateChanged, pageObservationChanged, rankLocatorCandidates, shouldVerifyObservableProgress, waitForAcceptanceProbe, } from './action-acceptance.js';
|
|
8
8
|
import { captureActionFailureArtifacts, startActionTrace } from './action-artifacts.js';
|
|
9
9
|
import { buildLocator, resolveLocatorRoot } from './action-fallbacks.js';
|
|
10
10
|
import { resolveSubmitResult } from './action-result-resolution.js';
|
|
@@ -141,6 +141,11 @@ function shouldWatchForNewPageAfterAction(target, action) {
|
|
|
141
141
|
}
|
|
142
142
|
return !isEditableLikeTarget(target);
|
|
143
143
|
}
|
|
144
|
+
function shouldDeferSurfaceResolutionForEditablePress(target, action) {
|
|
145
|
+
return (action === 'press' &&
|
|
146
|
+
isEditableLikeTarget(target) &&
|
|
147
|
+
!target.locatorCandidates.some((candidate) => candidate.scope === 'surface'));
|
|
148
|
+
}
|
|
144
149
|
function targetUsesSurfaceAsPrimaryLocator(target, surface) {
|
|
145
150
|
const surfaceCandidates = new Set(surface.locatorCandidates.map(locatorCandidateKey));
|
|
146
151
|
return target.locatorCandidates.some((candidate) => surfaceCandidates.has(locatorCandidateKey(candidate)));
|
|
@@ -486,7 +491,8 @@ export async function act(session, targetRef, action, value) {
|
|
|
486
491
|
return true;
|
|
487
492
|
};
|
|
488
493
|
const assertResolvedTargetStillValid = async (resolvedLocator, stage) => {
|
|
489
|
-
if (liveTarget.pageSignature &&
|
|
494
|
+
if (liveTarget.pageSignature &&
|
|
495
|
+
normalizePageSignature(page.url()) !== liveTarget.pageSignature) {
|
|
490
496
|
attempts.push(`stale.page-signature:${stage}`);
|
|
491
497
|
staleReason = 'page-signature-mismatch';
|
|
492
498
|
throw new Error('stale_target_page_signature_changed');
|
|
@@ -513,7 +519,13 @@ export async function act(session, targetRef, action, value) {
|
|
|
513
519
|
const beforePages = listPages(browser);
|
|
514
520
|
const shouldCheckProgress = shouldVerifyObservableProgress(target, action);
|
|
515
521
|
const beforePageObservation = shouldCheckProgress ? await capturePageObservation(page) : null;
|
|
516
|
-
const
|
|
522
|
+
const deferSurfaceResolution = shouldDeferSurfaceResolutionForEditablePress(target, action);
|
|
523
|
+
let baseRoot = resolveLocatorRoot(page, target.framePath ?? surface?.framePath);
|
|
524
|
+
let locatorRoot = baseRoot;
|
|
525
|
+
let surfaceRoot = null;
|
|
526
|
+
if (!deferSurfaceResolution) {
|
|
527
|
+
({ baseRoot, locatorRoot, surfaceRoot } = await resolveActionRoot(page, target, attempts, surface));
|
|
528
|
+
}
|
|
517
529
|
let lastError = null;
|
|
518
530
|
let sawDomSignatureMismatch = false;
|
|
519
531
|
let sawDisabledTarget = false;
|
|
@@ -632,35 +644,46 @@ export async function act(session, targetRef, action, value) {
|
|
|
632
644
|
const popupPromise = watchForNewPage
|
|
633
645
|
? waitForPopup(page.context())
|
|
634
646
|
: Promise.resolve(null);
|
|
635
|
-
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
target.controlFamily === '
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
647
|
+
const tryRankedCandidates = async () => {
|
|
648
|
+
for (const candidate of rankLocatorCandidates(target.locatorCandidates, action)) {
|
|
649
|
+
const candidateRoot = resolveLocatorRootForCandidate(baseRoot, locatorRoot, surfaceRoot, candidate);
|
|
650
|
+
if (!candidateRoot) {
|
|
651
|
+
attempts.push(`resolve.skip:${candidate.strategy}:surface-unavailable`);
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
const locator = buildLocator(candidateRoot, candidate);
|
|
655
|
+
if (!locator)
|
|
656
|
+
continue;
|
|
657
|
+
const preparedLocator = await prepareLocatorForAction(locator, action, candidate.strategy, attempts, {
|
|
658
|
+
allowReadonlyFallback: action === 'fill' && target.controlFamily === 'datepicker',
|
|
659
|
+
allowDescendantPressFallback: action === 'press' &&
|
|
660
|
+
(target.controlFamily === 'text-input' ||
|
|
661
|
+
target.controlFamily === 'select' ||
|
|
662
|
+
target.controlFamily === 'datepicker'),
|
|
663
|
+
});
|
|
664
|
+
if (preparedLocator.blockedReason === 'disabled') {
|
|
665
|
+
sawDisabledTarget = true;
|
|
666
|
+
}
|
|
667
|
+
if (preparedLocator.blockedReason === 'readonly') {
|
|
668
|
+
sawReadonlyTarget = true;
|
|
669
|
+
}
|
|
670
|
+
const resolvedLocator = preparedLocator.locator;
|
|
671
|
+
if (!resolvedLocator) {
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
const resolved = await attemptResolvedLocator(resolvedLocator, candidate.strategy);
|
|
675
|
+
if (resolved) {
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
660
678
|
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
679
|
+
};
|
|
680
|
+
await tryRankedCandidates();
|
|
681
|
+
if (!resolvedBy && !lastError && deferSurfaceResolution && surface) {
|
|
682
|
+
const deferredSurfaceRoot = await resolveSurfaceScopeRoot(page, surface, attempts);
|
|
683
|
+
if (deferredSurfaceRoot) {
|
|
684
|
+
surfaceRoot = deferredSurfaceRoot;
|
|
685
|
+
locatorRoot = targetUsesSurfaceAsPrimaryLocator(target, surface) ? baseRoot : surfaceRoot;
|
|
686
|
+
await tryRankedCandidates();
|
|
664
687
|
}
|
|
665
688
|
}
|
|
666
689
|
if (!resolvedBy && !lastError && surfaceRoot) {
|
|
@@ -735,53 +758,57 @@ export async function act(session, targetRef, action, value) {
|
|
|
735
758
|
if (acceptance.polls > 1) {
|
|
736
759
|
attempts.push(`acceptance.polled:${acceptance.polls}`);
|
|
737
760
|
}
|
|
738
|
-
if (!accepted
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
else if (!accepted &&
|
|
743
|
-
(finalProgressProbe.policy === 'selection' ||
|
|
744
|
-
finalProgressProbe.policy === 'date-selection') &&
|
|
745
|
-
finalProgressProbe.expectedValue !== null) {
|
|
746
|
-
attempts.push(`acceptance.failed:${finalProgressProbe.policy}`);
|
|
747
|
-
throw new Error(`action_postcondition_failed:${finalProgressProbe.policy}`);
|
|
748
|
-
}
|
|
749
|
-
else if (!accepted && finalProgressProbe.policy === 'submit') {
|
|
750
|
-
const submitResolution = await resolveSubmitResult(finalProgressProbe, afterPageObservation);
|
|
751
|
-
if (submitResolution.acceptAsProgress) {
|
|
752
|
-
attempts.push(`submit-resolution:${submitResolution.finalVerdict}`);
|
|
753
|
-
if (submitResolution.claims.some((claim) => claim.kind === 'soft_result_candidate')) {
|
|
754
|
-
attempts.push('submit-resolution:soft-result-candidate');
|
|
755
|
-
}
|
|
761
|
+
if (!accepted) {
|
|
762
|
+
if (finalProgressProbe.policy === 'value-change') {
|
|
763
|
+
attempts.push(`acceptance.failed:${finalProgressProbe.policy}`);
|
|
764
|
+
throw new Error('action_postcondition_failed:value-change');
|
|
756
765
|
}
|
|
757
|
-
|
|
766
|
+
if ((finalProgressProbe.policy === 'selection' ||
|
|
767
|
+
finalProgressProbe.policy === 'date-selection') &&
|
|
768
|
+
finalProgressProbe.expectedValue !== null) {
|
|
758
769
|
attempts.push(`acceptance.failed:${finalProgressProbe.policy}`);
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
770
|
+
throw new Error(`action_postcondition_failed:${finalProgressProbe.policy}`);
|
|
771
|
+
}
|
|
772
|
+
if (finalProgressProbe.policy === 'submit') {
|
|
773
|
+
const submitResolution = await resolveSubmitResult(finalProgressProbe, afterPageObservation);
|
|
774
|
+
if (submitResolution.acceptAsProgress) {
|
|
775
|
+
attempts.push(`submit-resolution:${submitResolution.finalVerdict}`);
|
|
776
|
+
if (submitResolution.claims.some((claim) => claim.kind === 'soft_result_candidate')) {
|
|
777
|
+
attempts.push('submit-resolution:soft-result-candidate');
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
attempts.push(`acceptance.failed:${finalProgressProbe.policy}`);
|
|
782
|
+
attempts.push('no-progress.detected');
|
|
783
|
+
noProgressDiagnosis = await diagnoseNoObservableProgress(page, finalProgressProbe.locator);
|
|
784
|
+
if (noProgressDiagnosis) {
|
|
785
|
+
attempts.push(`no-progress.diagnosis:${noProgressDiagnosis.kind}`);
|
|
786
|
+
}
|
|
787
|
+
throw new Error('no_observable_progress');
|
|
763
788
|
}
|
|
764
|
-
throw new Error('no_observable_progress');
|
|
765
789
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
790
|
+
else {
|
|
791
|
+
const afterLocatorObservation = finalProgressProbe.trackedStateKeys.length > 0
|
|
792
|
+
? await captureLocatorState(finalProgressProbe.locator, finalProgressProbe.trackedStateKeys)
|
|
793
|
+
: null;
|
|
794
|
+
const afterContextHash = await captureLocatorContextHash(finalProgressProbe.locator);
|
|
795
|
+
const hasComparableSignal = finalProgressProbe.trackedStateKeys.length > 0 ||
|
|
796
|
+
Boolean(finalProgressProbe.beforeContextHash || afterContextHash) ||
|
|
797
|
+
Boolean(finalProgressProbe.beforePage || afterPageObservation);
|
|
798
|
+
const pageProgressChanged = finalProgressProbe.policy === 'generic-click'
|
|
799
|
+
? genericClickObservationChanged(finalProgressProbe.beforePage, afterPageObservation)
|
|
800
|
+
: pageObservationChanged(finalProgressProbe.beforePage, afterPageObservation);
|
|
801
|
+
if (hasComparableSignal &&
|
|
802
|
+
!pageProgressChanged &&
|
|
803
|
+
finalProgressProbe.beforeContextHash === afterContextHash &&
|
|
804
|
+
!locatorStateChanged(finalProgressProbe.beforeLocator, afterLocatorObservation)) {
|
|
805
|
+
attempts.push('no-progress.detected');
|
|
806
|
+
noProgressDiagnosis = await diagnoseNoObservableProgress(page, finalProgressProbe.locator);
|
|
807
|
+
if (noProgressDiagnosis) {
|
|
808
|
+
attempts.push(`no-progress.diagnosis:${noProgressDiagnosis.kind}`);
|
|
809
|
+
}
|
|
810
|
+
throw new Error('no_observable_progress');
|
|
783
811
|
}
|
|
784
|
-
throw new Error('no_observable_progress');
|
|
785
812
|
}
|
|
786
813
|
}
|
|
787
814
|
}
|
|
@@ -63,7 +63,9 @@ export declare function capturePageObservation(page: Page): Promise<PageObservat
|
|
|
63
63
|
export declare function captureLocatorContextHash(locator: Locator): Promise<string | null>;
|
|
64
64
|
declare function comparableValueTypeForTarget(target: TargetDescriptor): ComparableValueType | undefined;
|
|
65
65
|
declare function normalizeComparableValue(value: string | null, comparableValueType?: ComparableValueType): string;
|
|
66
|
-
declare function valuesMatchExpected(expected: string | null, actual: string | null, comparableValueType?: ComparableValueType
|
|
66
|
+
declare function valuesMatchExpected(expected: string | null, actual: string | null, comparableValueType?: ComparableValueType, options?: {
|
|
67
|
+
allowCompactActualSequence?: boolean;
|
|
68
|
+
}): boolean;
|
|
67
69
|
export declare const __testComparableValues: {
|
|
68
70
|
comparableValueTypeForTarget: typeof comparableValueTypeForTarget;
|
|
69
71
|
normalizeComparableValue: typeof normalizeComparableValue;
|
|
@@ -72,6 +74,7 @@ export declare const __testComparableValues: {
|
|
|
72
74
|
export declare function captureLocatorState(locator: Locator, keys: ReadonlyArray<TargetStateKey>): Promise<LocatorStateObservation | null>;
|
|
73
75
|
export declare function locatorStateChanged(before: LocatorStateObservation | null, after: LocatorStateObservation | null): boolean;
|
|
74
76
|
export declare function pageObservationChanged(before: PageObservation | null, after: PageObservation | null): boolean;
|
|
77
|
+
export declare function genericClickObservationChanged(before: PageObservation | null, after: PageObservation | null): boolean;
|
|
75
78
|
export declare function submitObservationChanged(before: PageObservation | null, after: PageObservation | null): boolean;
|
|
76
79
|
export declare function diagnoseNoObservableProgress(page: Page, locator: Locator): Promise<NoObservableProgressDiagnosis | null>;
|
|
77
80
|
export declare function createAcceptanceProbe(args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-acceptance.d.ts","sourceRoot":"","sources":["../../src/commands/action-acceptance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAc,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"action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