@pcamarajr/scout 0.13.0 → 0.15.0
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 +2 -1
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +23 -1
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -1
- package/dist/device.d.ts +56 -0
- package/dist/device.js +181 -0
- package/dist/device.js.map +1 -0
- package/dist/engine.d.ts +6 -0
- package/dist/engine.js +48 -14
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +8 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/report.js +15 -1
- package/dist/report.js.map +1 -1
- package/dist/runner/agent-tools.js +75 -1
- package/dist/runner/agent-tools.js.map +1 -1
- package/dist/runner/ai-runner.js +28 -1
- package/dist/runner/ai-runner.js.map +1 -1
- package/dist/runner/browser.d.ts +123 -5
- package/dist/runner/browser.js +419 -39
- package/dist/runner/browser.js.map +1 -1
- package/dist/runner/script-runner.d.ts +5 -0
- package/dist/runner/script-runner.js +18 -2
- package/dist/runner/script-runner.js.map +1 -1
- package/dist/runner/selector-ladder.d.ts +90 -0
- package/dist/runner/selector-ladder.js +144 -0
- package/dist/runner/selector-ladder.js.map +1 -0
- package/dist/specs.js +9 -0
- package/dist/specs.js.map +1 -1
- package/dist/store.js +13 -8
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +137 -4
- package/package.json +1 -1
- package/templates/AGENTS.md +68 -2
- package/templates/SKILL.md +1 -1
- package/templates/scout.mdc +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-runner.js","sourceRoot":"","sources":["../../src/runner/ai-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAoB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-runner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EAAsE;IACtE,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACpF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,UAAU,CAAC,IAAI,CACb,0CAA0C,SAAS,6DAA6D,CACjH,CAAC;QACF,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAC7B,iSAAiS,EACjS,CAAC,CACF,CAAC;YACF,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;YACtC,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC;QACvB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,UAAU,CAAC,IAAI,CAAC,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC9G,CAAC;IACH,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,SAAS,IAAI,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvE,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,qCAAqC,KAAK,6DAA6D;YAC/G,KAAK;YACL,UAAU;YACV,aAAa,EAAE,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/runner/browser.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type BrowserContext, type Page } from "playwright";
|
|
2
|
-
import type { NetworkMatcher, PermissionPolicy, ScenarioCookie, ScenarioStorage, Step, Target } from "../types.js";
|
|
2
|
+
import type { ElementStateMatcher, NetworkMatcher, PermissionPolicy, ScenarioCookie, ScenarioDevice, ScenarioStorage, Step, Target } from "../types.js";
|
|
3
3
|
import type { ResolvedViewport } from "../viewports.js";
|
|
4
|
+
import { type LadderInfo } from "./selector-ladder.js";
|
|
5
|
+
/** Default testid attribute, when `scout.config.json` sets none. */
|
|
6
|
+
export declare const DEFAULT_TESTID_ATTR = "data-testid";
|
|
4
7
|
export interface ElementInfo {
|
|
5
8
|
ref: number;
|
|
6
9
|
role: string;
|
|
@@ -9,6 +12,14 @@ export interface ElementInfo {
|
|
|
9
12
|
tag: string;
|
|
10
13
|
value?: string;
|
|
11
14
|
href?: string;
|
|
15
|
+
/** The element's own testid attribute value (for the selector ladder). */
|
|
16
|
+
testId?: string;
|
|
17
|
+
/** Nearest ancestor's testid within a few hops (borrowed by clicks only). */
|
|
18
|
+
ancestorTestId?: string;
|
|
19
|
+
/** The element's raw `id` attribute (validated before use by the ladder). */
|
|
20
|
+
id?: string;
|
|
21
|
+
/** Trimmed visible text, when short/stable enough to anchor a text selector. */
|
|
22
|
+
text?: string;
|
|
12
23
|
}
|
|
13
24
|
export interface PageSnapshot {
|
|
14
25
|
url: string;
|
|
@@ -52,12 +63,25 @@ export interface LaunchOptions {
|
|
|
52
63
|
* Values may carry a `$ENV:VAR` placeholder, resolved here at launch.
|
|
53
64
|
*/
|
|
54
65
|
storage?: ScenarioStorage;
|
|
66
|
+
/**
|
|
67
|
+
* Device / user-agent emulation (profile + scenario, already merged). Resolved
|
|
68
|
+
* to Playwright context options and composed OVER the viewport at launch — the
|
|
69
|
+
* device's fields (viewport size, UA, deviceScaleFactor, isMobile, hasTouch)
|
|
70
|
+
* win over the viewport's when set. Its point is UA/device-gated UI.
|
|
71
|
+
*/
|
|
72
|
+
device?: ScenarioDevice;
|
|
55
73
|
/**
|
|
56
74
|
* Extra HTTP headers sent on every request in the context. Set from
|
|
57
75
|
* `scout.config.json` `headers` or `SCOUT_EXTRA_HEADERS`. The canonical use is
|
|
58
76
|
* reaching a protected deploy — e.g. Vercel's `x-vercel-protection-bypass`.
|
|
59
77
|
*/
|
|
60
78
|
extraHeaders?: Record<string, string>;
|
|
79
|
+
/**
|
|
80
|
+
* Attribute the selector ladder treats as the testid (top rung). Defaults to
|
|
81
|
+
* `data-testid`; override via `scout.config.json` `testIdAttribute`. Also set
|
|
82
|
+
* as Playwright's global testid attribute so `getByTestId` matches it.
|
|
83
|
+
*/
|
|
84
|
+
testIdAttribute?: string;
|
|
61
85
|
}
|
|
62
86
|
/**
|
|
63
87
|
* Builds an init-script that denies the permissions that would otherwise pop a
|
|
@@ -80,12 +104,19 @@ export declare function denyPermissionsStub(deny: string[]): string;
|
|
|
80
104
|
* the overlay cannot perturb the flow it is filming.
|
|
81
105
|
*/
|
|
82
106
|
export declare function demoCursorStub(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Closes every pooled Browser process and clears the pool. Call this before a
|
|
109
|
+
* process that ran scenarios exits (the CLI `go` command, a library consumer
|
|
110
|
+
* looping runScenario) — otherwise the live browser keeps the Node event loop
|
|
111
|
+
* alive and the process never exits. Errors are tolerated: a browser that is
|
|
112
|
+
* already gone is not a failure to close.
|
|
113
|
+
*/
|
|
114
|
+
export declare function closeBrowsers(): Promise<void>;
|
|
83
115
|
/**
|
|
84
116
|
* Thin Playwright wrapper shared by the AI runner and the replay runner.
|
|
85
117
|
* Owns ref→element resolution, tracing and screenshots.
|
|
86
118
|
*/
|
|
87
119
|
export declare class BrowserSession {
|
|
88
|
-
private browser;
|
|
89
120
|
private context;
|
|
90
121
|
private opts;
|
|
91
122
|
/** Date.now() at video start (context creation); undefined when not recording */
|
|
@@ -104,6 +135,8 @@ export declare class BrowserSession {
|
|
|
104
135
|
private activePage;
|
|
105
136
|
/** The first page — it owns the recorded video for the whole context. */
|
|
106
137
|
private readonly firstPage;
|
|
138
|
+
/** Testid attribute the selector ladder reads and `getByTestId` matches. */
|
|
139
|
+
private readonly testIdAttr;
|
|
107
140
|
private constructor();
|
|
108
141
|
/** The tab currently under control. Switching tabs reassigns it. */
|
|
109
142
|
get page(): Page;
|
|
@@ -156,10 +189,52 @@ export declare class BrowserSession {
|
|
|
156
189
|
formatSnapshot(snap: PageSnapshot): string;
|
|
157
190
|
/**
|
|
158
191
|
* Resolves a snapshot ref to a locator AND the durable Target recorded for
|
|
159
|
-
* replay
|
|
192
|
+
* replay, walking the selector preference ladder (testid → id → role+name →
|
|
193
|
+
* text → positional CSS) against the live page and recording the most stable
|
|
194
|
+
* rung that uniquely matches — with the other unique rungs kept as ordered
|
|
195
|
+
* fallbacks. `action` gates the ancestor-testid rung: a click may borrow a
|
|
196
|
+
* close ancestor's testid, an input (fill/select) may not (it must act on the
|
|
197
|
+
* field itself, not a wrapping container).
|
|
160
198
|
*/
|
|
161
199
|
private resolveRef;
|
|
200
|
+
/**
|
|
201
|
+
* Walks the selector ladder against the live page: builds the ordered
|
|
202
|
+
* candidates, keeps those that match EXACTLY one element (so a recorded
|
|
203
|
+
* selector is never ambiguous), and assembles the primary + fallbacks + the
|
|
204
|
+
* fragile flag. Shared by ref-based interactions and selector-based clicks.
|
|
205
|
+
*/
|
|
206
|
+
resolveTarget(info: LadderInfo, opts?: {
|
|
207
|
+
allowAncestorTestId?: boolean;
|
|
208
|
+
}): Promise<Target>;
|
|
162
209
|
click(ref: number): Promise<Target>;
|
|
210
|
+
/**
|
|
211
|
+
* Clicks an element located directly by data-testid or CSS — no snapshot ref
|
|
212
|
+
* involved. This is the escape hatch for elements OUTSIDE the accessibility
|
|
213
|
+
* tree (a gesture layer, an overlay `<div>` with only a data-testid): they
|
|
214
|
+
* never get a numbered [ref], so ref-based click can't reach them. Returns the
|
|
215
|
+
* durable Target so the caller records a deterministic `click` step (the same
|
|
216
|
+
* kind as a ref click — one replay path, testId/css resolved by targetLocator).
|
|
217
|
+
*/
|
|
218
|
+
clickSelector(sel: {
|
|
219
|
+
testId?: string;
|
|
220
|
+
css?: string;
|
|
221
|
+
}): Promise<Target>;
|
|
222
|
+
/**
|
|
223
|
+
* Reads the selector-ladder signals from the FIRST element the given
|
|
224
|
+
* testid/css target resolves to, in-page. Returns undefined when the element
|
|
225
|
+
* isn't found (the click below then fails on the base target, as before).
|
|
226
|
+
*/
|
|
227
|
+
private ladderInfoFor;
|
|
228
|
+
/**
|
|
229
|
+
* Asserts an element's VISUAL/structural state (class token, attribute,
|
|
230
|
+
* computed style) — the check text/URL assertions can't express. Polls until
|
|
231
|
+
* every provided condition holds or `timeout` elapses, so it is deterministic
|
|
232
|
+
* on replay. The canonical use is the opacity toggle: a control kept in the DOM
|
|
233
|
+
* but hidden with `opacity:0` (which Playwright still reports as "visible", so
|
|
234
|
+
* assertNotVisible would false-pass) — assert `opacity-0`/computed opacity
|
|
235
|
+
* instead. The element must at least be attached; a missing element fails.
|
|
236
|
+
*/
|
|
237
|
+
assertState(target: Target, checks: ElementStateMatcher, timeout?: number): Promise<void>;
|
|
163
238
|
fill(ref: number, value: string): Promise<Target>;
|
|
164
239
|
select(ref: number, value: string): Promise<Target>;
|
|
165
240
|
press(key: string): Promise<void>;
|
|
@@ -214,9 +289,30 @@ export declare class BrowserSession {
|
|
|
214
289
|
/** Compact dump of recent network + console activity for the agent to inspect. */
|
|
215
290
|
formatLogs(): string;
|
|
216
291
|
screenshot(label: string): Promise<string>;
|
|
217
|
-
/**
|
|
218
|
-
|
|
292
|
+
/**
|
|
293
|
+
* Replays one recorded step (used by the deterministic runner). For the
|
|
294
|
+
* interaction steps (click/fill/select) the action is tried on the primary
|
|
295
|
+
* selector and, if it fails, on each recorded fallback in order — a purely
|
|
296
|
+
* deterministic retry (no LLM, `--no-heal` intact). `onFallback` is notified
|
|
297
|
+
* when a fallback resolved, so the runner can log which selector rescued it.
|
|
298
|
+
*/
|
|
299
|
+
executeStep(step: Step, onFallback?: (note: string) => void): Promise<void>;
|
|
300
|
+
/**
|
|
301
|
+
* Attempts an action on the target's primary selector, then on each recorded
|
|
302
|
+
* fallback in order until one succeeds. The primary's own auto-wait runs
|
|
303
|
+
* first (unchanged happy path); only on failure are fallbacks tried, each with
|
|
304
|
+
* their own auto-wait. If every candidate fails, the PRIMARY's error is thrown
|
|
305
|
+
* — the most relevant one to debug. No LLM, so `--no-heal` semantics hold.
|
|
306
|
+
*/
|
|
307
|
+
private actWithFallback;
|
|
308
|
+
/** The replay locator: the primary strategy, narrowed to the first match. */
|
|
219
309
|
private targetLocator;
|
|
310
|
+
/**
|
|
311
|
+
* The unnarrowed locator for a target's primary strategy — used for the record
|
|
312
|
+
* -time uniqueness check (its `count()` must reflect ALL matches, so no
|
|
313
|
+
* `.first()` here). testId → role+name → text → css, mirroring the ladder.
|
|
314
|
+
*/
|
|
315
|
+
private rawLocator;
|
|
220
316
|
/**
|
|
221
317
|
* Demo overlay: animates the synthetic cursor to a target-bearing step's
|
|
222
318
|
* bounding-box center and returns that center (for the timeline). Returns null
|
|
@@ -254,6 +350,28 @@ export declare function toPlaywrightCookie(c: ScenarioCookie, baseUrl: string):
|
|
|
254
350
|
* is seeded or removed. `$ENV:VAR` in values is resolved at build time (launch).
|
|
255
351
|
*/
|
|
256
352
|
export declare function buildStorageInitScript(storage: ScenarioStorage): string;
|
|
353
|
+
/**
|
|
354
|
+
* Builds a durable Target for an element located directly by data-testid or CSS
|
|
355
|
+
* (no snapshot ref). testId wins when both are given — it is the stabler handle
|
|
356
|
+
* for elements outside the a11y tree. Throws when neither is provided, so a
|
|
357
|
+
* selector click/assert can never silently target nothing.
|
|
358
|
+
*/
|
|
359
|
+
export declare function buildSelectorTarget(sel: {
|
|
360
|
+
testId?: string;
|
|
361
|
+
css?: string;
|
|
362
|
+
}): Target;
|
|
363
|
+
/** The element state observed by {@link BrowserSession.assertState}'s in-page probe. */
|
|
364
|
+
export interface ObservedElementState {
|
|
365
|
+
classes: string[];
|
|
366
|
+
attrs: Record<string, string>;
|
|
367
|
+
styleValue: string | null;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Compares an observed element state against a matcher, returning "" when every
|
|
371
|
+
* provided check holds or a human-readable reason for the FIRST failing one.
|
|
372
|
+
* Pure, so it is unit-testable without a browser and shared by the live poll.
|
|
373
|
+
*/
|
|
374
|
+
export declare function describeStateMismatch(target: Target, checks: ElementStateMatcher, observed: ObservedElementState): string;
|
|
257
375
|
/** Replaces $ENV:VAR_NAME placeholders so secrets never live in committed scripts. */
|
|
258
376
|
export declare function resolveEnvValue(value: string): string;
|
|
259
377
|
export {};
|