browser-pilot 0.0.16 → 0.0.17
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 +22 -0
- package/dist/actions.cjs +797 -69
- package/dist/actions.d.cts +101 -4
- package/dist/actions.d.ts +101 -4
- package/dist/actions.mjs +17 -1
- package/dist/{browser-ZCR6AA4D.mjs → browser-4ZHNAQR5.mjs} +2 -2
- package/dist/browser.cjs +1238 -72
- package/dist/browser.d.cts +229 -5
- package/dist/browser.d.ts +229 -5
- package/dist/browser.mjs +36 -4
- package/dist/{chunk-NNEHWWHL.mjs → chunk-FEEGNSHB.mjs} +584 -4
- package/dist/{chunk-TJ5B56NV.mjs → chunk-IRLHCVNH.mjs} +1 -1
- package/dist/chunk-MIJ7UIKB.mjs +96 -0
- package/dist/{chunk-6GBYX7C2.mjs → chunk-MRY3HRFJ.mjs} +799 -353
- package/dist/chunk-OIHU7OFY.mjs +91 -0
- package/dist/{chunk-V3VLBQAM.mjs → chunk-ZDODXEBD.mjs} +586 -69
- package/dist/cli.mjs +756 -174
- package/dist/combobox-RAKBA2BW.mjs +6 -0
- package/dist/index.cjs +1539 -71
- package/dist/index.d.cts +56 -5
- package/dist/index.d.ts +56 -5
- package/dist/index.mjs +189 -2
- package/dist/{page-IUUTJ3SW.mjs → page-SD64DY3F.mjs} +1 -1
- package/dist/{types-BzM-IfsL.d.ts → types-B_v62K7C.d.ts} +146 -2
- package/dist/{types-BflRmiDz.d.cts → types-Yuybzq53.d.cts} +146 -2
- package/dist/upload-E6MCC2OF.mjs +6 -0
- package/package.json +10 -3
package/dist/actions.d.cts
CHANGED
|
@@ -1,6 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActionType,
|
|
3
|
-
import './client-B5QBRgIy.cjs';
|
|
1
|
+
import { W as Page, c as Condition, M as MatchedCondition, O as OutcomeStatus, S as Step, b as BatchOptions, B as BatchResult } from './types-Yuybzq53.cjs';
|
|
2
|
+
export { A as ActionType, aw as FailureReason, d as RecordOptions, e as StepResult } from './types-Yuybzq53.cjs';
|
|
3
|
+
import { C as CDPClient } from './client-B5QBRgIy.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Condition evaluation for outcome-based execution
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Tracks network responses during step execution for networkResponse conditions
|
|
11
|
+
*/
|
|
12
|
+
declare class NetworkResponseTracker {
|
|
13
|
+
private responses;
|
|
14
|
+
private listening;
|
|
15
|
+
private handler;
|
|
16
|
+
start(cdp: CDPClient): void;
|
|
17
|
+
stop(cdp: CDPClient): void;
|
|
18
|
+
getResponses(): Array<{
|
|
19
|
+
url: string;
|
|
20
|
+
status: number;
|
|
21
|
+
}>;
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Capture a state signature for stateSignatureChanges condition.
|
|
26
|
+
* Uses page URL + visible text content hash as a lightweight fingerprint.
|
|
27
|
+
*/
|
|
28
|
+
declare function captureStateSignature(page: Page): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Evaluate a single condition against the current page state
|
|
31
|
+
*/
|
|
32
|
+
declare function evaluateCondition(condition: Condition, page: Page, context?: {
|
|
33
|
+
networkTracker?: NetworkResponseTracker;
|
|
34
|
+
beforeSignature?: string;
|
|
35
|
+
}): Promise<MatchedCondition>;
|
|
36
|
+
/**
|
|
37
|
+
* Evaluate outcome conditions after a step has executed.
|
|
38
|
+
*
|
|
39
|
+
* Evaluation order:
|
|
40
|
+
* 1. failIf conditions (any match = 'failed')
|
|
41
|
+
* 2. expectAll conditions (all must match for success)
|
|
42
|
+
* 3. expectAny conditions (any match = success)
|
|
43
|
+
* 4. If no conditions matched and step mechanically succeeded, outcome is 'ambiguous'
|
|
44
|
+
*
|
|
45
|
+
* dangerous steps that result in 'ambiguous' get 'unsafe_to_retry'
|
|
46
|
+
*/
|
|
47
|
+
declare function evaluateOutcome(page: Page, options: {
|
|
48
|
+
expectAny?: Condition[];
|
|
49
|
+
expectAll?: Condition[];
|
|
50
|
+
failIf?: Condition[];
|
|
51
|
+
dangerous?: boolean;
|
|
52
|
+
networkTracker?: NetworkResponseTracker;
|
|
53
|
+
beforeSignature?: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
outcomeStatus: OutcomeStatus;
|
|
56
|
+
matchedConditions: MatchedCondition[];
|
|
57
|
+
retrySafe: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Condition combinators for multi-path waits
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
interface CombinatorResult {
|
|
65
|
+
matched: boolean;
|
|
66
|
+
matchedConditions: MatchedCondition[];
|
|
67
|
+
/** Which path won (for race/any) */
|
|
68
|
+
winnerIndex?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* any() — succeeds if ANY condition matches
|
|
72
|
+
*/
|
|
73
|
+
declare function conditionAny(conditions: Condition[], page: Page, context?: {
|
|
74
|
+
networkTracker?: NetworkResponseTracker;
|
|
75
|
+
beforeSignature?: string;
|
|
76
|
+
}): Promise<CombinatorResult>;
|
|
77
|
+
/**
|
|
78
|
+
* all() — succeeds only if ALL conditions match
|
|
79
|
+
*/
|
|
80
|
+
declare function conditionAll(conditions: Condition[], page: Page, context?: {
|
|
81
|
+
networkTracker?: NetworkResponseTracker;
|
|
82
|
+
beforeSignature?: string;
|
|
83
|
+
}): Promise<CombinatorResult>;
|
|
84
|
+
/**
|
|
85
|
+
* not() — inverts a single condition
|
|
86
|
+
*/
|
|
87
|
+
declare function conditionNot(condition: Condition, page: Page, context?: {
|
|
88
|
+
networkTracker?: NetworkResponseTracker;
|
|
89
|
+
beforeSignature?: string;
|
|
90
|
+
}): Promise<CombinatorResult>;
|
|
91
|
+
/**
|
|
92
|
+
* race() — evaluates conditions with polling until one matches or timeout.
|
|
93
|
+
* Returns the first condition to match.
|
|
94
|
+
*/
|
|
95
|
+
declare function conditionRace(conditions: Condition[], page: Page, options?: {
|
|
96
|
+
timeout?: number;
|
|
97
|
+
pollInterval?: number;
|
|
98
|
+
networkTracker?: NetworkResponseTracker;
|
|
99
|
+
beforeSignature?: string;
|
|
100
|
+
}): Promise<CombinatorResult>;
|
|
4
101
|
|
|
5
102
|
/**
|
|
6
103
|
* Batch action executor
|
|
@@ -67,4 +164,4 @@ interface ValidationResult {
|
|
|
67
164
|
}
|
|
68
165
|
declare function validateSteps(steps: unknown[]): ValidationResult;
|
|
69
166
|
|
|
70
|
-
export { BatchExecutor, BatchOptions, BatchResult, Step, type ValidationError, type ValidationResult, addBatchToPage, validateSteps };
|
|
167
|
+
export { BatchExecutor, BatchOptions, BatchResult, type CombinatorResult, Condition, MatchedCondition, NetworkResponseTracker, OutcomeStatus, Step, type ValidationError, type ValidationResult, addBatchToPage, captureStateSignature, conditionAll, conditionAny, conditionNot, conditionRace, evaluateCondition, evaluateOutcome, validateSteps };
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActionType,
|
|
3
|
-
import './client-B5QBRgIy.js';
|
|
1
|
+
import { W as Page, c as Condition, M as MatchedCondition, O as OutcomeStatus, S as Step, b as BatchOptions, B as BatchResult } from './types-B_v62K7C.js';
|
|
2
|
+
export { A as ActionType, aw as FailureReason, d as RecordOptions, e as StepResult } from './types-B_v62K7C.js';
|
|
3
|
+
import { C as CDPClient } from './client-B5QBRgIy.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Condition evaluation for outcome-based execution
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Tracks network responses during step execution for networkResponse conditions
|
|
11
|
+
*/
|
|
12
|
+
declare class NetworkResponseTracker {
|
|
13
|
+
private responses;
|
|
14
|
+
private listening;
|
|
15
|
+
private handler;
|
|
16
|
+
start(cdp: CDPClient): void;
|
|
17
|
+
stop(cdp: CDPClient): void;
|
|
18
|
+
getResponses(): Array<{
|
|
19
|
+
url: string;
|
|
20
|
+
status: number;
|
|
21
|
+
}>;
|
|
22
|
+
reset(): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Capture a state signature for stateSignatureChanges condition.
|
|
26
|
+
* Uses page URL + visible text content hash as a lightweight fingerprint.
|
|
27
|
+
*/
|
|
28
|
+
declare function captureStateSignature(page: Page): Promise<string>;
|
|
29
|
+
/**
|
|
30
|
+
* Evaluate a single condition against the current page state
|
|
31
|
+
*/
|
|
32
|
+
declare function evaluateCondition(condition: Condition, page: Page, context?: {
|
|
33
|
+
networkTracker?: NetworkResponseTracker;
|
|
34
|
+
beforeSignature?: string;
|
|
35
|
+
}): Promise<MatchedCondition>;
|
|
36
|
+
/**
|
|
37
|
+
* Evaluate outcome conditions after a step has executed.
|
|
38
|
+
*
|
|
39
|
+
* Evaluation order:
|
|
40
|
+
* 1. failIf conditions (any match = 'failed')
|
|
41
|
+
* 2. expectAll conditions (all must match for success)
|
|
42
|
+
* 3. expectAny conditions (any match = success)
|
|
43
|
+
* 4. If no conditions matched and step mechanically succeeded, outcome is 'ambiguous'
|
|
44
|
+
*
|
|
45
|
+
* dangerous steps that result in 'ambiguous' get 'unsafe_to_retry'
|
|
46
|
+
*/
|
|
47
|
+
declare function evaluateOutcome(page: Page, options: {
|
|
48
|
+
expectAny?: Condition[];
|
|
49
|
+
expectAll?: Condition[];
|
|
50
|
+
failIf?: Condition[];
|
|
51
|
+
dangerous?: boolean;
|
|
52
|
+
networkTracker?: NetworkResponseTracker;
|
|
53
|
+
beforeSignature?: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
outcomeStatus: OutcomeStatus;
|
|
56
|
+
matchedConditions: MatchedCondition[];
|
|
57
|
+
retrySafe: boolean;
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Condition combinators for multi-path waits
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
interface CombinatorResult {
|
|
65
|
+
matched: boolean;
|
|
66
|
+
matchedConditions: MatchedCondition[];
|
|
67
|
+
/** Which path won (for race/any) */
|
|
68
|
+
winnerIndex?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* any() — succeeds if ANY condition matches
|
|
72
|
+
*/
|
|
73
|
+
declare function conditionAny(conditions: Condition[], page: Page, context?: {
|
|
74
|
+
networkTracker?: NetworkResponseTracker;
|
|
75
|
+
beforeSignature?: string;
|
|
76
|
+
}): Promise<CombinatorResult>;
|
|
77
|
+
/**
|
|
78
|
+
* all() — succeeds only if ALL conditions match
|
|
79
|
+
*/
|
|
80
|
+
declare function conditionAll(conditions: Condition[], page: Page, context?: {
|
|
81
|
+
networkTracker?: NetworkResponseTracker;
|
|
82
|
+
beforeSignature?: string;
|
|
83
|
+
}): Promise<CombinatorResult>;
|
|
84
|
+
/**
|
|
85
|
+
* not() — inverts a single condition
|
|
86
|
+
*/
|
|
87
|
+
declare function conditionNot(condition: Condition, page: Page, context?: {
|
|
88
|
+
networkTracker?: NetworkResponseTracker;
|
|
89
|
+
beforeSignature?: string;
|
|
90
|
+
}): Promise<CombinatorResult>;
|
|
91
|
+
/**
|
|
92
|
+
* race() — evaluates conditions with polling until one matches or timeout.
|
|
93
|
+
* Returns the first condition to match.
|
|
94
|
+
*/
|
|
95
|
+
declare function conditionRace(conditions: Condition[], page: Page, options?: {
|
|
96
|
+
timeout?: number;
|
|
97
|
+
pollInterval?: number;
|
|
98
|
+
networkTracker?: NetworkResponseTracker;
|
|
99
|
+
beforeSignature?: string;
|
|
100
|
+
}): Promise<CombinatorResult>;
|
|
4
101
|
|
|
5
102
|
/**
|
|
6
103
|
* Batch action executor
|
|
@@ -67,4 +164,4 @@ interface ValidationResult {
|
|
|
67
164
|
}
|
|
68
165
|
declare function validateSteps(steps: unknown[]): ValidationResult;
|
|
69
166
|
|
|
70
|
-
export { BatchExecutor, BatchOptions, BatchResult, Step, type ValidationError, type ValidationResult, addBatchToPage, validateSteps };
|
|
167
|
+
export { BatchExecutor, BatchOptions, BatchResult, type CombinatorResult, Condition, MatchedCondition, NetworkResponseTracker, OutcomeStatus, Step, type ValidationError, type ValidationResult, addBatchToPage, captureStateSignature, conditionAll, conditionAny, conditionNot, conditionRace, evaluateCondition, evaluateOutcome, validateSteps };
|
package/dist/actions.mjs
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BatchExecutor,
|
|
3
|
+
NetworkResponseTracker,
|
|
3
4
|
addBatchToPage,
|
|
5
|
+
captureStateSignature,
|
|
6
|
+
conditionAll,
|
|
7
|
+
conditionAny,
|
|
8
|
+
conditionNot,
|
|
9
|
+
conditionRace,
|
|
10
|
+
evaluateCondition,
|
|
11
|
+
evaluateOutcome,
|
|
4
12
|
validateSteps
|
|
5
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZDODXEBD.mjs";
|
|
6
14
|
import "./chunk-JXAUPHZM.mjs";
|
|
7
15
|
export {
|
|
8
16
|
BatchExecutor,
|
|
17
|
+
NetworkResponseTracker,
|
|
9
18
|
addBatchToPage,
|
|
19
|
+
captureStateSignature,
|
|
20
|
+
conditionAll,
|
|
21
|
+
conditionAny,
|
|
22
|
+
conditionNot,
|
|
23
|
+
conditionRace,
|
|
24
|
+
evaluateCondition,
|
|
25
|
+
evaluateOutcome,
|
|
10
26
|
validateSteps
|
|
11
27
|
};
|