@qontinui/ui-bridge 0.1.1 → 0.2.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.
Files changed (43) hide show
  1. package/dist/ai/index.d.mts +893 -0
  2. package/dist/ai/index.d.ts +893 -0
  3. package/dist/ai/index.js +3897 -0
  4. package/dist/ai/index.js.map +1 -0
  5. package/dist/ai/index.mjs +3839 -0
  6. package/dist/ai/index.mjs.map +1 -0
  7. package/dist/control/index.d.mts +5 -4
  8. package/dist/control/index.d.ts +5 -4
  9. package/dist/core/index.d.mts +6 -4
  10. package/dist/core/index.d.ts +6 -4
  11. package/dist/core/index.js +581 -4
  12. package/dist/core/index.js.map +1 -1
  13. package/dist/core/index.mjs +581 -4
  14. package/dist/core/index.mjs.map +1 -1
  15. package/dist/debug/index.d.mts +3 -3
  16. package/dist/debug/index.d.ts +3 -3
  17. package/dist/index.d.mts +7 -5
  18. package/dist/index.d.ts +7 -5
  19. package/dist/index.js +4112 -12
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +4056 -13
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/{metrics-QCnK0EFw.d.ts → metrics-C9XRi_mL.d.ts} +2 -2
  24. package/dist/{metrics-BCG7z7Aq.d.mts → metrics-NC3csD0R.d.mts} +2 -2
  25. package/dist/react/index.d.mts +6 -5
  26. package/dist/react/index.d.ts +6 -5
  27. package/dist/react/index.js +587 -10
  28. package/dist/react/index.js.map +1 -1
  29. package/dist/react/index.mjs +587 -10
  30. package/dist/react/index.mjs.map +1 -1
  31. package/dist/{registry-CT6BVVKr.d.mts → registry-CIEDjbQ9.d.ts} +22 -1
  32. package/dist/{registry-D4mQ01B3.d.ts → registry-SsSDq46X.d.mts} +22 -1
  33. package/dist/render-log/index.d.mts +1 -1
  34. package/dist/render-log/index.d.ts +1 -1
  35. package/dist/types-BvCfFuEV.d.ts +534 -0
  36. package/dist/types-CFT3Dnx4.d.mts +534 -0
  37. package/dist/{types-BpvpStn3.d.mts → types-CPMbN_Iw.d.mts} +8 -0
  38. package/dist/{types-BpvpStn3.d.ts → types-CPMbN_Iw.d.ts} +8 -0
  39. package/dist/{types-DdJD9yw5.d.mts → types-Dr6tH-bm.d.mts} +1 -1
  40. package/dist/{types-BDkXy5si.d.ts → types-oCTrRxSw.d.ts} +1 -1
  41. package/dist/{websocket-client-DupH0X7B.d.ts → websocket-client-CX4QJesI.d.ts} +1 -1
  42. package/dist/{websocket-client-B2LC9CYc.d.mts → websocket-client-C_Na0OSp.d.mts} +1 -1
  43. package/package.json +6 -1
