@qontinui/ui-bridge 0.1.1 → 0.3.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/dist/ai/index.d.mts +893 -0
- package/dist/ai/index.d.ts +893 -0
- package/dist/ai/index.js +3897 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/index.mjs +3839 -0
- package/dist/ai/index.mjs.map +1 -0
- package/dist/babel-plugin/index.js +515 -0
- package/dist/babel-plugin/index.js.map +1 -0
- package/dist/babel-plugin/index.mjs +499 -0
- package/dist/babel-plugin/index.mjs.map +1 -0
- package/dist/control/index.d.mts +5 -4
- package/dist/control/index.d.ts +5 -4
- package/dist/core/index.d.mts +115 -42
- package/dist/core/index.d.ts +115 -42
- package/dist/core/index.js +0 -983
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +1 -972
- package/dist/core/index.mjs.map +1 -1
- package/dist/debug/index.d.mts +3 -3
- package/dist/debug/index.d.ts +3 -3
- package/dist/index.d.mts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +8249 -4163
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8193 -4152
- package/dist/index.mjs.map +1 -1
- package/dist/{metrics-QCnK0EFw.d.ts → metrics-BfiT_rhZ.d.ts} +2 -2
- package/dist/{metrics-BCG7z7Aq.d.mts → metrics-DTA2bwG7.d.mts} +2 -2
- package/dist/native/control/index.js +453 -0
- package/dist/native/control/index.js.map +1 -0
- package/dist/native/control/index.mjs +450 -0
- package/dist/native/control/index.mjs.map +1 -0
- package/dist/native/core/index.js +486 -0
- package/dist/native/core/index.js.map +1 -0
- package/dist/native/core/index.mjs +475 -0
- package/dist/native/core/index.mjs.map +1 -0
- package/dist/native/debug/index.js +451 -0
- package/dist/native/debug/index.js.map +1 -0
- package/dist/native/debug/index.mjs +449 -0
- package/dist/native/debug/index.mjs.map +1 -0
- package/dist/native/index.js +2274 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/index.mjs +2246 -0
- package/dist/native/index.mjs.map +1 -0
- package/dist/native/react/index.js +1401 -0
- package/dist/native/react/index.js.map +1 -0
- package/dist/native/react/index.mjs +1389 -0
- package/dist/native/react/index.mjs.map +1 -0
- package/dist/native/server/index.js +415 -0
- package/dist/native/server/index.js.map +1 -0
- package/dist/native/server/index.mjs +410 -0
- package/dist/native/server/index.mjs.map +1 -0
- package/dist/react/index.d.mts +20 -6
- package/dist/react/index.d.ts +20 -6
- package/dist/react/index.js +629 -14
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +629 -14
- package/dist/react/index.mjs.map +1 -1
- package/dist/{registry-CT6BVVKr.d.mts → registry-BKLEm-yk.d.ts} +29 -14
- package/dist/{registry-D4mQ01B3.d.ts → registry-BmZgyCz8.d.mts} +29 -14
- package/dist/render-log/index.d.mts +1 -1
- package/dist/render-log/index.d.ts +1 -1
- package/dist/server/express.d.mts +36 -0
- package/dist/server/express.d.ts +36 -0
- package/dist/server/express.js +196 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/express.mjs +192 -0
- package/dist/server/express.mjs.map +1 -0
- package/dist/server/handlers.d.mts +93 -0
- package/dist/server/handlers.d.ts +93 -0
- package/dist/server/handlers.js +4278 -0
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/handlers.mjs +4275 -0
- package/dist/server/handlers.mjs.map +1 -0
- package/dist/server/index.d.mts +10 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.js +5352 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +5337 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/nextjs.d.mts +126 -0
- package/dist/server/nextjs.d.ts +126 -0
- package/dist/server/nextjs.js +287 -0
- package/dist/server/nextjs.js.map +1 -0
- package/dist/server/nextjs.mjs +282 -0
- package/dist/server/nextjs.mjs.map +1 -0
- package/dist/server/standalone.d.mts +6 -0
- package/dist/server/standalone.d.ts +6 -0
- package/dist/server/standalone.js +719 -0
- package/dist/server/standalone.js.map +1 -0
- package/dist/server/standalone.mjs +715 -0
- package/dist/server/standalone.mjs.map +1 -0
- package/dist/standalone-BURj8J3G.d.ts +212 -0
- package/dist/standalone-Dwmel29d.d.mts +212 -0
- package/dist/swc-plugin/index.d.mts +79 -0
- package/dist/swc-plugin/index.d.ts +79 -0
- package/dist/swc-plugin/index.js +15 -0
- package/dist/swc-plugin/index.js.map +1 -0
- package/dist/swc-plugin/index.mjs +9 -0
- package/dist/swc-plugin/index.mjs.map +1 -0
- package/dist/types-B5Q0GVo0.d.mts +646 -0
- package/dist/{types-DdJD9yw5.d.mts → types-B7J7noLK.d.mts} +1 -1
- package/dist/{types-BDkXy5si.d.ts → types-BkNRILUa.d.ts} +1 -1
- package/dist/types-CEQLnFMv.d.mts +156 -0
- package/dist/types-CHnlwiTK.d.ts +156 -0
- package/dist/types-DfPqwU-i.d.ts +646 -0
- package/dist/{types-BpvpStn3.d.mts → types-jKVgTI6_.d.mts} +364 -160
- package/dist/{types-BpvpStn3.d.ts → types-jKVgTI6_.d.ts} +364 -160
- package/package.json +111 -3
- package/swc-plugin-wasm/ui_bridge_swc_plugin.wasm +0 -0
- package/dist/websocket-client-B2LC9CYc.d.mts +0 -124
- package/dist/websocket-client-DupH0X7B.d.ts +0 -124
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { r as ElementType, q as ElementState } from './types-jKVgTI6_.js';
|
|
2
|
+
import { D as DiscoveredElement } from './types-BkNRILUa.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* AI Module Types
|
|
6
|
+
*
|
|
7
|
+
* Defines types for AI-native UI Bridge functionality including
|
|
8
|
+
* search criteria, natural language actions, assertions, and semantic snapshots.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Criteria for searching elements using multiple strategies
|
|
13
|
+
*/
|
|
14
|
+
interface SearchCriteria {
|
|
15
|
+
/** Exact visible text match: "Start Extraction" */
|
|
16
|
+
text?: string;
|
|
17
|
+
/** Partial text match: "Start" */
|
|
18
|
+
textContains?: string;
|
|
19
|
+
/** Accessible name (aria-label, associated labels) */
|
|
20
|
+
accessibleName?: string;
|
|
21
|
+
/** ARIA role: "button", "input" */
|
|
22
|
+
role?: string;
|
|
23
|
+
/** Element type (more specific than role) */
|
|
24
|
+
type?: ElementType;
|
|
25
|
+
/** Spatial proximity: "near the URL input" */
|
|
26
|
+
near?: string;
|
|
27
|
+
/** Container context: "within the login form" */
|
|
28
|
+
within?: string;
|
|
29
|
+
/** Enable fuzzy matching (default: true) */
|
|
30
|
+
fuzzy?: boolean;
|
|
31
|
+
/** Fuzzy match confidence threshold 0-1 (default: 0.7) */
|
|
32
|
+
fuzzyThreshold?: number;
|
|
33
|
+
/** Element ID pattern (supports wildcards) */
|
|
34
|
+
idPattern?: string;
|
|
35
|
+
/** CSS selector */
|
|
36
|
+
selector?: string;
|
|
37
|
+
/** Placeholder text (for inputs) */
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/** Title attribute */
|
|
40
|
+
title?: string;
|
|
41
|
+
/** Data attributes to match */
|
|
42
|
+
dataAttributes?: Record<string, string>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Result from a search operation
|
|
46
|
+
*/
|
|
47
|
+
interface SearchResult {
|
|
48
|
+
/** The matched element */
|
|
49
|
+
element: AIDiscoveredElement;
|
|
50
|
+
/** Match confidence 0-1 */
|
|
51
|
+
confidence: number;
|
|
52
|
+
/** Reasons why this element matched */
|
|
53
|
+
matchReasons: string[];
|
|
54
|
+
/** Match scores by strategy */
|
|
55
|
+
scores: {
|
|
56
|
+
text?: number;
|
|
57
|
+
accessibility?: number;
|
|
58
|
+
role?: number;
|
|
59
|
+
spatial?: number;
|
|
60
|
+
fuzzy?: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Response from search operations
|
|
65
|
+
*/
|
|
66
|
+
interface SearchResponse {
|
|
67
|
+
/** All matching results sorted by confidence */
|
|
68
|
+
results: SearchResult[];
|
|
69
|
+
/** Best match (highest confidence above threshold) */
|
|
70
|
+
bestMatch: SearchResult | null;
|
|
71
|
+
/** Total elements scanned */
|
|
72
|
+
scannedCount: number;
|
|
73
|
+
/** Search duration in milliseconds */
|
|
74
|
+
durationMs: number;
|
|
75
|
+
/** Search criteria used */
|
|
76
|
+
criteria: SearchCriteria;
|
|
77
|
+
/** Timestamp */
|
|
78
|
+
timestamp: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Element with AI-generated metadata and descriptions
|
|
82
|
+
*/
|
|
83
|
+
interface AIDiscoveredElement extends DiscoveredElement {
|
|
84
|
+
/** Human-readable description: "Blue submit button in the form" */
|
|
85
|
+
description: string;
|
|
86
|
+
/** Auto-generated aliases for natural language matching */
|
|
87
|
+
aliases: string[];
|
|
88
|
+
/** Inferred purpose: "Submits the form" */
|
|
89
|
+
purpose?: string;
|
|
90
|
+
/** Parent context identifier */
|
|
91
|
+
parentContext?: string;
|
|
92
|
+
/** Suggested actions in natural language */
|
|
93
|
+
suggestedActions: string[];
|
|
94
|
+
/** Semantic type (more descriptive than ElementType) */
|
|
95
|
+
semanticType?: string;
|
|
96
|
+
/** Associated label text */
|
|
97
|
+
labelText?: string;
|
|
98
|
+
/** Placeholder text (for inputs) */
|
|
99
|
+
placeholder?: string;
|
|
100
|
+
/** Title attribute */
|
|
101
|
+
title?: string;
|
|
102
|
+
/** ARIA description */
|
|
103
|
+
ariaDescription?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Response from AI find operations
|
|
107
|
+
*/
|
|
108
|
+
interface AIFindResponse {
|
|
109
|
+
/** All discovered elements with AI metadata */
|
|
110
|
+
elements: AIDiscoveredElement[];
|
|
111
|
+
/** LLM-friendly text summary of the page */
|
|
112
|
+
summary: string;
|
|
113
|
+
/** Detected forms with their fields */
|
|
114
|
+
forms?: FormAnalysis[];
|
|
115
|
+
/** Page context information */
|
|
116
|
+
pageContext: PageContext;
|
|
117
|
+
/** Find duration */
|
|
118
|
+
durationMs: number;
|
|
119
|
+
/** Timestamp */
|
|
120
|
+
timestamp: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Page context information
|
|
124
|
+
*/
|
|
125
|
+
interface PageContext {
|
|
126
|
+
/** Current URL */
|
|
127
|
+
url: string;
|
|
128
|
+
/** Page title */
|
|
129
|
+
title: string;
|
|
130
|
+
/** Inferred page type */
|
|
131
|
+
pageType?: 'login' | 'dashboard' | 'form' | 'list' | 'detail' | 'search' | 'checkout' | 'settings' | 'unknown';
|
|
132
|
+
/** Active modals/dialogs */
|
|
133
|
+
activeModals: string[];
|
|
134
|
+
/** Currently focused element */
|
|
135
|
+
focusedElement?: string;
|
|
136
|
+
/** Detected navigation elements */
|
|
137
|
+
navigation?: string[];
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Form analysis result
|
|
141
|
+
*/
|
|
142
|
+
interface FormAnalysis {
|
|
143
|
+
/** Form element ID */
|
|
144
|
+
id: string;
|
|
145
|
+
/** Form name attribute */
|
|
146
|
+
name?: string;
|
|
147
|
+
/** Detected form purpose */
|
|
148
|
+
purpose?: string;
|
|
149
|
+
/** Form fields */
|
|
150
|
+
fields: FormFieldAnalysis[];
|
|
151
|
+
/** Whether form is valid */
|
|
152
|
+
isValid: boolean;
|
|
153
|
+
/** Submit button ID */
|
|
154
|
+
submitButton?: string;
|
|
155
|
+
/** Cancel/reset button ID */
|
|
156
|
+
cancelButton?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Form field analysis
|
|
160
|
+
*/
|
|
161
|
+
interface FormFieldAnalysis {
|
|
162
|
+
/** Field element ID */
|
|
163
|
+
id: string;
|
|
164
|
+
/** Field label */
|
|
165
|
+
label: string;
|
|
166
|
+
/** Input type */
|
|
167
|
+
type: string;
|
|
168
|
+
/** Current value */
|
|
169
|
+
value: string;
|
|
170
|
+
/** Whether field is valid */
|
|
171
|
+
valid: boolean;
|
|
172
|
+
/** Validation error message */
|
|
173
|
+
error?: string;
|
|
174
|
+
/** Whether field is required */
|
|
175
|
+
required: boolean;
|
|
176
|
+
/** Placeholder text */
|
|
177
|
+
placeholder?: string;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Natural language action request
|
|
181
|
+
*/
|
|
182
|
+
interface NLActionRequest {
|
|
183
|
+
/** Natural language instruction: "click the Start Extraction button" */
|
|
184
|
+
instruction: string;
|
|
185
|
+
/** Optional context to help disambiguate */
|
|
186
|
+
context?: string;
|
|
187
|
+
/** Timeout for the operation */
|
|
188
|
+
timeout?: number;
|
|
189
|
+
/** Confidence threshold for element matching */
|
|
190
|
+
confidenceThreshold?: number;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Parsed action from natural language
|
|
194
|
+
*/
|
|
195
|
+
interface ParsedAction {
|
|
196
|
+
/** Action type */
|
|
197
|
+
action: 'click' | 'type' | 'select' | 'check' | 'uncheck' | 'scroll' | 'wait' | 'assert' | 'hover' | 'focus' | 'clear' | 'doubleClick' | 'rightClick';
|
|
198
|
+
/** Description of the target element */
|
|
199
|
+
targetDescription: string;
|
|
200
|
+
/** Value for type/select actions */
|
|
201
|
+
value?: string;
|
|
202
|
+
/** Key modifiers */
|
|
203
|
+
modifiers?: ('shift' | 'ctrl' | 'alt' | 'meta')[];
|
|
204
|
+
/** Scroll direction for scroll actions */
|
|
205
|
+
scrollDirection?: 'up' | 'down' | 'left' | 'right';
|
|
206
|
+
/** Wait condition for wait actions */
|
|
207
|
+
waitCondition?: string;
|
|
208
|
+
/** Assertion type for assert actions */
|
|
209
|
+
assertionType?: AssertionType;
|
|
210
|
+
/** Raw instruction that was parsed */
|
|
211
|
+
rawInstruction: string;
|
|
212
|
+
/** Parse confidence */
|
|
213
|
+
parseConfidence: number;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Partial match information for structured failures
|
|
217
|
+
*/
|
|
218
|
+
interface PartialMatchInfo {
|
|
219
|
+
/** Element ID */
|
|
220
|
+
elementId: string;
|
|
221
|
+
/** Match confidence 0-1 */
|
|
222
|
+
confidence: number;
|
|
223
|
+
/** Why this element was considered but not selected */
|
|
224
|
+
reason: string;
|
|
225
|
+
/** Element type */
|
|
226
|
+
type: string;
|
|
227
|
+
/** Element description/label */
|
|
228
|
+
description?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Recovery suggestion for structured failures
|
|
232
|
+
*/
|
|
233
|
+
interface RecoverySuggestionInfo {
|
|
234
|
+
/** Human-readable suggestion */
|
|
235
|
+
suggestion: string;
|
|
236
|
+
/** Machine-executable command (if applicable) */
|
|
237
|
+
command?: string;
|
|
238
|
+
/** Confidence that this action will help (0-1) */
|
|
239
|
+
confidence: number;
|
|
240
|
+
/** Whether retry with same parameters might help */
|
|
241
|
+
retryable: boolean;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Structured failure information for NL action responses
|
|
245
|
+
*/
|
|
246
|
+
interface StructuredFailureInfo {
|
|
247
|
+
/** Machine-readable error code */
|
|
248
|
+
errorCode: string;
|
|
249
|
+
/** Human-readable error message */
|
|
250
|
+
message: string;
|
|
251
|
+
/** Target element ID (if known) */
|
|
252
|
+
elementId?: string;
|
|
253
|
+
/** Selectors/strategies that were attempted */
|
|
254
|
+
selectorsTried?: string[];
|
|
255
|
+
/** Similar elements that were found but not used */
|
|
256
|
+
partialMatches?: PartialMatchInfo[];
|
|
257
|
+
/** Current state of the target element (if found) */
|
|
258
|
+
elementState?: ElementState;
|
|
259
|
+
/** Reference to visual context (screenshot path/id) */
|
|
260
|
+
screenshotContext?: string;
|
|
261
|
+
/** Suggested recovery actions */
|
|
262
|
+
suggestedActions?: RecoverySuggestionInfo[];
|
|
263
|
+
/** Whether retry with same parameters might help */
|
|
264
|
+
retryRecommended: boolean;
|
|
265
|
+
/** Additional context data */
|
|
266
|
+
context?: Record<string, unknown>;
|
|
267
|
+
/** Duration before failure in milliseconds */
|
|
268
|
+
durationMs?: number;
|
|
269
|
+
/** Timeout value that was exceeded (for timeout errors) */
|
|
270
|
+
timeoutMs?: number;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Response from executing a natural language action
|
|
274
|
+
*/
|
|
275
|
+
interface NLActionResponse {
|
|
276
|
+
/** Whether the action succeeded */
|
|
277
|
+
success: boolean;
|
|
278
|
+
/** Human-readable description of what was done */
|
|
279
|
+
executedAction: string;
|
|
280
|
+
/** The element that was used */
|
|
281
|
+
elementUsed: AIDiscoveredElement;
|
|
282
|
+
/** Match confidence for the element */
|
|
283
|
+
confidence: number;
|
|
284
|
+
/** Element state after the action */
|
|
285
|
+
elementState: ElementState;
|
|
286
|
+
/** Action duration */
|
|
287
|
+
durationMs: number;
|
|
288
|
+
/** Timestamp */
|
|
289
|
+
timestamp: number;
|
|
290
|
+
/** Error message if failed */
|
|
291
|
+
error?: string;
|
|
292
|
+
/** Error code */
|
|
293
|
+
errorCode?: string;
|
|
294
|
+
/** Suggestions for recovery */
|
|
295
|
+
suggestions?: string[];
|
|
296
|
+
/** Alternative elements that could have been used */
|
|
297
|
+
alternatives?: SearchResult[];
|
|
298
|
+
/** Detailed failure information when success is false */
|
|
299
|
+
failureInfo?: StructuredFailureInfo;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Types of assertions that can be made about elements
|
|
303
|
+
*/
|
|
304
|
+
type AssertionType = 'visible' | 'hidden' | 'enabled' | 'disabled' | 'focused' | 'checked' | 'unchecked' | 'hasText' | 'containsText' | 'hasValue' | 'hasClass' | 'exists' | 'notExists' | 'count' | 'attribute' | 'cssProperty';
|
|
305
|
+
/**
|
|
306
|
+
* Assertion request
|
|
307
|
+
*/
|
|
308
|
+
interface AssertionRequest {
|
|
309
|
+
/** Element target (ID or natural language description) */
|
|
310
|
+
target: string | SearchCriteria;
|
|
311
|
+
/** Type of assertion */
|
|
312
|
+
type: AssertionType;
|
|
313
|
+
/** Expected value (for hasText, hasValue, count, attribute, cssProperty) */
|
|
314
|
+
expected?: unknown;
|
|
315
|
+
/** Attribute name (for attribute assertions) */
|
|
316
|
+
attributeName?: string;
|
|
317
|
+
/** CSS property name (for cssProperty assertions) */
|
|
318
|
+
propertyName?: string;
|
|
319
|
+
/** Timeout for waiting (ms) */
|
|
320
|
+
timeout?: number;
|
|
321
|
+
/** Custom failure message */
|
|
322
|
+
message?: string;
|
|
323
|
+
/** Whether to use fuzzy matching for element search */
|
|
324
|
+
fuzzy?: boolean;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Assertion result
|
|
328
|
+
*/
|
|
329
|
+
interface AssertionResult {
|
|
330
|
+
/** Whether the assertion passed */
|
|
331
|
+
passed: boolean;
|
|
332
|
+
/** Element target that was checked */
|
|
333
|
+
target: string;
|
|
334
|
+
/** Human-readable description of the target */
|
|
335
|
+
targetDescription: string;
|
|
336
|
+
/** Expected value */
|
|
337
|
+
expected: unknown;
|
|
338
|
+
/** Actual value */
|
|
339
|
+
actual: unknown;
|
|
340
|
+
/** Failure reason if assertion failed */
|
|
341
|
+
failureReason?: string;
|
|
342
|
+
/** Suggestion for fixing the failure */
|
|
343
|
+
suggestion?: string;
|
|
344
|
+
/** Element state at time of assertion */
|
|
345
|
+
elementState?: ElementState;
|
|
346
|
+
/** Duration of the assertion */
|
|
347
|
+
durationMs: number;
|
|
348
|
+
/** Timestamp */
|
|
349
|
+
timestamp: number;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Batch assertion request
|
|
353
|
+
*/
|
|
354
|
+
interface BatchAssertionRequest {
|
|
355
|
+
/** Assertions to execute */
|
|
356
|
+
assertions: AssertionRequest[];
|
|
357
|
+
/** Mode: 'all' requires all to pass, 'any' requires at least one */
|
|
358
|
+
mode: 'all' | 'any';
|
|
359
|
+
/** Stop on first failure */
|
|
360
|
+
stopOnFailure?: boolean;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Batch assertion result
|
|
364
|
+
*/
|
|
365
|
+
interface BatchAssertionResult {
|
|
366
|
+
/** Overall pass/fail */
|
|
367
|
+
passed: boolean;
|
|
368
|
+
/** Individual assertion results */
|
|
369
|
+
results: AssertionResult[];
|
|
370
|
+
/** Number of passed assertions */
|
|
371
|
+
passedCount: number;
|
|
372
|
+
/** Number of failed assertions */
|
|
373
|
+
failedCount: number;
|
|
374
|
+
/** Total duration */
|
|
375
|
+
durationMs: number;
|
|
376
|
+
/** Timestamp */
|
|
377
|
+
timestamp: number;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Semantic snapshot of the current page state
|
|
381
|
+
*/
|
|
382
|
+
interface SemanticSnapshot {
|
|
383
|
+
/** Snapshot timestamp */
|
|
384
|
+
timestamp: number;
|
|
385
|
+
/** Snapshot ID for diffing */
|
|
386
|
+
snapshotId: string;
|
|
387
|
+
/** Page information */
|
|
388
|
+
page: PageContext;
|
|
389
|
+
/** All elements with AI metadata */
|
|
390
|
+
elements: AIDiscoveredElement[];
|
|
391
|
+
/** Form states */
|
|
392
|
+
forms: FormState[];
|
|
393
|
+
/** Active modals */
|
|
394
|
+
activeModals: ModalState[];
|
|
395
|
+
/** Currently focused element */
|
|
396
|
+
focusedElement?: string;
|
|
397
|
+
/** LLM-readable summary */
|
|
398
|
+
summary: string;
|
|
399
|
+
/** Element count by type */
|
|
400
|
+
elementCounts: Record<string, number>;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Form state in semantic snapshot
|
|
404
|
+
*/
|
|
405
|
+
interface FormState {
|
|
406
|
+
/** Form ID */
|
|
407
|
+
id: string;
|
|
408
|
+
/** Form name */
|
|
409
|
+
name?: string;
|
|
410
|
+
/** Form purpose */
|
|
411
|
+
purpose?: string;
|
|
412
|
+
/** Field states */
|
|
413
|
+
fields: FormFieldState[];
|
|
414
|
+
/** Overall validity */
|
|
415
|
+
isValid: boolean;
|
|
416
|
+
/** Submit button */
|
|
417
|
+
submitButton?: string;
|
|
418
|
+
/** Whether form is dirty (has changes) */
|
|
419
|
+
isDirty: boolean;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Form field state
|
|
423
|
+
*/
|
|
424
|
+
interface FormFieldState {
|
|
425
|
+
/** Field ID */
|
|
426
|
+
id: string;
|
|
427
|
+
/** Field label */
|
|
428
|
+
label: string;
|
|
429
|
+
/** Input type */
|
|
430
|
+
type: string;
|
|
431
|
+
/** Current value */
|
|
432
|
+
value: string;
|
|
433
|
+
/** Validity */
|
|
434
|
+
valid: boolean;
|
|
435
|
+
/** Error message */
|
|
436
|
+
error?: string;
|
|
437
|
+
/** Required flag */
|
|
438
|
+
required: boolean;
|
|
439
|
+
/** Touched flag */
|
|
440
|
+
touched: boolean;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Modal/dialog state
|
|
444
|
+
*/
|
|
445
|
+
interface ModalState {
|
|
446
|
+
/** Modal ID */
|
|
447
|
+
id: string;
|
|
448
|
+
/** Modal title */
|
|
449
|
+
title?: string;
|
|
450
|
+
/** Modal type */
|
|
451
|
+
type: 'dialog' | 'alert' | 'confirm' | 'prompt' | 'drawer' | 'popup';
|
|
452
|
+
/** Whether modal is blocking */
|
|
453
|
+
blocking: boolean;
|
|
454
|
+
/** Close button ID */
|
|
455
|
+
closeButton?: string;
|
|
456
|
+
/** Primary action button */
|
|
457
|
+
primaryAction?: string;
|
|
458
|
+
/** Secondary action button */
|
|
459
|
+
secondaryAction?: string;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Semantic diff between two snapshots
|
|
463
|
+
*/
|
|
464
|
+
interface SemanticDiff {
|
|
465
|
+
/** LLM-readable summary of changes */
|
|
466
|
+
summary: string;
|
|
467
|
+
/** From snapshot ID */
|
|
468
|
+
fromSnapshotId: string;
|
|
469
|
+
/** To snapshot ID */
|
|
470
|
+
toSnapshotId: string;
|
|
471
|
+
/** Detailed changes */
|
|
472
|
+
changes: {
|
|
473
|
+
/** Elements that appeared */
|
|
474
|
+
appeared: ElementChange[];
|
|
475
|
+
/** Elements that disappeared */
|
|
476
|
+
disappeared: ElementChange[];
|
|
477
|
+
/** Elements that were modified */
|
|
478
|
+
modified: ElementModification[];
|
|
479
|
+
};
|
|
480
|
+
/** Probable trigger for the changes */
|
|
481
|
+
probableTrigger?: string;
|
|
482
|
+
/** Suggested next actions based on changes */
|
|
483
|
+
suggestedActions?: string[];
|
|
484
|
+
/** Page context changes */
|
|
485
|
+
pageChanges?: {
|
|
486
|
+
urlChanged: boolean;
|
|
487
|
+
titleChanged: boolean;
|
|
488
|
+
newUrl?: string;
|
|
489
|
+
newTitle?: string;
|
|
490
|
+
};
|
|
491
|
+
/** Duration of diff computation */
|
|
492
|
+
durationMs: number;
|
|
493
|
+
/** Timestamp */
|
|
494
|
+
timestamp: number;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Element change (appeared/disappeared)
|
|
498
|
+
*/
|
|
499
|
+
interface ElementChange {
|
|
500
|
+
/** Element ID */
|
|
501
|
+
elementId: string;
|
|
502
|
+
/** Element description */
|
|
503
|
+
description: string;
|
|
504
|
+
/** Element type */
|
|
505
|
+
type: string;
|
|
506
|
+
/** Semantic type */
|
|
507
|
+
semanticType?: string;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Element modification
|
|
511
|
+
*/
|
|
512
|
+
interface ElementModification {
|
|
513
|
+
/** Element ID */
|
|
514
|
+
elementId: string;
|
|
515
|
+
/** Element description */
|
|
516
|
+
description: string;
|
|
517
|
+
/** Property that changed */
|
|
518
|
+
property: string;
|
|
519
|
+
/** Previous value */
|
|
520
|
+
from: string;
|
|
521
|
+
/** New value */
|
|
522
|
+
to: string;
|
|
523
|
+
/** Whether this is a significant change */
|
|
524
|
+
significant: boolean;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Semantic search criteria using embeddings
|
|
528
|
+
*/
|
|
529
|
+
interface SemanticSearchCriteria {
|
|
530
|
+
/** Natural language query for semantic matching */
|
|
531
|
+
query: string;
|
|
532
|
+
/** Minimum similarity score (0-1, default: 0.5) */
|
|
533
|
+
threshold?: number;
|
|
534
|
+
/** Maximum results to return */
|
|
535
|
+
limit?: number;
|
|
536
|
+
/** Filter by element type */
|
|
537
|
+
type?: string;
|
|
538
|
+
/** Filter by ARIA role */
|
|
539
|
+
role?: string;
|
|
540
|
+
/** Combine with text-based search */
|
|
541
|
+
combineWithText?: boolean;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Semantic search result
|
|
545
|
+
*/
|
|
546
|
+
interface SemanticSearchResult {
|
|
547
|
+
/** The matched element */
|
|
548
|
+
element: AIDiscoveredElement;
|
|
549
|
+
/** Semantic similarity score (0-1) */
|
|
550
|
+
similarity: number;
|
|
551
|
+
/** Rank in results (1-indexed) */
|
|
552
|
+
rank: number;
|
|
553
|
+
/** Text that was used for embedding */
|
|
554
|
+
embeddedText: string;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Response from semantic search operations
|
|
558
|
+
*/
|
|
559
|
+
interface SemanticSearchResponse {
|
|
560
|
+
/** All matching results sorted by similarity */
|
|
561
|
+
results: SemanticSearchResult[];
|
|
562
|
+
/** Best match (highest similarity above threshold) */
|
|
563
|
+
bestMatch: SemanticSearchResult | null;
|
|
564
|
+
/** Total elements scanned */
|
|
565
|
+
scannedCount: number;
|
|
566
|
+
/** Search duration in milliseconds */
|
|
567
|
+
durationMs: number;
|
|
568
|
+
/** Query used */
|
|
569
|
+
query: string;
|
|
570
|
+
/** Embedding provider info */
|
|
571
|
+
providerInfo?: {
|
|
572
|
+
provider: string;
|
|
573
|
+
model: string;
|
|
574
|
+
dimension: number;
|
|
575
|
+
};
|
|
576
|
+
/** Timestamp */
|
|
577
|
+
timestamp: number;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Rich error context for AI agents
|
|
581
|
+
*/
|
|
582
|
+
interface AIErrorContext {
|
|
583
|
+
/** Error code */
|
|
584
|
+
code: string;
|
|
585
|
+
/** Human-readable error message */
|
|
586
|
+
message: string;
|
|
587
|
+
/** What action was attempted */
|
|
588
|
+
attemptedAction: string;
|
|
589
|
+
/** Search criteria used (if applicable) */
|
|
590
|
+
searchCriteria?: SearchCriteria;
|
|
591
|
+
/** Information about what was found */
|
|
592
|
+
searchResults: {
|
|
593
|
+
/** Number of candidates found */
|
|
594
|
+
candidatesFound: number;
|
|
595
|
+
/** Nearest match if any */
|
|
596
|
+
nearestMatch?: {
|
|
597
|
+
element: AIDiscoveredElement;
|
|
598
|
+
confidence: number;
|
|
599
|
+
whyNotSelected: string;
|
|
600
|
+
};
|
|
601
|
+
};
|
|
602
|
+
/** Page state at time of error */
|
|
603
|
+
pageContext: {
|
|
604
|
+
url: string;
|
|
605
|
+
title: string;
|
|
606
|
+
visibleElements: number;
|
|
607
|
+
/** Possible blockers like modals */
|
|
608
|
+
possibleBlockers: string[];
|
|
609
|
+
};
|
|
610
|
+
/** Recovery suggestions */
|
|
611
|
+
suggestions: RecoverySuggestion[];
|
|
612
|
+
/** Stack trace if available */
|
|
613
|
+
stack?: string;
|
|
614
|
+
/** Timestamp */
|
|
615
|
+
timestamp: number;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Recovery suggestion for errors
|
|
619
|
+
*/
|
|
620
|
+
interface RecoverySuggestion {
|
|
621
|
+
/** Human-readable action description */
|
|
622
|
+
action: string;
|
|
623
|
+
/** Command to execute (if applicable) */
|
|
624
|
+
command?: string;
|
|
625
|
+
/** Confidence that this will help */
|
|
626
|
+
confidence: number;
|
|
627
|
+
/** Priority (lower = try first) */
|
|
628
|
+
priority: number;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Extended element registration options with AI metadata
|
|
632
|
+
*/
|
|
633
|
+
interface AIElementRegistrationOptions {
|
|
634
|
+
/** Alternative names for the element */
|
|
635
|
+
aliases?: string[];
|
|
636
|
+
/** Human-readable description */
|
|
637
|
+
description?: string;
|
|
638
|
+
/** Semantic type (more descriptive than ElementType) */
|
|
639
|
+
semanticType?: string;
|
|
640
|
+
/** Purpose of the element */
|
|
641
|
+
purpose?: string;
|
|
642
|
+
/** Whether to auto-generate aliases */
|
|
643
|
+
autoGenerateAliases?: boolean;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export type { AIDiscoveredElement as A, BatchAssertionRequest as B, ElementChange as E, FormAnalysis as F, ModalState as M, NLActionRequest as N, PageContext as P, RecoverySuggestion as R, SearchCriteria as S, AIElementRegistrationOptions as a, AIErrorContext as b, AIFindResponse as c, AssertionRequest as d, AssertionResult as e, AssertionType as f, BatchAssertionResult as g, ElementModification as h, FormFieldAnalysis as i, FormFieldState as j, FormState as k, NLActionResponse as l, ParsedAction as m, SearchResponse as n, SearchResult as o, SemanticDiff as p, SemanticSearchCriteria as q, SemanticSearchResponse as r, SemanticSearchResult as s, SemanticSnapshot as t };
|