constants.ts
1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
* Validation node-specific configuration constants.
* These are static values specific to the validation orchestration logic.
* Not global - scoped to validation node only.
*/
/**
* Target MAE (Mean Absolute Error) in pixels.
*
* Maximum acceptable average position error across all elements.
*/
export const TARGET_MAE = 3;
/**
* Position error threshold in pixels.
*
* - Elements with error <= this value are classified as "accurate"
* - Elements with error > this value are classified as "misaligned"
*/
export const POSITION_THRESHOLD = 1.0;
/**
* Default timeout for browser operations in milliseconds.
*
* Used by Playwright for page navigation and rendering.
*/
export const DEFAULT_TIMEOUT = 30000;
/**
* Number of decimal places for rounding metric values.
*/
export const METRIC_DECIMAL_PLACES = 2;
/**
* Default viewport size for browser rendering.
*/
export const DEFAULT_VIEWPORT = { width: 1440, height: 900 };
/**
* Maximum number of validation-correction iterations for the judger-refiner loop.
*/
export const MAX_ITERATIONS = 3;
/**
* Run browser in headless mode.
*/
export const HEADLESS = true;
/**
* Timeout for optional selector waiting in milliseconds (5 seconds)
*/
export const SELECTOR_WAIT_TIMEOUT = 5000;
/**
* Default validation loop configuration.
*
* Used when no custom config is provided to validationLoop().
*/
export const DEFAULT_VALIDATION_LOOP_CONFIG = {
maxIterations: MAX_ITERATIONS,
targetMae: TARGET_MAE,
positionThreshold: POSITION_THRESHOLD,
browserTimeout: DEFAULT_TIMEOUT,
defaultViewportWidth: DEFAULT_VIEWPORT.width,
defaultViewportHeight: DEFAULT_VIEWPORT.height,
headless: HEADLESS,
};
/**
* Dev server constants used by validation/launch tooling.
*/
export const DEFAULT_PORT = 5173;
/**
* Builds the default dev server URL from a port number.
*/
export function buildDevServerUrl(port: number): string {
return `http://localhost:${port}`;
}