@@ -0,0 +1,893 @@
1
+ import { S as SearchCriteria, n as SearchResponse, o as SearchResult, A as AIDiscoveredElement, P as PageContext, q as SemanticSnapshot, m as ParsedAction, N as NLActionRequest, l as NLActionResponse, b as AIErrorContext, d as AssertionRequest, e as AssertionResult, B as BatchAssertionRequest, g as BatchAssertionResult, p as SemanticDiff, R as RecoverySuggestion } from '../types-BvCfFuEV.js';
2
+ export { a as AIElementRegistrationOptions, c as AIFindResponse, f as AssertionType, E as ElementChange, h as ElementModification, F as FormAnalysis, i as FormFieldAnalysis, j as FormFieldState, k as FormState, M as ModalState } from '../types-BvCfFuEV.js';
3
+ import { l as RegisteredElement, h as ElementState } from '../types-CPMbN_Iw.js';
4
+ import { D as DiscoveredElement, A as ActionExecutor, d as ControlSnapshot } from '../types-oCTrRxSw.js';
5
+
6
+ /**
7
+ * Fuzzy Matcher
8
+ *
9
+ * Provides fuzzy text matching utilities for finding elements by natural language descriptions.
10
+ * Implements multiple matching algorithms with configurable thresholds.
11
+ */
12
+ /**
13
+ * Configuration for fuzzy matching
14
+ */
15
+ interface FuzzyMatchConfig {
16
+ /** Minimum similarity threshold (0-1) */
17
+ threshold: number;
18
+ /** Weight for Levenshtein distance */
19
+ levenshteinWeight: number;
20
+ /** Weight for Jaro-Winkler similarity */
21
+ jaroWinklerWeight: number;
22
+ /** Weight for N-gram matching */
23
+ ngramWeight: number;
24
+ /** N-gram size */
25
+ ngramSize: number;
26
+ /** Case sensitive matching */
27
+ caseSensitive: boolean;
28
+ /** Ignore whitespace differences */
29
+ ignoreWhitespace: boolean;
30
+ }
31
+ /**
32
+ * Default fuzzy match configuration
33
+ */
34
+ declare const DEFAULT_FUZZY_CONFIG: FuzzyMatchConfig;
35
+ /**
36
+ * Result from a fuzzy match operation
37
+ */
38
+ interface FuzzyMatchResult {
39
+ /** Overall similarity score (0-1) */
40
+ similarity: number;
41
+ /** Whether the match passes the threshold */
42
+ isMatch: boolean;
43
+ /** Individual algorithm scores */
44
+ scores: {
45
+ levenshtein: number;
46
+ jaroWinkler: number;
47
+ ngram: number;
48
+ };
49
+ /** Normalized source string */
50
+ normalizedSource: string;
51
+ /** Normalized target string */
52
+ normalizedTarget: string;
53
+ }
54
+ /**
55
+ * Calculate Levenshtein distance between two strings
56
+ */
57
+ declare function levenshteinDistance(s1: string, s2: string): number;
58
+ /**
59
+ * Calculate Levenshtein similarity (0-1)
60
+ */
61
+ declare function levenshteinSimilarity(s1: string, s2: string): number;
62
+ /**
63
+ * Calculate Jaro similarity between two strings
64
+ */
65
+ declare function jaroSimilarity(s1: string, s2: string): number;
66
+ /**
67
+ * Calculate Jaro-Winkler similarity
68
+ * Gives more weight to strings that match from the beginning
69
+ */
70
+ declare function jaroWinklerSimilarity(s1: string, s2: string, prefixScale?: number): number;
71
+ /**
72
+ * Generate N-grams from a string
73
+ */
74
+ declare function generateNgrams(s: string, n: number): Set<string>;
75
+ /**
76
+ * Calculate N-gram similarity (Jaccard coefficient)
77
+ */
78
+ declare function ngramSimilarity(s1: string, s2: string, n?: number): number;
79
+ /**
80
+ * Normalize a string for comparison
81
+ */
82
+ declare function normalizeString(s: string, config?: Partial<FuzzyMatchConfig>): string;
83
+ /**
84
+ * Main fuzzy match function
85
+ * Combines multiple algorithms for robust matching
86
+ */
87
+ declare function fuzzyMatch(source: string, target: string, config?: Partial<FuzzyMatchConfig>): FuzzyMatchResult;
88
+ /**
89
+ * Find the best match from a list of candidates
90
+ */
91
+ declare function findBestMatch(source: string, candidates: string[], config?: Partial<FuzzyMatchConfig>): {
92
+ match: string | null;
93
+ index: number;
94
+ result: FuzzyMatchResult | null;
95
+ };
96
+ /**
97
+ * Find all matches above threshold
98
+ */
99
+ declare function findAllMatches(source: string, candidates: string[], config?: Partial<FuzzyMatchConfig>): Array<{
100
+ candidate: string;
101
+ index: number;
102
+ result: FuzzyMatchResult;
103
+ }>;
104
+ /**
105
+ * Check if source contains target (fuzzy)
106
+ */
107
+ declare function fuzzyContains(source: string, target: string, config?: Partial<FuzzyMatchConfig>): boolean;
108
+ /**
109
+ * Calculate word-level similarity
110
+ * Useful for comparing phrases
111
+ */
112
+ declare function wordSimilarity(s1: string, s2: string, config?: Partial<FuzzyMatchConfig>): number;
113
+ /**
114
+ * Tokenize a string for matching
115
+ * Handles camelCase, PascalCase, snake_case, kebab-case
116
+ */
117
+ declare function tokenize(s: string): string[];
118
+ /**
119
+ * Calculate token-based similarity
120
+ * Better for matching identifiers and labels
121
+ */
122
+ declare function tokenSimilarity(s1: string, s2: string): number;
123
+
124
+ /**
125
+ * Alias Generator
126
+ *
127
+ * Auto-generates element aliases from visible text, aria-label, placeholders,
128
+ * titles, and common synonyms for natural language matching.
129
+ */
130
+ /**
131
+ * Configuration for alias generation
132
+ */
133
+ interface AliasGeneratorConfig {
134
+ /** Include text content as alias */
135
+ includeText: boolean;
136
+ /** Include aria-label as alias */
137
+ includeAriaLabel: boolean;
138
+ /** Include placeholder text as alias */
139
+ includePlaceholder: boolean;
140
+ /** Include title attribute as alias */
141
+ includeTitle: boolean;
142
+ /** Include common synonyms */
143
+ includeSynonyms: boolean;
144
+ /** Maximum number of aliases to generate */
145
+ maxAliases: number;
146
+ /** Minimum alias length */
147
+ minLength: number;
148
+ /** Maximum alias length */
149
+ maxLength: number;
150
+ }
151
+ /**
152
+ * Default alias generator configuration
153
+ */
154
+ declare const DEFAULT_ALIAS_CONFIG: AliasGeneratorConfig;
155
+ /**
156
+ * Interface for element information used in alias generation
157
+ */
158
+ interface AliasGeneratorInput {
159
+ /** Element text content */
160
+ textContent?: string | null;
161
+ /** ARIA label */
162
+ ariaLabel?: string | null;
163
+ /** ARIA labelledby resolved text */
164
+ ariaLabelledBy?: string | null;
165
+ /** Placeholder text */
166
+ placeholder?: string | null;
167
+ /** Title attribute */
168
+ title?: string | null;
169
+ /** Element type */
170
+ elementType?: string;
171
+ /** Element tag name */
172
+ tagName?: string;
173
+ /** Input type */
174
+ inputType?: string;
175
+ /** Element ID */
176
+ id?: string | null;
177
+ /** Element name attribute */
178
+ name?: string | null;
179
+ /** Associated label text */
180
+ labelText?: string | null;
181
+ /** Value attribute */
182
+ value?: string | null;
183
+ }
184
+ /**
185
+ * Generate aliases for an element
186
+ */
187
+ declare function generateAliases(input: AliasGeneratorInput, config?: Partial<AliasGeneratorConfig>): string[];
188
+ /**
189
+ * Generate a human-readable description for an element
190
+ */
191
+ declare function generateDescription(input: AliasGeneratorInput): string;
192
+ /**
193
+ * Generate a purpose statement for an element
194
+ */
195
+ declare function generatePurpose(input: AliasGeneratorInput): string | undefined;
196
+ /**
197
+ * Generate suggested actions for an element
198
+ */
199
+ declare function generateSuggestedActions(input: AliasGeneratorInput): string[];
200
+ /**
201
+ * Get synonyms for a word
202
+ */
203
+ declare function getSynonyms(word: string): string[];
204
+ /**
205
+ * Check if two words are synonyms
206
+ */
207
+ declare function areSynonyms(word1: string, word2: string): boolean;
208
+
209
+ /**
210
+ * Search Engine
211
+ *
212
+ * Multi-strategy element search using text, role, accessibility,
213
+ * spatial proximity, and fuzzy matching.
214
+ */
215
+
216
+ /**
217
+ * Configuration for the search engine
218
+ */
219
+ interface SearchEngineConfig {
220
+ /** Default fuzzy threshold */
221
+ fuzzyThreshold: number;
222
+ /** Weight for text matching */
223
+ textWeight: number;
224
+ /** Weight for accessibility matching */
225
+ accessibilityWeight: number;
226
+ /** Weight for role matching */
227
+ roleWeight: number;
228
+ /** Weight for spatial matching */
229
+ spatialWeight: number;
230
+ /** Weight for alias matching */
231
+ aliasWeight: number;
232
+ /** Maximum results to return */
233
+ maxResults: number;
234
+ /** Include hidden elements */
235
+ includeHidden: boolean;
236
+ }
237
+ /**
238
+ * Default search engine configuration
239
+ */
240
+ declare const DEFAULT_SEARCH_CONFIG: SearchEngineConfig;
241
+ /**
242
+ * Search Engine class
243
+ */
244
+ declare class SearchEngine {
245
+ private config;
246
+ private cachedElements;
247
+ private cacheTimestamp;
248
+ private readonly cacheValidityMs;
249
+ constructor(config?: Partial<SearchEngineConfig>);
250
+ /**
251
+ * Update cached elements from various sources
252
+ */
253
+ updateElements(elements: Array<DiscoveredElement | RegisteredElement>, getState?: (el: RegisteredElement) => ElementState): void;
254
+ /**
255
+ * Convert an element to searchable format
256
+ */
257
+ private toSearchable;
258
+ /**
259
+ * Search for elements matching the criteria
260
+ */
261
+ search(criteria: SearchCriteria, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResponse;
262
+ /**
263
+ * Find the best matching element
264
+ */
265
+ findBest(criteria: SearchCriteria, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResult | null;
266
+ /**
267
+ * Find elements by text content
268
+ */
269
+ findByText(text: string, fuzzy?: boolean, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResult[];
270
+ /**
271
+ * Find elements by role
272
+ */
273
+ findByRole(role: string, name?: string, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResult[];
274
+ /**
275
+ * Find elements by accessible name
276
+ */
277
+ findByAccessibleName(name: string, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResult[];
278
+ /**
279
+ * Find elements near another element
280
+ */
281
+ findNear(referenceId: string, criteria?: SearchCriteria, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResult[];
282
+ /**
283
+ * Find elements within a container
284
+ */
285
+ findWithin(containerId: string, criteria?: SearchCriteria, elements?: Array<DiscoveredElement | RegisteredElement>): SearchResult[];
286
+ /**
287
+ * Score an element against search criteria
288
+ */
289
+ private scoreElement;
290
+ /**
291
+ * Score text match
292
+ */
293
+ private scoreTextMatch;
294
+ /**
295
+ * Score contains match
296
+ */
297
+ private scoreContainsMatch;
298
+ /**
299
+ * Score accessibility match
300
+ */
301
+ private scoreAccessibilityMatch;
302
+ /**
303
+ * Score role match
304
+ */
305
+ private scoreRoleMatch;
306
+ /**
307
+ * Score spatial match (proximity to another element)
308
+ */
309
+ private scoreSpatialMatch;
310
+ /**
311
+ * Calculate distance between two element rectangles
312
+ */
313
+ private calculateDistance;
314
+ /**
315
+ * Score alias match
316
+ */
317
+ private scoreAliasMatch;
318
+ /**
319
+ * Match a string against a pattern (supports * wildcard)
320
+ */
321
+ private matchPattern;
322
+ /**
323
+ * Convert searchable element to AI discovered element
324
+ */
325
+ private toAIDiscoveredElement;
326
+ /**
327
+ * Infer a semantic type for the element
328
+ */
329
+ private inferSemanticType;
330
+ }
331
+ /**
332
+ * Create a default search engine instance
333
+ */
334
+ declare function createSearchEngine(config?: Partial<SearchEngineConfig>): SearchEngine;
335
+
336
+ /**
337
+ * Summary Generator
338
+ *
339
+ * Generates LLM-friendly text summaries of pages and elements
340
+ * for AI agents to understand the current UI state.
341
+ */
342
+
343
+ /**
344
+ * Configuration for summary generation
345
+ */
346
+ interface SummaryConfig {
347
+ /** Maximum summary length in characters */
348
+ maxLength: number;
349
+ /** Include form details */
350
+ includeForms: boolean;
351
+ /** Include element counts */
352
+ includeElementCounts: boolean;
353
+ /** Include active modals */
354
+ includeModals: boolean;
355
+ /** Include focused element */
356
+ includeFocused: boolean;
357
+ /** Verbosity level */
358
+ verbosity: 'brief' | 'normal' | 'detailed';
359
+ }
360
+ /**
361
+ * Generate a page summary from elements
362
+ */
363
+ declare function generatePageSummary(elements: AIDiscoveredElement[], pageContext?: Partial<PageContext>, config?: Partial<SummaryConfig>): string;
364
+ /**
365
+ * Generate an element description
366
+ */
367
+ declare function generateElementDescription(element: AIDiscoveredElement): string;
368
+ /**
369
+ * Generate a snapshot summary
370
+ */
371
+ declare function generateSnapshotSummary(snapshot: SemanticSnapshot, config?: Partial<SummaryConfig>): string;
372
+ /**
373
+ * Generate diff summary
374
+ */
375
+ declare function generateDiffSummary(appeared: string[], disappeared: string[], modified: Array<{
376
+ description: string;
377
+ property: string;
378
+ from: string;
379
+ to: string;
380
+ }>): string;
381
+ /**
382
+ * Infer page type from URL and elements
383
+ */
384
+ declare function inferPageType(url: string, title: string, elements: AIDiscoveredElement[]): PageContext['pageType'];
385
+
386
+ /**
387
+ * Natural Language Action Parser
388
+ *
389
+ * Parses natural language instructions into structured action requests.
390
+ * Handles patterns like "click the Submit button" or "type 'hello' in the search box".
391
+ */
392
+
393
+ /**
394
+ * Parse a natural language instruction into a structured action
395
+ */
396
+ declare function parseNLInstruction(instruction: string): ParsedAction | null;
397
+ /**
398
+ * Parse multiple instructions
399
+ */
400
+ declare function parseNLInstructions(instructions: string[]): ParsedAction[];
401
+ /**
402
+ * Split a complex instruction into simple ones
403
+ * e.g., "click Login and type 'admin' in username" -> ["click Login", "type 'admin' in username"]
404
+ */
405
+ declare function splitCompoundInstruction(instruction: string): string[];
406
+ /**
407
+ * Extract modifiers from instruction
408
+ */
409
+ declare function extractModifiers(instruction: string): ParsedAction['modifiers'];
410
+ /**
411
+ * Validate a parsed action
412
+ */
413
+ declare function validateParsedAction(action: ParsedAction): {
414
+ valid: boolean;
415
+ errors: string[];
416
+ };
417
+ /**
418
+ * Generate a human-readable description of a parsed action
419
+ */
420
+ declare function describeAction(action: ParsedAction): string;
421
+
422
+ /**
423
+ * Natural Language Action Executor
424
+ *
425
+ * Executes parsed natural language actions by searching for elements
426
+ * and performing the requested actions with confidence scoring.
427
+ */
428
+
429
+ /**
430
+ * Configuration for the NL action executor
431
+ */
432
+ interface NLActionExecutorConfig {
433
+ /** Default confidence threshold for element matching */
434
+ defaultConfidenceThreshold: number;
435
+ /** Default timeout for actions */
436
+ defaultTimeout: number;
437
+ /** Maximum alternatives to return on failure */
438
+ maxAlternatives: number;
439
+ /** Search engine configuration */
440
+ searchConfig?: Partial<SearchEngineConfig>;
441
+ /** Enable verbose logging */
442
+ verbose: boolean;
443
+ }
444
+ /**
445
+ * Default executor configuration
446
+ */
447
+ declare const DEFAULT_EXECUTOR_CONFIG: NLActionExecutorConfig;
448
+ /**
449
+ * Natural Language Action Executor
450
+ */
451
+ declare class NLActionExecutor {
452
+ private config;
453
+ private searchEngine;
454
+ private actionExecutor;
455
+ private elements;
456
+ constructor(config?: Partial<NLActionExecutorConfig>);
457
+ /**
458
+ * Set the action executor for performing DOM actions
459
+ */
460
+ setActionExecutor(executor: ActionExecutor): void;
461
+ /**
462
+ * Update available elements for search
463
+ */
464
+ updateElements(elements: Array<DiscoveredElement | RegisteredElement>): void;
465
+ /**
466
+ * Execute a natural language instruction
467
+ */
468
+ execute(request: NLActionRequest): Promise<NLActionResponse>;
469
+ /**
470
+ * Execute a parsed action directly (skip parsing)
471
+ */
472
+ executeParsed(parsed: ParsedAction, threshold?: number): Promise<NLActionResponse>;
473
+ /**
474
+ * Build search criteria from a parsed action
475
+ */
476
+ private buildSearchCriteria;
477
+ /**
478
+ * Perform the actual action on an element
479
+ */
480
+ private performAction;
481
+ /**
482
+ * Create a failure response with suggestions
483
+ */
484
+ private createFailureResponse;
485
+ /**
486
+ * Generate recovery suggestions
487
+ */
488
+ private generateSuggestions;
489
+ /**
490
+ * Get rich error context for debugging
491
+ */
492
+ getErrorContext(errorCode: string, instruction: string, searchCriteria?: SearchCriteria, nearestMatch?: SearchResult): AIErrorContext;
493
+ }
494
+ /**
495
+ * Create a default NL action executor
496
+ */
497
+ declare function createNLActionExecutor(config?: Partial<NLActionExecutorConfig>): NLActionExecutor;
498
+
499
+ /**
500
+ * Assertions Module
501
+ *
502
+ * Provides verification/assertion API for AI agents to validate
503
+ * page state without writing Playwright tests.
504
+ */
505
+
506
+ /**
507
+ * Configuration for assertions
508
+ */
509
+ interface AssertionConfig {
510
+ /** Default timeout for wait-based assertions */
511
+ defaultTimeout: number;
512
+ /** Polling interval for wait-based assertions */
513
+ pollInterval: number;
514
+ /** Default fuzzy threshold for element search */
515
+ fuzzyThreshold: number;
516
+ /** Include suggestions in failure messages */
517
+ includeSuggestions: boolean;
518
+ }
519
+ /**
520
+ * Default assertion configuration
521
+ */
522
+ declare const DEFAULT_ASSERTION_CONFIG: AssertionConfig;
523
+ /**
524
+ * Assertion executor class
525
+ */
526
+ declare class AssertionExecutor {
527
+ private config;
528
+ private searchEngine;
529
+ private elements;
530
+ constructor(config?: Partial<AssertionConfig>);
531
+ /**
532
+ * Update available elements for assertions
533
+ */
534
+ updateElements(elements: Array<DiscoveredElement | AIDiscoveredElement>): void;
535
+ /**
536
+ * Execute a single assertion
537
+ */
538
+ assert(request: AssertionRequest): Promise<AssertionResult>;
539
+ /**
540
+ * Execute multiple assertions
541
+ */
542
+ assertBatch(request: BatchAssertionRequest): Promise<BatchAssertionResult>;
543
+ /**
544
+ * Convenience method: assert element is visible
545
+ */
546
+ assertVisible(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
547
+ /**
548
+ * Convenience method: assert element is hidden
549
+ */
550
+ assertHidden(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
551
+ /**
552
+ * Convenience method: assert element is enabled
553
+ */
554
+ assertEnabled(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
555
+ /**
556
+ * Convenience method: assert element is disabled
557
+ */
558
+ assertDisabled(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
559
+ /**
560
+ * Convenience method: assert element has text
561
+ */
562
+ assertHasText(target: string | SearchCriteria, text: string, timeout?: number): Promise<AssertionResult>;
563
+ /**
564
+ * Convenience method: assert element contains text
565
+ */
566
+ assertContainsText(target: string | SearchCriteria, text: string, timeout?: number): Promise<AssertionResult>;
567
+ /**
568
+ * Convenience method: assert element has value
569
+ */
570
+ assertHasValue(target: string | SearchCriteria, value: string, timeout?: number): Promise<AssertionResult>;
571
+ /**
572
+ * Convenience method: assert element exists
573
+ */
574
+ assertExists(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
575
+ /**
576
+ * Convenience method: assert element does not exist
577
+ */
578
+ assertNotExists(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
579
+ /**
580
+ * Convenience method: assert checkbox is checked
581
+ */
582
+ assertChecked(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
583
+ /**
584
+ * Convenience method: assert checkbox is unchecked
585
+ */
586
+ assertUnchecked(target: string | SearchCriteria, timeout?: number): Promise<AssertionResult>;
587
+ /**
588
+ * Convenience method: assert element count
589
+ */
590
+ assertCount(target: SearchCriteria, expectedCount: number, timeout?: number): Promise<AssertionResult>;
591
+ /**
592
+ * Find element by target (string or criteria)
593
+ */
594
+ private findElement;
595
+ /**
596
+ * Execute the actual assertion
597
+ */
598
+ private executeAssertion;
599
+ /**
600
+ * Assert visibility state
601
+ */
602
+ private assertVisibility;
603
+ /**
604
+ * Assert enabled state
605
+ */
606
+ private assertEnabledState;
607
+ /**
608
+ * Assert focused state
609
+ */
610
+ private assertFocused;
611
+ /**
612
+ * Assert checked state
613
+ */
614
+ private assertCheckedState;
615
+ /**
616
+ * Assert text content
617
+ */
618
+ private assertTextMatch;
619
+ /**
620
+ * Assert input value
621
+ */
622
+ private assertValue;
623
+ /**
624
+ * Assert element count
625
+ */
626
+ private assertElementCount;
627
+ /**
628
+ * Assert attribute value (placeholder for DOM attribute assertions)
629
+ */
630
+ private assertAttribute;
631
+ /**
632
+ * Assert element has CSS class
633
+ */
634
+ private assertHasClass;
635
+ /**
636
+ * Assert CSS property value
637
+ */
638
+ private assertCssProperty;
639
+ /**
640
+ * Create an assertion result
641
+ */
642
+ private createResult;
643
+ }
644
+ /**
645
+ * Create a default assertion executor
646
+ */
647
+ declare function createAssertionExecutor(config?: Partial<AssertionConfig>): AssertionExecutor;
648
+
649
+ /**
650
+ * Semantic Snapshot
651
+ *
652
+ * Creates enhanced state snapshots with AI-friendly element descriptions,
653
+ * form analysis, and modal detection.
654
+ */
655
+
656
+ /**
657
+ * Configuration for semantic snapshots
658
+ */
659
+ interface SemanticSnapshotConfig {
660
+ /** Include form analysis */
661
+ analyzeForms: boolean;
662
+ /** Include modal detection */
663
+ detectModals: boolean;
664
+ /** Include page type inference */
665
+ inferPageType: boolean;
666
+ /** Generate element descriptions */
667
+ generateDescriptions: boolean;
668
+ /** Maximum elements to include */
669
+ maxElements: number;
670
+ }
671
+ /**
672
+ * Default snapshot configuration
673
+ */
674
+ declare const DEFAULT_SNAPSHOT_CONFIG: SemanticSnapshotConfig;
675
+ /**
676
+ * Semantic Snapshot Manager
677
+ */
678
+ declare class SemanticSnapshotManager {
679
+ private config;
680
+ private searchEngine;
681
+ private history;
682
+ private readonly maxHistorySize;
683
+ private snapshotCounter;
684
+ constructor(config?: Partial<SemanticSnapshotConfig>);
685
+ /**
686
+ * Create a semantic snapshot from a control snapshot
687
+ */
688
+ createSnapshot(controlSnapshot: ControlSnapshot, pageContext?: Partial<PageContext>): SemanticSnapshot;
689
+ /**
690
+ * Get the last snapshot
691
+ */
692
+ getLastSnapshot(): SemanticSnapshot | null;
693
+ /**
694
+ * Get snapshot by ID
695
+ */
696
+ getSnapshot(snapshotId: string): SemanticSnapshot | null;
697
+ /**
698
+ * Get snapshot history
699
+ */
700
+ getHistory(): SemanticSnapshot[];
701
+ /**
702
+ * Clear history
703
+ */
704
+ clearHistory(): void;
705
+ /**
706
+ * Convert control snapshot elements to AI elements
707
+ */
708
+ private convertElements;
709
+ /**
710
+ * Convert a single element to AI element
711
+ */
712
+ private convertElement;
713
+ /**
714
+ * Build full page context
715
+ */
716
+ private buildPageContext;
717
+ /**
718
+ * Analyze forms in the snapshot
719
+ */
720
+ private analyzeForms;
721
+ /**
722
+ * Detect implicit form from inputs
723
+ */
724
+ private detectImplicitForm;
725
+ /**
726
+ * Analyze a specific form
727
+ */
728
+ private analyzeForm;
729
+ /**
730
+ * Analyze form fields
731
+ */
732
+ private analyzeFormFields;
733
+ /**
734
+ * Detect modal dialogs
735
+ */
736
+ private detectModals;
737
+ /**
738
+ * Infer modal type
739
+ */
740
+ private inferModalType;
741
+ /**
742
+ * Count elements by type
743
+ */
744
+ private countElementTypes;
745
+ /**
746
+ * Infer form purpose from fields
747
+ */
748
+ private inferFormPurpose;
749
+ /**
750
+ * Infer tag name from element type
751
+ */
752
+ private inferTagName;
753
+ /**
754
+ * Infer ARIA role from element type
755
+ */
756
+ private inferRole;
757
+ /**
758
+ * Infer semantic type
759
+ */
760
+ private inferSemanticType;
761
+ /**
762
+ * Add snapshot to history
763
+ */
764
+ private addToHistory;
765
+ }
766
+ /**
767
+ * Create a semantic snapshot manager
768
+ */
769
+ declare function createSnapshotManager(config?: Partial<SemanticSnapshotConfig>): SemanticSnapshotManager;
770
+
771
+ /**
772
+ * Semantic Diff
773
+ *
774
+ * Tracks and describes semantic changes between snapshots
775
+ * with LLM-friendly summaries and suggested actions.
776
+ */
777
+
778
+ /**
779
+ * Configuration for semantic diff
780
+ */
781
+ interface SemanticDiffConfig {
782
+ /** Ignore insignificant changes */
783
+ ignoreInsignificant: boolean;
784
+ /** Properties to track for modifications */
785
+ trackedProperties: string[];
786
+ /** Generate suggested actions */
787
+ generateSuggestions: boolean;
788
+ /** Maximum modifications to report */
789
+ maxModifications: number;
790
+ }
791
+ /**
792
+ * Default diff configuration
793
+ */
794
+ declare const DEFAULT_DIFF_CONFIG: SemanticDiffConfig;
795
+ /**
796
+ * Compute semantic diff between two snapshots
797
+ */
798
+ declare function computeDiff(fromSnapshot: SemanticSnapshot, toSnapshot: SemanticSnapshot, config?: Partial<SemanticDiffConfig>): SemanticDiff;
799
+ /**
800
+ * Create a diff manager for tracking changes over time
801
+ */
802
+ declare class SemanticDiffManager {
803
+ private config;
804
+ private lastSnapshot;
805
+ constructor(config?: Partial<SemanticDiffConfig>);
806
+ /**
807
+ * Update with new snapshot and get diff
808
+ */
809
+ update(newSnapshot: SemanticSnapshot): SemanticDiff | null;
810
+ /**
811
+ * Get diff from a specific snapshot to current
812
+ */
813
+ diffFrom(fromSnapshot: SemanticSnapshot): SemanticDiff | null;
814
+ /**
815
+ * Reset the manager
816
+ */
817
+ reset(): void;
818
+ /**
819
+ * Get the last known snapshot
820
+ */
821
+ getLastSnapshot(): SemanticSnapshot | null;
822
+ }
823
+ /**
824
+ * Create a semantic diff manager
825
+ */
826
+ declare function createDiffManager(config?: Partial<SemanticDiffConfig>): SemanticDiffManager;
827
+ /**
828
+ * Utility: Check if any significant changes occurred
829
+ */
830
+ declare function hasSignificantChanges(diff: SemanticDiff): boolean;
831
+ /**
832
+ * Utility: Get a brief description of what changed
833
+ */
834
+ declare function describeDiff(diff: SemanticDiff): string;
835
+
836
+ /**
837
+ * Error Context
838
+ *
839
+ * Creates rich error context for AI agents to understand and recover
840
+ * from failures during UI automation.
841
+ */
842
+
843
+ /**
844
+ * Any element type that can be used with error context
845
+ */
846
+ type AnyElement = DiscoveredElement | AIDiscoveredElement | RegisteredElement;
847
+ /**
848
+ * Standard error codes
849
+ */
850
+ declare const ErrorCodes: {
851
+ readonly PARSE_ERROR: "PARSE_ERROR";
852
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
853
+ readonly ELEMENT_NOT_FOUND: "ELEMENT_NOT_FOUND";
854
+ readonly ELEMENT_NOT_VISIBLE: "ELEMENT_NOT_VISIBLE";
855
+ readonly ELEMENT_DISABLED: "ELEMENT_DISABLED";
856
+ readonly ELEMENT_BLOCKED: "ELEMENT_BLOCKED";
857
+ readonly MULTIPLE_ELEMENTS: "MULTIPLE_ELEMENTS";
858
+ readonly LOW_CONFIDENCE: "LOW_CONFIDENCE";
859
+ readonly AMBIGUOUS_MATCH: "AMBIGUOUS_MATCH";
860
+ readonly ACTION_FAILED: "ACTION_FAILED";
861
+ readonly ACTION_TIMEOUT: "ACTION_TIMEOUT";
862
+ readonly UNSUPPORTED_ACTION: "UNSUPPORTED_ACTION";
863
+ readonly UNEXPECTED_STATE: "UNEXPECTED_STATE";
864
+ readonly STALE_ELEMENT: "STALE_ELEMENT";
865
+ readonly PAGE_LOAD_ERROR: "PAGE_LOAD_ERROR";
866
+ readonly NAVIGATION_ERROR: "NAVIGATION_ERROR";
867
+ };
868
+ type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
869
+ /**
870
+ * Create a rich error context
871
+ */
872
+ declare function createErrorContext(errorCode: ErrorCode, attemptedAction: string, availableElements: AnyElement[], searchCriteria?: SearchCriteria, nearestMatch?: SearchResult): AIErrorContext;
873
+ /**
874
+ * Format error context for display
875
+ */
876
+ declare function formatErrorContext(context: AIErrorContext): string;
877
+ /**
878
+ * Create a simple error response
879
+ */
880
+ declare function createSimpleError(code: ErrorCode, message?: string): {
881
+ code: string;
882
+ message: string;
883
+ };
884
+ /**
885
+ * Check if an error is recoverable
886
+ */
887
+ declare function isRecoverableError(code: ErrorCode): boolean;
888
+ /**
889
+ * Get the best recovery suggestion for an error
890
+ */
891
+ declare function getBestRecoverySuggestion(context: AIErrorContext): RecoverySuggestion | null;
892
+
893
+ export { AIDiscoveredElement, AIErrorContext, type AliasGeneratorConfig, type AliasGeneratorInput, type AssertionConfig, AssertionExecutor, AssertionRequest, AssertionResult, BatchAssertionRequest, BatchAssertionResult, DEFAULT_ALIAS_CONFIG, DEFAULT_ASSERTION_CONFIG, DEFAULT_DIFF_CONFIG, DEFAULT_EXECUTOR_CONFIG, DEFAULT_FUZZY_CONFIG, DEFAULT_SEARCH_CONFIG, DEFAULT_SNAPSHOT_CONFIG, type ErrorCode, ErrorCodes, type FuzzyMatchConfig, type FuzzyMatchResult, NLActionExecutor, type NLActionExecutorConfig, NLActionRequest, NLActionResponse, PageContext, ParsedAction, RecoverySuggestion, SearchCriteria, SearchEngine, type SearchEngineConfig, SearchResponse, SearchResult, SemanticDiff, type SemanticDiffConfig, SemanticDiffManager, SemanticSnapshot, type SemanticSnapshotConfig, SemanticSnapshotManager, type SummaryConfig, areSynonyms, computeDiff, createAssertionExecutor, createDiffManager, createErrorContext, createNLActionExecutor, createSearchEngine, createSimpleError, createSnapshotManager, describeAction, describeDiff, extractModifiers, findAllMatches, findBestMatch, formatErrorContext, fuzzyContains, fuzzyMatch, generateAliases, generateDescription, generateDiffSummary, generateElementDescription, generateNgrams, generatePageSummary, generatePurpose, generateSnapshotSummary, generateSuggestedActions, getBestRecoverySuggestion, getSynonyms, hasSignificantChanges, inferPageType, isRecoverableError, jaroSimilarity, jaroWinklerSimilarity, levenshteinDistance, levenshteinSimilarity, ngramSimilarity, normalizeString, parseNLInstruction, parseNLInstructions, splitCompoundInstruction, tokenSimilarity, tokenize, validateParsedAction, wordSimilarity };