prowl-tools 0.1.3 → 0.1.4
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/LICENSE +1 -1
- package/NOTICE +1 -1
- package/README.md +115 -3
- package/dist/{chunk-NXXGJOBG.js → chunk-MBAIGNVO.js} +38 -13
- package/dist/chunk-MBAIGNVO.js.map +1 -0
- package/dist/{chunk-T7YLXF6X.js → chunk-ZEFVTKQT.js} +1773 -756
- package/dist/chunk-ZEFVTKQT.js.map +1 -0
- package/dist/index.cjs +2008 -973
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -30
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +1848 -807
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.d.cts +314 -17
- package/dist/lib.d.ts +314 -17
- package/dist/lib.js +28 -4
- package/dist/{loader-5RDNTJHH.js → loader-XMTDB6OL.js} +2 -2
- package/package.json +2 -2
- package/dist/chunk-NXXGJOBG.js.map +0 -1
- package/dist/chunk-T7YLXF6X.js.map +0 -1
- /package/dist/{loader-5RDNTJHH.js.map → loader-XMTDB6OL.js.map} +0 -0
package/dist/lib.d.cts
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
import { Page } from 'playwright';
|
|
2
1
|
import { z } from 'zod';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
declare const SUPPORTED_BROWSER_ENGINES: readonly ["chromium", "firefox", "webkit"];
|
|
4
|
+
type BrowserEngine = (typeof SUPPORTED_BROWSER_ENGINES)[number];
|
|
5
5
|
type BrowserChannel = "chromium" | "chrome" | "chrome-beta" | "chrome-canary" | "chrome-dev" | "msedge" | "msedge-beta" | "msedge-canary" | "msedge-dev";
|
|
6
6
|
type Viewport = {
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
9
9
|
};
|
|
10
|
+
/** Web execution target (default): drives a browser at `url`. */
|
|
11
|
+
type WebTarget = {
|
|
12
|
+
type: "web";
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* macOS native execution target (experimental, PROWL-048). `app` is a bundle
|
|
17
|
+
* identifier (e.g. `com.example.App`) or an absolute path to a `.app` bundle.
|
|
18
|
+
* App-path guardrails are matched against the path, bundle name, and
|
|
19
|
+
* `CFBundleIdentifier` from `Contents/Info.plist` when it is readable.
|
|
20
|
+
*/
|
|
21
|
+
type MacosTarget = {
|
|
22
|
+
type: "macos";
|
|
23
|
+
app: string;
|
|
24
|
+
};
|
|
25
|
+
type Target = WebTarget | MacosTarget;
|
|
10
26
|
type Config = {
|
|
11
|
-
target:
|
|
12
|
-
url: string;
|
|
13
|
-
};
|
|
27
|
+
target: Target;
|
|
14
28
|
browser: {
|
|
15
29
|
headless: boolean;
|
|
16
30
|
slowMo: number;
|
|
@@ -34,6 +48,8 @@ type Config = {
|
|
|
34
48
|
guardrails: {
|
|
35
49
|
maxSteps: number;
|
|
36
50
|
allowedDomains: string[];
|
|
51
|
+
/** Native scope analog of `allowedDomains`: allowed bundle IDs, app bundle names, or `.app` paths. */
|
|
52
|
+
allowedApps: string[];
|
|
37
53
|
forbiddenSelectors: string[];
|
|
38
54
|
selfHealing: boolean;
|
|
39
55
|
};
|
|
@@ -339,6 +355,241 @@ type CiResult = {
|
|
|
339
355
|
clusters?: CiFailureCluster[];
|
|
340
356
|
};
|
|
341
357
|
|
|
358
|
+
/**
|
|
359
|
+
* PROWL-047 / ARCH-001 — Session driver abstraction.
|
|
360
|
+
*
|
|
361
|
+
* `SessionDriver` is the narrow, engine-agnostic surface the step runner drives.
|
|
362
|
+
* Today the only implementation is the Playwright driver (`playwright-driver.ts`),
|
|
363
|
+
* but factoring the runner against this interface is the prerequisite for
|
|
364
|
+
* non-browser execution targets (macOS native, Electron, mobile — see PROWL-048).
|
|
365
|
+
*
|
|
366
|
+
* The interface intentionally covers only the verbs `src/runner/steps.ts`
|
|
367
|
+
* actually uses. Selector strings are the driver's own dialect: the driver
|
|
368
|
+
* supplies `parseTextSelector` so the guardrail policy can reason about them
|
|
369
|
+
* without knowing the engine.
|
|
370
|
+
*/
|
|
371
|
+
/** Coarse capability groups a step handler can require of a driver. */
|
|
372
|
+
type DriverCapability = "navigate" | "query" | "interact" | "wait" | "screenshot" | "evaluate" | "response" | "route" | "dialog" | "files" | "download";
|
|
373
|
+
/** How a dialog opened by the page should be answered. */
|
|
374
|
+
type DialogAction = "accept" | "dismiss";
|
|
375
|
+
/** Options accepted when navigating; mirrors the subset of Playwright's `goto`. */
|
|
376
|
+
type NavigateOptions = {
|
|
377
|
+
waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
|
|
378
|
+
};
|
|
379
|
+
/** A network response as the driver exposes it (engine-neutral). */
|
|
380
|
+
type DriverResponse = {
|
|
381
|
+
url(): string;
|
|
382
|
+
status(): number;
|
|
383
|
+
/** Header names MUST be lowercased by the driver; consumers look up lowercase keys. */
|
|
384
|
+
headers(): Record<string, string>;
|
|
385
|
+
};
|
|
386
|
+
/** A route intercepted via `route()`; the handler fulfills it with a canned response. */
|
|
387
|
+
type DriverRoute = {
|
|
388
|
+
fulfill(response: {
|
|
389
|
+
status: number;
|
|
390
|
+
contentType?: string;
|
|
391
|
+
body?: string;
|
|
392
|
+
}): Promise<void>;
|
|
393
|
+
};
|
|
394
|
+
/** A file download surfaced by `waitForDownloadEvent()`. */
|
|
395
|
+
type DriverDownload = {
|
|
396
|
+
suggestedFilename(): string;
|
|
397
|
+
saveAs(path: string): Promise<void>;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* The operations the step runner performs against a live session. Each method
|
|
401
|
+
* corresponds to one Playwright Page/Locator call in the legacy runner, so the
|
|
402
|
+
* Playwright implementation is a faithful pass-through and behaviour is
|
|
403
|
+
* unchanged.
|
|
404
|
+
*/
|
|
405
|
+
interface SessionDriver {
|
|
406
|
+
/** Capabilities this driver supports; handlers declare what they need. */
|
|
407
|
+
readonly capabilities: ReadonlySet<DriverCapability>;
|
|
408
|
+
goto(url: string, options?: NavigateOptions): Promise<void>;
|
|
409
|
+
currentUrl(): string;
|
|
410
|
+
count(selector: string): Promise<number>;
|
|
411
|
+
textContent(selector: string): Promise<string | null>;
|
|
412
|
+
click(selector: string): Promise<void>;
|
|
413
|
+
clickFirst(selector: string): Promise<void>;
|
|
414
|
+
fill(selector: string, value: string): Promise<void>;
|
|
415
|
+
fillFirst(selector: string, value: string): Promise<void>;
|
|
416
|
+
press(selector: string, key: string): Promise<void>;
|
|
417
|
+
selectOption(selector: string, value: string): Promise<void>;
|
|
418
|
+
selectOptionFirst(selector: string, value: string): Promise<void>;
|
|
419
|
+
hover(selector: string): Promise<void>;
|
|
420
|
+
scrollIntoView(selector: string): Promise<void>;
|
|
421
|
+
setInputFiles(selector: string, files: string | string[]): Promise<void>;
|
|
422
|
+
countByRole(role: string, name: string): Promise<number>;
|
|
423
|
+
clickFirstByRole(role: string, name: string): Promise<void>;
|
|
424
|
+
countByLabel(label: string): Promise<number>;
|
|
425
|
+
fillFirstByLabel(label: string, value: string): Promise<void>;
|
|
426
|
+
selectOptionFirstByLabel(label: string, value: string): Promise<void>;
|
|
427
|
+
waitForSelector(selector: string, options?: {
|
|
428
|
+
timeout?: number;
|
|
429
|
+
}): Promise<void>;
|
|
430
|
+
waitForUrl(predicate: (url: string) => boolean, options?: {
|
|
431
|
+
timeout?: number;
|
|
432
|
+
}): Promise<void>;
|
|
433
|
+
waitForNetworkIdle(options?: {
|
|
434
|
+
timeout?: number;
|
|
435
|
+
}): Promise<void>;
|
|
436
|
+
evaluate<R = unknown, A = unknown>(pageFunction: string | ((arg: A) => R | Promise<R>), arg?: A): Promise<R>;
|
|
437
|
+
screenshot(options: {
|
|
438
|
+
path: string;
|
|
439
|
+
fullPage?: boolean;
|
|
440
|
+
}): Promise<void>;
|
|
441
|
+
onResponse(handler: (response: DriverResponse) => void): void;
|
|
442
|
+
route(url: string, handler: (route: DriverRoute) => void | Promise<void>): Promise<void>;
|
|
443
|
+
unroute(url: string): Promise<void>;
|
|
444
|
+
onDialog(action: DialogAction): void;
|
|
445
|
+
waitForDownloadEvent(options?: {
|
|
446
|
+
timeout?: number;
|
|
447
|
+
}): Promise<DriverDownload>;
|
|
448
|
+
/**
|
|
449
|
+
* Driver-supplied selector parser: returns the literal text a text-engine
|
|
450
|
+
* selector matches (e.g. `text="Delete"` → `Delete`), or null for any other
|
|
451
|
+
* selector. The guardrail policy uses this to interpret forbidden patterns
|
|
452
|
+
* without hard-coding the engine's selector dialect.
|
|
453
|
+
*/
|
|
454
|
+
parseTextSelector(selector: string): string | null;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* PROWL-048 / ARCH-002 — macOS native implementation of {@link SessionDriver}.
|
|
459
|
+
*
|
|
460
|
+
* `MacDriver` drives a native macOS app through the `prowl-macdriver` Swift
|
|
461
|
+
* helper (Accessibility / AXUIElement) over a long-lived JSON-over-stdio
|
|
462
|
+
* transport ({@link MacHelperClient}). It implements only the portable subset of
|
|
463
|
+
* the driver surface — its `capabilities` set is honest: `query`, `interact`,
|
|
464
|
+
* `wait`, `screenshot`. Web-only verbs (navigation, network, dialogs, files,
|
|
465
|
+
* downloads, script evaluation) are unsupported stubs; the runner never reaches
|
|
466
|
+
* them because both the target step-compatibility check and the runtime
|
|
467
|
+
* capability gate reject web-only steps for the macOS target.
|
|
468
|
+
*
|
|
469
|
+
* Selector dialect (parsed here, so the Swift helper only matches attributes):
|
|
470
|
+
* id=openSettings → accessibility identifier
|
|
471
|
+
* role=button[name="Save"] → AX role + accessible name
|
|
472
|
+
* label="Email" → exact accessibility label
|
|
473
|
+
* text="Save" | Save → title/description/value substring
|
|
474
|
+
* statusItem → open the app's menu bar status-item menu
|
|
475
|
+
* menu=Preferences… → open the status-item menu and click an item
|
|
476
|
+
*/
|
|
477
|
+
|
|
478
|
+
/** A structured accessibility query understood by the Swift helper. */
|
|
479
|
+
type MacQuery = {
|
|
480
|
+
by: "id";
|
|
481
|
+
value: string;
|
|
482
|
+
} | {
|
|
483
|
+
by: "role";
|
|
484
|
+
role: string;
|
|
485
|
+
name?: string;
|
|
486
|
+
} | {
|
|
487
|
+
by: "text";
|
|
488
|
+
value: string;
|
|
489
|
+
} | {
|
|
490
|
+
by: "label";
|
|
491
|
+
value: string;
|
|
492
|
+
} | {
|
|
493
|
+
by: "focused";
|
|
494
|
+
};
|
|
495
|
+
/** The transport MacDriver talks to: one request → one response, matched by id. */
|
|
496
|
+
interface MacHelperClient {
|
|
497
|
+
/** Send a command; resolve with its `result` payload or reject with its error. */
|
|
498
|
+
request(cmd: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
499
|
+
/** Shut the helper down. */
|
|
500
|
+
close(): Promise<void>;
|
|
501
|
+
}
|
|
502
|
+
type MacDriverOptions = {
|
|
503
|
+
/** Bundle id / app label, used only for the informational `currentUrl()` value. */
|
|
504
|
+
appLabel?: string;
|
|
505
|
+
};
|
|
506
|
+
/** Parse a Prowl selector string into a {@link MacQuery}. Bare text matches by text. */
|
|
507
|
+
declare function parseMacSelector(selector: string): MacQuery;
|
|
508
|
+
/** Wrap a live {@link MacHelperClient} as a {@link SessionDriver}. */
|
|
509
|
+
declare function createMacDriver(client: MacHelperClient, options?: MacDriverOptions): SessionDriver;
|
|
510
|
+
|
|
511
|
+
declare function macdriverBuildInstructions(): string;
|
|
512
|
+
/**
|
|
513
|
+
* Resolve the helper binary path. Order: `PROWL_MACDRIVER_BIN`, then the
|
|
514
|
+
* release then debug build under `macdriver/.build/`. Throws with build
|
|
515
|
+
* instructions when none is found.
|
|
516
|
+
*/
|
|
517
|
+
declare function resolveHelperBinary(env?: NodeJS.ProcessEnv): string;
|
|
518
|
+
/** Default per-request deadline for the helper transport. */
|
|
519
|
+
declare const DEFAULT_REQUEST_TIMEOUT_MS = 30000;
|
|
520
|
+
type SpawnMacHelperOptions = {
|
|
521
|
+
/** Per-request deadline; a request that gets no response by then rejects. */
|
|
522
|
+
requestTimeoutMs?: number;
|
|
523
|
+
};
|
|
524
|
+
/** A {@link MacHelperClient} backed by a spawned `prowl-macdriver serve` process. */
|
|
525
|
+
declare class SpawnMacHelperClient implements MacHelperClient {
|
|
526
|
+
private readonly child;
|
|
527
|
+
private readonly pending;
|
|
528
|
+
private readonly requestTimeoutMs;
|
|
529
|
+
private stdoutBuffer;
|
|
530
|
+
private stderrBuffer;
|
|
531
|
+
private nextId;
|
|
532
|
+
private closed;
|
|
533
|
+
private terminalError;
|
|
534
|
+
constructor(binaryPath: string, options?: SpawnMacHelperOptions);
|
|
535
|
+
private onStdout;
|
|
536
|
+
private dispatch;
|
|
537
|
+
private failAll;
|
|
538
|
+
private recordTerminalFailure;
|
|
539
|
+
/** Number of in-flight requests awaiting a response (for teardown/tests). */
|
|
540
|
+
get pendingCount(): number;
|
|
541
|
+
request(cmd: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
542
|
+
close(): Promise<void>;
|
|
543
|
+
}
|
|
544
|
+
type MacSession = {
|
|
545
|
+
client: MacHelperClient;
|
|
546
|
+
driver: SessionDriver;
|
|
547
|
+
bundleId: string;
|
|
548
|
+
};
|
|
549
|
+
type LaunchMacOptions = {
|
|
550
|
+
/** Bundle id or absolute `.app` path. */
|
|
551
|
+
app: string;
|
|
552
|
+
timeoutMs?: number;
|
|
553
|
+
/** Inject a helper client (tests / a prebuilt binary); defaults to spawning the helper. */
|
|
554
|
+
clientFactory?: () => MacHelperClient;
|
|
555
|
+
};
|
|
556
|
+
/** Launch/attach the target app through the helper and build a {@link MacDriver}. */
|
|
557
|
+
declare function launchMacSession(options: LaunchMacOptions): Promise<MacSession>;
|
|
558
|
+
/** Quit the target app (best effort) and shut the helper down. */
|
|
559
|
+
declare function closeMacSession(session: MacSession): Promise<void>;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* PROWL-048 / ARCH-002 — target ⇄ step compatibility.
|
|
563
|
+
*
|
|
564
|
+
* The runtime capability gate in the step runner already rejects steps a driver
|
|
565
|
+
* cannot honor. This adds a friendlier, earlier validation-time rejection: when
|
|
566
|
+
* the selected target is macOS, hunts using web-only steps fail fast with a
|
|
567
|
+
* clear message before anything launches.
|
|
568
|
+
*/
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Step types that only make sense on the web target. Everything else
|
|
572
|
+
* (`click`, `fill`, `type`, `press`, `wait`, `assert visible/notVisible`,
|
|
573
|
+
* `screenshot`, `assertScreenshot`, `repeat`, `runHunt`, `if`, `copyText`,
|
|
574
|
+
* `hover`, `scrollTo`, `waitForSelector`) is portable across targets.
|
|
575
|
+
*/
|
|
576
|
+
declare const WEB_ONLY_STEP_TYPES: ReadonlySet<string>;
|
|
577
|
+
/** The web-only reason a step is unsupported on a non-web target, or null if portable. */
|
|
578
|
+
declare function webOnlyReason(step: Step): string | null;
|
|
579
|
+
/**
|
|
580
|
+
* Throw if any step in `steps` (recursing into `if`/`repeat` bodies) is not
|
|
581
|
+
* supported by `target`. `runHunt` references are validated when the referenced
|
|
582
|
+
* hunt itself runs. No-op for the web target.
|
|
583
|
+
*/
|
|
584
|
+
declare function assertStepsSupportedByTarget(steps: Step[], target: Target["type"]): void;
|
|
585
|
+
/**
|
|
586
|
+
* Native scope guardrail: if `allowedApps` is non-empty it must include an
|
|
587
|
+
* accepted identity for the target app: bundle id, app bundle name, or `.app`
|
|
588
|
+
* path. An empty list means the scope is unset and the target app is implicitly
|
|
589
|
+
* allowed — mirroring how allowedDomains auto-includes the web target's host.
|
|
590
|
+
*/
|
|
591
|
+
declare function assertTargetAppAllowed(allowedApps: string[], app: string): void;
|
|
592
|
+
|
|
342
593
|
type StepCallback = (result: StepResult, step: Step, index: number) => void;
|
|
343
594
|
|
|
344
595
|
type RunOptions = {
|
|
@@ -353,6 +604,8 @@ type RunOptions = {
|
|
|
353
604
|
channel?: BrowserChannel;
|
|
354
605
|
viewport?: string;
|
|
355
606
|
junit?: boolean;
|
|
607
|
+
/** Inject a macOS helper client (tests / a prebuilt binary); defaults to spawning the helper. */
|
|
608
|
+
macClientFactory?: () => MacHelperClient;
|
|
356
609
|
};
|
|
357
610
|
declare function runHunt(options: RunOptions): Promise<{
|
|
358
611
|
result: RunResult;
|
|
@@ -468,6 +721,16 @@ type RankFlakyOptions = {
|
|
|
468
721
|
*/
|
|
469
722
|
declare function rankFlaky(configDir: string, options?: RankFlakyOptions): FlakyScore[];
|
|
470
723
|
|
|
724
|
+
/**
|
|
725
|
+
* The minimal probe surface healing needs: count matches for a candidate
|
|
726
|
+
* selector. A live Playwright page and a {@link SessionDriver}-backed adapter
|
|
727
|
+
* both satisfy it, so healing carries no Playwright dependency.
|
|
728
|
+
*/
|
|
729
|
+
type SelectorProbe = {
|
|
730
|
+
locator(selector: string): {
|
|
731
|
+
count(): Promise<number>;
|
|
732
|
+
};
|
|
733
|
+
};
|
|
471
734
|
/**
|
|
472
735
|
* Self-healing selectors (PROWL-023). When an explicit selector matches nothing,
|
|
473
736
|
* derive the human "intent" from the selector and try alternative strategies —
|
|
@@ -508,7 +771,7 @@ declare function buildHealCandidates(selector: string): Array<{
|
|
|
508
771
|
* resolves to exactly one element; otherwise null. Counting is delegated so this
|
|
509
772
|
* is unit-testable with a fake page.
|
|
510
773
|
*/
|
|
511
|
-
declare function healSelector(
|
|
774
|
+
declare function healSelector(probe: SelectorProbe, selector: string, options: {
|
|
512
775
|
enabled: boolean;
|
|
513
776
|
}): Promise<HealResult | null>;
|
|
514
777
|
|
|
@@ -541,13 +804,25 @@ declare function loadHuntMeta(huntName: string, configDir: string): {
|
|
|
541
804
|
declare function listHunts(configDir: string): string[];
|
|
542
805
|
|
|
543
806
|
declare const configSchema: z.ZodObject<{
|
|
544
|
-
target: z.ZodObject<{
|
|
807
|
+
target: z.ZodUnion<[z.ZodObject<{
|
|
808
|
+
type: z.ZodLiteral<"macos">;
|
|
809
|
+
app: z.ZodString;
|
|
810
|
+
}, "strict", z.ZodTypeAny, {
|
|
811
|
+
app: string;
|
|
812
|
+
type: "macos";
|
|
813
|
+
}, {
|
|
814
|
+
app: string;
|
|
815
|
+
type: "macos";
|
|
816
|
+
}>, z.ZodObject<{
|
|
817
|
+
type: z.ZodOptional<z.ZodLiteral<"web">>;
|
|
545
818
|
url: z.ZodString;
|
|
546
|
-
}, "
|
|
819
|
+
}, "strict", z.ZodTypeAny, {
|
|
547
820
|
url: string;
|
|
821
|
+
type?: "web" | undefined;
|
|
548
822
|
}, {
|
|
549
823
|
url: string;
|
|
550
|
-
|
|
824
|
+
type?: "web" | undefined;
|
|
825
|
+
}>]>;
|
|
551
826
|
browser: z.ZodOptional<z.ZodObject<{
|
|
552
827
|
headless: z.ZodOptional<z.ZodBoolean>;
|
|
553
828
|
slowMo: z.ZodOptional<z.ZodNumber>;
|
|
@@ -565,9 +840,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
565
840
|
height: number;
|
|
566
841
|
}>]>>;
|
|
567
842
|
}, "strip", z.ZodTypeAny, {
|
|
843
|
+
timeout?: number | undefined;
|
|
568
844
|
headless?: boolean | undefined;
|
|
569
845
|
slowMo?: number | undefined;
|
|
570
|
-
timeout?: number | undefined;
|
|
571
846
|
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
572
847
|
channel?: "chromium" | "chrome" | "chrome-beta" | "chrome-canary" | "chrome-dev" | "msedge" | "msedge-beta" | "msedge-canary" | "msedge-dev" | undefined;
|
|
573
848
|
viewport?: "mobile" | "tablet" | "desktop" | {
|
|
@@ -575,9 +850,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
575
850
|
height: number;
|
|
576
851
|
} | undefined;
|
|
577
852
|
}, {
|
|
853
|
+
timeout?: number | undefined;
|
|
578
854
|
headless?: boolean | undefined;
|
|
579
855
|
slowMo?: number | undefined;
|
|
580
|
-
timeout?: number | undefined;
|
|
581
856
|
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
582
857
|
channel?: "chromium" | "chrome" | "chrome-beta" | "chrome-canary" | "chrome-dev" | "msedge" | "msedge-beta" | "msedge-canary" | "msedge-dev" | undefined;
|
|
583
858
|
viewport?: "mobile" | "tablet" | "desktop" | {
|
|
@@ -620,16 +895,19 @@ declare const configSchema: z.ZodObject<{
|
|
|
620
895
|
guardrails: z.ZodOptional<z.ZodObject<{
|
|
621
896
|
maxSteps: z.ZodOptional<z.ZodNumber>;
|
|
622
897
|
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
898
|
+
allowedApps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
623
899
|
forbiddenSelectors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
624
900
|
selfHealing: z.ZodOptional<z.ZodBoolean>;
|
|
625
901
|
}, "strip", z.ZodTypeAny, {
|
|
626
902
|
maxSteps?: number | undefined;
|
|
627
903
|
allowedDomains?: string[] | undefined;
|
|
904
|
+
allowedApps?: string[] | undefined;
|
|
628
905
|
forbiddenSelectors?: string[] | undefined;
|
|
629
906
|
selfHealing?: boolean | undefined;
|
|
630
907
|
}, {
|
|
631
908
|
maxSteps?: number | undefined;
|
|
632
909
|
allowedDomains?: string[] | undefined;
|
|
910
|
+
allowedApps?: string[] | undefined;
|
|
633
911
|
forbiddenSelectors?: string[] | undefined;
|
|
634
912
|
selfHealing?: boolean | undefined;
|
|
635
913
|
}>>;
|
|
@@ -677,11 +955,15 @@ declare const configSchema: z.ZodObject<{
|
|
|
677
955
|
}, "strict", z.ZodTypeAny, {
|
|
678
956
|
target: {
|
|
679
957
|
url: string;
|
|
958
|
+
type?: "web" | undefined;
|
|
959
|
+
} | {
|
|
960
|
+
app: string;
|
|
961
|
+
type: "macos";
|
|
680
962
|
};
|
|
681
963
|
browser?: {
|
|
964
|
+
timeout?: number | undefined;
|
|
682
965
|
headless?: boolean | undefined;
|
|
683
966
|
slowMo?: number | undefined;
|
|
684
|
-
timeout?: number | undefined;
|
|
685
967
|
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
686
968
|
channel?: "chromium" | "chrome" | "chrome-beta" | "chrome-canary" | "chrome-dev" | "msedge" | "msedge-beta" | "msedge-canary" | "msedge-dev" | undefined;
|
|
687
969
|
viewport?: "mobile" | "tablet" | "desktop" | {
|
|
@@ -704,6 +986,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
704
986
|
guardrails?: {
|
|
705
987
|
maxSteps?: number | undefined;
|
|
706
988
|
allowedDomains?: string[] | undefined;
|
|
989
|
+
allowedApps?: string[] | undefined;
|
|
707
990
|
forbiddenSelectors?: string[] | undefined;
|
|
708
991
|
selfHealing?: boolean | undefined;
|
|
709
992
|
} | undefined;
|
|
@@ -727,11 +1010,15 @@ declare const configSchema: z.ZodObject<{
|
|
|
727
1010
|
}, {
|
|
728
1011
|
target: {
|
|
729
1012
|
url: string;
|
|
1013
|
+
type?: "web" | undefined;
|
|
1014
|
+
} | {
|
|
1015
|
+
app: string;
|
|
1016
|
+
type: "macos";
|
|
730
1017
|
};
|
|
731
1018
|
browser?: {
|
|
1019
|
+
timeout?: number | undefined;
|
|
732
1020
|
headless?: boolean | undefined;
|
|
733
1021
|
slowMo?: number | undefined;
|
|
734
|
-
timeout?: number | undefined;
|
|
735
1022
|
engine?: "chromium" | "firefox" | "webkit" | undefined;
|
|
736
1023
|
channel?: "chromium" | "chrome" | "chrome-beta" | "chrome-canary" | "chrome-dev" | "msedge" | "msedge-beta" | "msedge-canary" | "msedge-dev" | undefined;
|
|
737
1024
|
viewport?: "mobile" | "tablet" | "desktop" | {
|
|
@@ -754,6 +1041,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
754
1041
|
guardrails?: {
|
|
755
1042
|
maxSteps?: number | undefined;
|
|
756
1043
|
allowedDomains?: string[] | undefined;
|
|
1044
|
+
allowedApps?: string[] | undefined;
|
|
757
1045
|
forbiddenSelectors?: string[] | undefined;
|
|
758
1046
|
selfHealing?: boolean | undefined;
|
|
759
1047
|
} | undefined;
|
|
@@ -831,6 +1119,7 @@ declare const huntSchema: z.ZodObject<{
|
|
|
831
1119
|
}>>;
|
|
832
1120
|
}, "strict", z.ZodTypeAny, {
|
|
833
1121
|
steps: Step[];
|
|
1122
|
+
name?: string | undefined;
|
|
834
1123
|
assertions?: ({
|
|
835
1124
|
selectorExists: string;
|
|
836
1125
|
} | {
|
|
@@ -844,7 +1133,6 @@ declare const huntSchema: z.ZodObject<{
|
|
|
844
1133
|
} | {
|
|
845
1134
|
noNetworkErrors: boolean;
|
|
846
1135
|
})[] | undefined;
|
|
847
|
-
name?: string | undefined;
|
|
848
1136
|
vars?: Record<string, string> | undefined;
|
|
849
1137
|
description?: string | undefined;
|
|
850
1138
|
tags?: string[] | undefined;
|
|
@@ -854,6 +1142,7 @@ declare const huntSchema: z.ZodObject<{
|
|
|
854
1142
|
} | undefined;
|
|
855
1143
|
}, {
|
|
856
1144
|
steps: Step[];
|
|
1145
|
+
name?: string | undefined;
|
|
857
1146
|
assertions?: ({
|
|
858
1147
|
selectorExists: string;
|
|
859
1148
|
} | {
|
|
@@ -867,7 +1156,6 @@ declare const huntSchema: z.ZodObject<{
|
|
|
867
1156
|
} | {
|
|
868
1157
|
noNetworkErrors: boolean;
|
|
869
1158
|
})[] | undefined;
|
|
870
|
-
name?: string | undefined;
|
|
871
1159
|
vars?: Record<string, string> | undefined;
|
|
872
1160
|
description?: string | undefined;
|
|
873
1161
|
tags?: string[] | undefined;
|
|
@@ -885,6 +1173,15 @@ type InterpolatedHunt = {
|
|
|
885
1173
|
};
|
|
886
1174
|
declare function interpolateHunt(hunt: Hunt, env: NodeJS.ProcessEnv, randomVars?: Record<string, string>): InterpolatedHunt;
|
|
887
1175
|
|
|
1176
|
+
/**
|
|
1177
|
+
* The minimal surface `analyzePage` needs: a way to evaluate a DOM-scraping
|
|
1178
|
+
* function in the page. Both a live Playwright page and a {@link SessionDriver}
|
|
1179
|
+
* satisfy it (the driver's `evaluate` verb), so the analyzer has no direct
|
|
1180
|
+
* Playwright dependency — its DOM scraping runs through the driver.
|
|
1181
|
+
*/
|
|
1182
|
+
type DomEvaluator = {
|
|
1183
|
+
evaluate(pageFunction: () => unknown): Promise<unknown>;
|
|
1184
|
+
};
|
|
888
1185
|
type PageElement = {
|
|
889
1186
|
tag: string;
|
|
890
1187
|
type?: string;
|
|
@@ -913,7 +1210,7 @@ type AnalysisResult = {
|
|
|
913
1210
|
forms: PageForm[];
|
|
914
1211
|
links: PageLink[];
|
|
915
1212
|
};
|
|
916
|
-
declare function analyzePage(page:
|
|
1213
|
+
declare function analyzePage(page: DomEvaluator): Promise<AnalysisResult>;
|
|
917
1214
|
|
|
918
1215
|
type AiProvider = "anthropic" | "openai";
|
|
919
1216
|
type AiConfig = {
|
|
@@ -932,4 +1229,4 @@ type GenerateOptions = {
|
|
|
932
1229
|
};
|
|
933
1230
|
declare function generateHunt(options: GenerateOptions): Promise<string>;
|
|
934
1231
|
|
|
935
|
-
export { type AnalysisResult, type AssertScreenshotStep, type Assertion, type AssertionResult, type BrowserChannel, type BrowserEngine, type BugFailure, type BugLogSummary, type CiFailureCluster, type CiFlakyHunt, type CiHuntResult, type CiResult, type CiStatus, type Config, DEFAULT_FLAKY_THRESHOLD, type EvalScriptStep, type FailureCluster, type FlakyScore, type GenerateOptions, type HealResult, type HistoryEntry, type HistoryFile, type Hunt, type IfStep, type MockRouteStep, type PageElement, type PageForm, type PageLink, type RankFlakyOptions, type ReliabilityConfig, type RepeatStep, type RunArtifacts, type RunOptions, type RunResult, type RunScriptStep, type RunSuiteHooks, type RunSuiteOptions, type RunSuiteResult, type Step, type StepResult, type UnmockRouteStep, type UpdateBacklogOptions, type Viewport, analyzePage, buildHealCandidates, clusterFailures, computeFlakeScore, configSchema, extractFailures, extractSelectorIntent, generateHunt, healSelector, huntSchema, interpolateHunt, listHunts, loadConfig, loadHunt, loadHuntMeta, loadHuntTags, rankFlaky, readHistory, readHuntHistory, runHunt, runSuite, stepSchema, updateBacklogFromSuite };
|
|
1232
|
+
export { type AnalysisResult, type AssertScreenshotStep, type Assertion, type AssertionResult, type BrowserChannel, type BrowserEngine, type BugFailure, type BugLogSummary, type CiFailureCluster, type CiFlakyHunt, type CiHuntResult, type CiResult, type CiStatus, type Config, DEFAULT_FLAKY_THRESHOLD, DEFAULT_REQUEST_TIMEOUT_MS, type EvalScriptStep, type FailureCluster, type FlakyScore, type GenerateOptions, type HealResult, type HistoryEntry, type HistoryFile, type Hunt, type IfStep, type LaunchMacOptions, type MacDriverOptions, type MacHelperClient, type MacQuery, type MacSession, type MacosTarget, type MockRouteStep, type PageElement, type PageForm, type PageLink, type RankFlakyOptions, type ReliabilityConfig, type RepeatStep, type RunArtifacts, type RunOptions, type RunResult, type RunScriptStep, type RunSuiteHooks, type RunSuiteOptions, type RunSuiteResult, SpawnMacHelperClient, type SpawnMacHelperOptions, type Step, type StepResult, type Target, type UnmockRouteStep, type UpdateBacklogOptions, type Viewport, WEB_ONLY_STEP_TYPES, type WebTarget, analyzePage, assertStepsSupportedByTarget, assertTargetAppAllowed, buildHealCandidates, closeMacSession, clusterFailures, computeFlakeScore, configSchema, createMacDriver, extractFailures, extractSelectorIntent, generateHunt, healSelector, huntSchema, interpolateHunt, launchMacSession, listHunts, loadConfig, loadHunt, loadHuntMeta, loadHuntTags, macdriverBuildInstructions, parseMacSelector, rankFlaky, readHistory, readHuntHistory, resolveHelperBinary, runHunt, runSuite, stepSchema, updateBacklogFromSuite, webOnlyReason };
|