@qontinui/ui-bridge 0.1.1
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/control/index.d.mts +134 -0
- package/dist/control/index.d.ts +134 -0
- package/dist/control/index.js +924 -0
- package/dist/control/index.js.map +1 -0
- package/dist/control/index.mjs +919 -0
- package/dist/control/index.mjs.map +1 -0
- package/dist/core/index.d.mts +52 -0
- package/dist/core/index.d.ts +52 -0
- package/dist/core/index.js +1424 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/index.mjs +1409 -0
- package/dist/core/index.mjs.map +1 -0
- package/dist/debug/index.d.mts +93 -0
- package/dist/debug/index.d.ts +93 -0
- package/dist/debug/index.js +673 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/index.mjs +664 -0
- package/dist/debug/index.mjs.map +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +4719 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4665 -0
- package/dist/index.mjs.map +1 -0
- package/dist/metrics-BCG7z7Aq.d.mts +147 -0
- package/dist/metrics-QCnK0EFw.d.ts +147 -0
- package/dist/react/index.d.mts +786 -0
- package/dist/react/index.d.ts +786 -0
- package/dist/react/index.js +4312 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/index.mjs +4290 -0
- package/dist/react/index.mjs.map +1 -0
- package/dist/registry-CT6BVVKr.d.mts +253 -0
- package/dist/registry-D4mQ01B3.d.ts +253 -0
- package/dist/render-log/index.d.mts +340 -0
- package/dist/render-log/index.d.ts +340 -0
- package/dist/render-log/index.js +702 -0
- package/dist/render-log/index.js.map +1 -0
- package/dist/render-log/index.mjs +695 -0
- package/dist/render-log/index.mjs.map +1 -0
- package/dist/types-BDkXy5si.d.ts +354 -0
- package/dist/types-BpvpStn3.d.mts +802 -0
- package/dist/types-BpvpStn3.d.ts +802 -0
- package/dist/types-DdJD9yw5.d.mts +354 -0
- package/dist/websocket-client-B2LC9CYc.d.mts +124 -0
- package/dist/websocket-client-DupH0X7B.d.ts +124 -0
- package/package.json +83 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { a as ActionRequest, b as ActionResponse, a0 as WaitOptions, h as ElementState } from './types-BpvpStn3.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Control Module Types
|
|
5
|
+
*
|
|
6
|
+
* Types for the control protocol and action execution.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Extended action request with additional options
|
|
11
|
+
*/
|
|
12
|
+
interface ControlActionRequest extends ActionRequest {
|
|
13
|
+
/** Unique request ID for tracking */
|
|
14
|
+
requestId?: string;
|
|
15
|
+
/** Capture snapshot after action */
|
|
16
|
+
captureAfter?: boolean;
|
|
17
|
+
/** Retry options if action fails */
|
|
18
|
+
retryOptions?: {
|
|
19
|
+
maxRetries: number;
|
|
20
|
+
retryDelay: number;
|
|
21
|
+
retryOn?: ('timeout' | 'notFound' | 'disabled' | 'error')[];
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extended action response with additional info
|
|
26
|
+
*/
|
|
27
|
+
interface ControlActionResponse extends ActionResponse {
|
|
28
|
+
/** Request ID if provided */
|
|
29
|
+
requestId?: string;
|
|
30
|
+
/** Snapshot captured after action */
|
|
31
|
+
snapshot?: unknown;
|
|
32
|
+
/** Number of retries attempted */
|
|
33
|
+
retryCount?: number;
|
|
34
|
+
/** Wait duration before action */
|
|
35
|
+
waitDurationMs?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Component action request
|
|
39
|
+
*/
|
|
40
|
+
interface ComponentActionRequest {
|
|
41
|
+
/** Action ID to execute */
|
|
42
|
+
action: string;
|
|
43
|
+
/** Action parameters */
|
|
44
|
+
params?: Record<string, unknown>;
|
|
45
|
+
/** Unique request ID */
|
|
46
|
+
requestId?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Component action response
|
|
50
|
+
*/
|
|
51
|
+
interface ComponentActionResponse {
|
|
52
|
+
/** Whether the action succeeded */
|
|
53
|
+
success: boolean;
|
|
54
|
+
/** Result from the action */
|
|
55
|
+
result?: unknown;
|
|
56
|
+
/** Error message if failed */
|
|
57
|
+
error?: string;
|
|
58
|
+
/** Stack trace if failed */
|
|
59
|
+
stack?: string;
|
|
60
|
+
/** Duration of the action */
|
|
61
|
+
durationMs: number;
|
|
62
|
+
/** Timestamp when completed */
|
|
63
|
+
timestamp: number;
|
|
64
|
+
/** Request ID if provided */
|
|
65
|
+
requestId?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Workflow run request
|
|
69
|
+
*/
|
|
70
|
+
interface WorkflowRunRequest {
|
|
71
|
+
/** Parameters for the workflow */
|
|
72
|
+
params?: Record<string, unknown>;
|
|
73
|
+
/** Request ID for tracking */
|
|
74
|
+
requestId?: string;
|
|
75
|
+
/** Start from a specific step */
|
|
76
|
+
startStep?: string;
|
|
77
|
+
/** Stop at a specific step */
|
|
78
|
+
stopStep?: string;
|
|
79
|
+
/** Step timeout */
|
|
80
|
+
stepTimeout?: number;
|
|
81
|
+
/** Total workflow timeout */
|
|
82
|
+
workflowTimeout?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Workflow step result
|
|
86
|
+
*/
|
|
87
|
+
interface WorkflowStepResult {
|
|
88
|
+
/** Step ID */
|
|
89
|
+
stepId: string;
|
|
90
|
+
/** Step type */
|
|
91
|
+
stepType: string;
|
|
92
|
+
/** Whether the step succeeded */
|
|
93
|
+
success: boolean;
|
|
94
|
+
/** Step result */
|
|
95
|
+
result?: unknown;
|
|
96
|
+
/** Error if failed */
|
|
97
|
+
error?: string;
|
|
98
|
+
/** Duration in milliseconds */
|
|
99
|
+
durationMs: number;
|
|
100
|
+
/** Timestamp when completed */
|
|
101
|
+
timestamp: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Workflow run status
|
|
105
|
+
*/
|
|
106
|
+
type WorkflowRunStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
107
|
+
/**
|
|
108
|
+
* Workflow run response
|
|
109
|
+
*/
|
|
110
|
+
interface WorkflowRunResponse {
|
|
111
|
+
/** Workflow ID */
|
|
112
|
+
workflowId: string;
|
|
113
|
+
/** Run ID for tracking */
|
|
114
|
+
runId: string;
|
|
115
|
+
/** Current status */
|
|
116
|
+
status: WorkflowRunStatus;
|
|
117
|
+
/** Step results */
|
|
118
|
+
steps: WorkflowStepResult[];
|
|
119
|
+
/** Current step index */
|
|
120
|
+
currentStep?: number;
|
|
121
|
+
/** Total steps */
|
|
122
|
+
totalSteps: number;
|
|
123
|
+
/** Overall success */
|
|
124
|
+
success?: boolean;
|
|
125
|
+
/** Error message if failed */
|
|
126
|
+
error?: string;
|
|
127
|
+
/** Start timestamp */
|
|
128
|
+
startedAt: number;
|
|
129
|
+
/** End timestamp */
|
|
130
|
+
completedAt?: number;
|
|
131
|
+
/** Total duration */
|
|
132
|
+
durationMs?: number;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Element info for discovery
|
|
136
|
+
*/
|
|
137
|
+
interface DiscoveredElement {
|
|
138
|
+
/** Element ID */
|
|
139
|
+
id: string;
|
|
140
|
+
/** Element type */
|
|
141
|
+
type: string;
|
|
142
|
+
/** Human-readable label */
|
|
143
|
+
label?: string;
|
|
144
|
+
/** Tag name */
|
|
145
|
+
tagName: string;
|
|
146
|
+
/** Role attribute */
|
|
147
|
+
role?: string;
|
|
148
|
+
/** Accessible name */
|
|
149
|
+
accessibleName?: string;
|
|
150
|
+
/** Available actions */
|
|
151
|
+
actions: string[];
|
|
152
|
+
/** Current state */
|
|
153
|
+
state: ElementState;
|
|
154
|
+
/** Whether registered with UI Bridge */
|
|
155
|
+
registered: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Find request options
|
|
159
|
+
*
|
|
160
|
+
* Used to find/discover controllable elements in the UI.
|
|
161
|
+
*/
|
|
162
|
+
interface FindRequest {
|
|
163
|
+
/** Root element selector to start from */
|
|
164
|
+
root?: string;
|
|
165
|
+
/** Only find interactive elements */
|
|
166
|
+
interactiveOnly?: boolean;
|
|
167
|
+
/** Include hidden elements */
|
|
168
|
+
includeHidden?: boolean;
|
|
169
|
+
/** Maximum elements to return */
|
|
170
|
+
limit?: number;
|
|
171
|
+
/** Filter by element type */
|
|
172
|
+
types?: string[];
|
|
173
|
+
/** Filter by selector */
|
|
174
|
+
selector?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Find response
|
|
178
|
+
*
|
|
179
|
+
* Response from finding/discovering controllable elements.
|
|
180
|
+
*/
|
|
181
|
+
interface FindResponse {
|
|
182
|
+
/** Found elements */
|
|
183
|
+
elements: DiscoveredElement[];
|
|
184
|
+
/** Total elements found */
|
|
185
|
+
total: number;
|
|
186
|
+
/** Find duration */
|
|
187
|
+
durationMs: number;
|
|
188
|
+
/** Timestamp */
|
|
189
|
+
timestamp: number;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @deprecated Use FindRequest instead
|
|
193
|
+
*/
|
|
194
|
+
type DiscoveryRequest = FindRequest;
|
|
195
|
+
/**
|
|
196
|
+
* @deprecated Use FindResponse instead
|
|
197
|
+
*/
|
|
198
|
+
type DiscoveryResponse = FindResponse;
|
|
199
|
+
/**
|
|
200
|
+
* Control snapshot - full state of controllable UI
|
|
201
|
+
*/
|
|
202
|
+
interface ControlSnapshot {
|
|
203
|
+
/** Timestamp */
|
|
204
|
+
timestamp: number;
|
|
205
|
+
/** All registered elements */
|
|
206
|
+
elements: Array<{
|
|
207
|
+
id: string;
|
|
208
|
+
type: string;
|
|
209
|
+
label?: string;
|
|
210
|
+
actions: string[];
|
|
211
|
+
state: ElementState;
|
|
212
|
+
}>;
|
|
213
|
+
/** All registered components */
|
|
214
|
+
components: Array<{
|
|
215
|
+
id: string;
|
|
216
|
+
name: string;
|
|
217
|
+
actions: string[];
|
|
218
|
+
}>;
|
|
219
|
+
/** Available workflows */
|
|
220
|
+
workflows: Array<{
|
|
221
|
+
id: string;
|
|
222
|
+
name: string;
|
|
223
|
+
stepCount: number;
|
|
224
|
+
}>;
|
|
225
|
+
/** Active workflow runs */
|
|
226
|
+
activeRuns: Array<{
|
|
227
|
+
runId: string;
|
|
228
|
+
workflowId: string;
|
|
229
|
+
status: WorkflowRunStatus;
|
|
230
|
+
currentStep: number;
|
|
231
|
+
totalSteps: number;
|
|
232
|
+
}>;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Action types for keyboard input
|
|
236
|
+
*/
|
|
237
|
+
interface KeyboardAction {
|
|
238
|
+
/** Key to press */
|
|
239
|
+
key: string;
|
|
240
|
+
/** Key modifiers */
|
|
241
|
+
modifiers?: {
|
|
242
|
+
ctrl?: boolean;
|
|
243
|
+
shift?: boolean;
|
|
244
|
+
alt?: boolean;
|
|
245
|
+
meta?: boolean;
|
|
246
|
+
};
|
|
247
|
+
/** Hold duration for key press */
|
|
248
|
+
holdDuration?: number;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Action types for mouse input
|
|
252
|
+
*/
|
|
253
|
+
interface MouseAction {
|
|
254
|
+
/** Mouse button */
|
|
255
|
+
button?: 'left' | 'right' | 'middle';
|
|
256
|
+
/** Click count */
|
|
257
|
+
clickCount?: number;
|
|
258
|
+
/** Coordinates relative to element */
|
|
259
|
+
position?: {
|
|
260
|
+
x: number;
|
|
261
|
+
y: number;
|
|
262
|
+
};
|
|
263
|
+
/** Hold duration for click */
|
|
264
|
+
holdDuration?: number;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Action types for scroll input
|
|
268
|
+
*/
|
|
269
|
+
interface ScrollAction {
|
|
270
|
+
/** Scroll direction */
|
|
271
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
272
|
+
/** Scroll amount in pixels */
|
|
273
|
+
amount?: number;
|
|
274
|
+
/** Scroll to specific position */
|
|
275
|
+
position?: {
|
|
276
|
+
x: number;
|
|
277
|
+
y: number;
|
|
278
|
+
};
|
|
279
|
+
/** Scroll to element */
|
|
280
|
+
toElement?: string;
|
|
281
|
+
/** Smooth scroll */
|
|
282
|
+
smooth?: boolean;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Type action for text input
|
|
286
|
+
*/
|
|
287
|
+
interface TypeAction {
|
|
288
|
+
/** Text to type */
|
|
289
|
+
text: string;
|
|
290
|
+
/** Clear existing value first */
|
|
291
|
+
clear?: boolean;
|
|
292
|
+
/** Delay between keystrokes (ms) */
|
|
293
|
+
delay?: number;
|
|
294
|
+
/** Trigger events (input, change) */
|
|
295
|
+
triggerEvents?: boolean;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Select action for dropdowns
|
|
299
|
+
*/
|
|
300
|
+
interface SelectAction {
|
|
301
|
+
/** Value(s) to select */
|
|
302
|
+
value: string | string[];
|
|
303
|
+
/** Select by label instead of value */
|
|
304
|
+
byLabel?: boolean;
|
|
305
|
+
/** For multi-select: add to selection */
|
|
306
|
+
additive?: boolean;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Wait condition result
|
|
310
|
+
*/
|
|
311
|
+
interface WaitResult {
|
|
312
|
+
/** Whether the condition was met */
|
|
313
|
+
met: boolean;
|
|
314
|
+
/** Time waited in milliseconds */
|
|
315
|
+
waitedMs: number;
|
|
316
|
+
/** Final state when resolved */
|
|
317
|
+
state?: ElementState;
|
|
318
|
+
/** Error if timed out */
|
|
319
|
+
error?: string;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Action executor interface
|
|
323
|
+
*/
|
|
324
|
+
interface ActionExecutor {
|
|
325
|
+
/** Execute an action on an element */
|
|
326
|
+
executeAction(elementId: string, action: ControlActionRequest): Promise<ControlActionResponse>;
|
|
327
|
+
/** Execute an action on a component */
|
|
328
|
+
executeComponentAction(componentId: string, action: ComponentActionRequest): Promise<ComponentActionResponse>;
|
|
329
|
+
/** Wait for a condition */
|
|
330
|
+
waitFor(elementId: string, options: WaitOptions): Promise<WaitResult>;
|
|
331
|
+
/** Find controllable elements */
|
|
332
|
+
find(options?: FindRequest): Promise<FindResponse>;
|
|
333
|
+
/**
|
|
334
|
+
* @deprecated Use find() instead
|
|
335
|
+
*/
|
|
336
|
+
discover(options?: FindRequest): Promise<FindResponse>;
|
|
337
|
+
/** Get control snapshot */
|
|
338
|
+
getSnapshot(): Promise<ControlSnapshot>;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Workflow engine interface
|
|
342
|
+
*/
|
|
343
|
+
interface WorkflowEngine {
|
|
344
|
+
/** Run a workflow */
|
|
345
|
+
run(workflowId: string, request?: WorkflowRunRequest): Promise<WorkflowRunResponse>;
|
|
346
|
+
/** Get workflow run status */
|
|
347
|
+
getRunStatus(runId: string): Promise<WorkflowRunResponse | null>;
|
|
348
|
+
/** Cancel a running workflow */
|
|
349
|
+
cancel(runId: string): Promise<boolean>;
|
|
350
|
+
/** List active runs */
|
|
351
|
+
listActiveRuns(): Promise<WorkflowRunResponse[]>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export type { ActionExecutor as A, ComponentActionRequest as C, DiscoveredElement as D, FindRequest as F, KeyboardAction as K, MouseAction as M, ScrollAction as S, TypeAction as T, WaitResult as W, ComponentActionResponse as a, ControlActionRequest as b, ControlActionResponse as c, ControlSnapshot as d, DiscoveryRequest as e, DiscoveryResponse as f, FindResponse as g, SelectAction as h, WorkflowEngine as i, WorkflowRunRequest as j, WorkflowRunResponse as k, WorkflowRunStatus as l, WorkflowStepResult as m };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { W as WSClientConfig, t as WSConnectionState, X as WSSubscriptionOptions, e as BridgeEventType, f as BridgeSnapshot, a as ActionRequest, b as ActionResponse, c as BridgeEvent } from './types-BpvpStn3.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket Client for UI Bridge
|
|
5
|
+
*
|
|
6
|
+
* Provides real-time communication with UI Bridge server.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* WebSocket client for UI Bridge
|
|
11
|
+
*/
|
|
12
|
+
declare class UIBridgeWSClient {
|
|
13
|
+
private ws;
|
|
14
|
+
private config;
|
|
15
|
+
private state;
|
|
16
|
+
private clientId;
|
|
17
|
+
private reconnectAttempts;
|
|
18
|
+
private reconnectTimer;
|
|
19
|
+
private pingTimer;
|
|
20
|
+
private pendingRequests;
|
|
21
|
+
private connectionListeners;
|
|
22
|
+
private eventListeners;
|
|
23
|
+
private errorListeners;
|
|
24
|
+
private subscriptions;
|
|
25
|
+
constructor(config: WSClientConfig);
|
|
26
|
+
/**
|
|
27
|
+
* Get current connection state
|
|
28
|
+
*/
|
|
29
|
+
get connectionState(): WSConnectionState;
|
|
30
|
+
/**
|
|
31
|
+
* Get assigned client ID
|
|
32
|
+
*/
|
|
33
|
+
get id(): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Connect to the WebSocket server
|
|
36
|
+
*/
|
|
37
|
+
connect(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Disconnect from the server
|
|
40
|
+
*/
|
|
41
|
+
disconnect(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Subscribe to events
|
|
44
|
+
*/
|
|
45
|
+
subscribe(options: WSSubscriptionOptions): Promise<BridgeEventType[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Unsubscribe from events
|
|
48
|
+
*/
|
|
49
|
+
unsubscribe(events?: BridgeEventType[]): Promise<BridgeEventType[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Find elements
|
|
52
|
+
*/
|
|
53
|
+
find(options?: {
|
|
54
|
+
interactiveOnly?: boolean;
|
|
55
|
+
includeState?: boolean;
|
|
56
|
+
selector?: string;
|
|
57
|
+
}): Promise<BridgeSnapshot['elements']>;
|
|
58
|
+
/**
|
|
59
|
+
* Discover elements
|
|
60
|
+
* @deprecated Use find() instead
|
|
61
|
+
*/
|
|
62
|
+
discover(options?: {
|
|
63
|
+
interactiveOnly?: boolean;
|
|
64
|
+
includeState?: boolean;
|
|
65
|
+
selector?: string;
|
|
66
|
+
}): Promise<BridgeSnapshot['elements']>;
|
|
67
|
+
/**
|
|
68
|
+
* Get element details
|
|
69
|
+
*/
|
|
70
|
+
getElement(elementId: string, includeState?: boolean): Promise<BridgeSnapshot['elements'][0] | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Get full snapshot
|
|
73
|
+
*/
|
|
74
|
+
getSnapshot(): Promise<BridgeSnapshot>;
|
|
75
|
+
/**
|
|
76
|
+
* Execute action on an element
|
|
77
|
+
*/
|
|
78
|
+
executeAction(elementId: string, action: ActionRequest): Promise<ActionResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Execute component action
|
|
81
|
+
*/
|
|
82
|
+
executeComponentAction(componentId: string, action: string, params?: Record<string, unknown>): Promise<ActionResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Execute workflow with optional progress streaming
|
|
85
|
+
*/
|
|
86
|
+
executeWorkflow(workflowId: string, params?: Record<string, unknown>, onProgress?: (progress: {
|
|
87
|
+
currentStep: number;
|
|
88
|
+
totalSteps: number;
|
|
89
|
+
step: {
|
|
90
|
+
id: string;
|
|
91
|
+
status: string;
|
|
92
|
+
};
|
|
93
|
+
}) => void): Promise<{
|
|
94
|
+
success: boolean;
|
|
95
|
+
results: unknown[];
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Add connection state listener
|
|
99
|
+
*/
|
|
100
|
+
onConnectionChange(listener: (state: WSConnectionState) => void): () => void;
|
|
101
|
+
/**
|
|
102
|
+
* Add event listener
|
|
103
|
+
*/
|
|
104
|
+
onEvent(eventType: BridgeEventType | '*', listener: (event: BridgeEvent) => void): () => void;
|
|
105
|
+
/**
|
|
106
|
+
* Add error listener
|
|
107
|
+
*/
|
|
108
|
+
onError(listener: (error: Error) => void): () => void;
|
|
109
|
+
private setState;
|
|
110
|
+
private handleMessage;
|
|
111
|
+
private handleResponse;
|
|
112
|
+
private notifyEvent;
|
|
113
|
+
private notifyError;
|
|
114
|
+
private sendRequest;
|
|
115
|
+
private scheduleReconnect;
|
|
116
|
+
private startPingInterval;
|
|
117
|
+
private stopPingInterval;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create a WebSocket client instance
|
|
121
|
+
*/
|
|
122
|
+
declare function createWSClient(config: WSClientConfig): UIBridgeWSClient;
|
|
123
|
+
|
|
124
|
+
export { UIBridgeWSClient as U, createWSClient as c };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { W as WSClientConfig, t as WSConnectionState, X as WSSubscriptionOptions, e as BridgeEventType, f as BridgeSnapshot, a as ActionRequest, b as ActionResponse, c as BridgeEvent } from './types-BpvpStn3.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WebSocket Client for UI Bridge
|
|
5
|
+
*
|
|
6
|
+
* Provides real-time communication with UI Bridge server.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* WebSocket client for UI Bridge
|
|
11
|
+
*/
|
|
12
|
+
declare class UIBridgeWSClient {
|
|
13
|
+
private ws;
|
|
14
|
+
private config;
|
|
15
|
+
private state;
|
|
16
|
+
private clientId;
|
|
17
|
+
private reconnectAttempts;
|
|
18
|
+
private reconnectTimer;
|
|
19
|
+
private pingTimer;
|
|
20
|
+
private pendingRequests;
|
|
21
|
+
private connectionListeners;
|
|
22
|
+
private eventListeners;
|
|
23
|
+
private errorListeners;
|
|
24
|
+
private subscriptions;
|
|
25
|
+
constructor(config: WSClientConfig);
|
|
26
|
+
/**
|
|
27
|
+
* Get current connection state
|
|
28
|
+
*/
|
|
29
|
+
get connectionState(): WSConnectionState;
|
|
30
|
+
/**
|
|
31
|
+
* Get assigned client ID
|
|
32
|
+
*/
|
|
33
|
+
get id(): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Connect to the WebSocket server
|
|
36
|
+
*/
|
|
37
|
+
connect(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Disconnect from the server
|
|
40
|
+
*/
|
|
41
|
+
disconnect(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Subscribe to events
|
|
44
|
+
*/
|
|
45
|
+
subscribe(options: WSSubscriptionOptions): Promise<BridgeEventType[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Unsubscribe from events
|
|
48
|
+
*/
|
|
49
|
+
unsubscribe(events?: BridgeEventType[]): Promise<BridgeEventType[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Find elements
|
|
52
|
+
*/
|
|
53
|
+
find(options?: {
|
|
54
|
+
interactiveOnly?: boolean;
|
|
55
|
+
includeState?: boolean;
|
|
56
|
+
selector?: string;
|
|
57
|
+
}): Promise<BridgeSnapshot['elements']>;
|
|
58
|
+
/**
|
|
59
|
+
* Discover elements
|
|
60
|
+
* @deprecated Use find() instead
|
|
61
|
+
*/
|
|
62
|
+
discover(options?: {
|
|
63
|
+
interactiveOnly?: boolean;
|
|
64
|
+
includeState?: boolean;
|
|
65
|
+
selector?: string;
|
|
66
|
+
}): Promise<BridgeSnapshot['elements']>;
|
|
67
|
+
/**
|
|
68
|
+
* Get element details
|
|
69
|
+
*/
|
|
70
|
+
getElement(elementId: string, includeState?: boolean): Promise<BridgeSnapshot['elements'][0] | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Get full snapshot
|
|
73
|
+
*/
|
|
74
|
+
getSnapshot(): Promise<BridgeSnapshot>;
|
|
75
|
+
/**
|
|
76
|
+
* Execute action on an element
|
|
77
|
+
*/
|
|
78
|
+
executeAction(elementId: string, action: ActionRequest): Promise<ActionResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Execute component action
|
|
81
|
+
*/
|
|
82
|
+
executeComponentAction(componentId: string, action: string, params?: Record<string, unknown>): Promise<ActionResponse>;
|
|
83
|
+
/**
|
|
84
|
+
* Execute workflow with optional progress streaming
|
|
85
|
+
*/
|
|
86
|
+
executeWorkflow(workflowId: string, params?: Record<string, unknown>, onProgress?: (progress: {
|
|
87
|
+
currentStep: number;
|
|
88
|
+
totalSteps: number;
|
|
89
|
+
step: {
|
|
90
|
+
id: string;
|
|
91
|
+
status: string;
|
|
92
|
+
};
|
|
93
|
+
}) => void): Promise<{
|
|
94
|
+
success: boolean;
|
|
95
|
+
results: unknown[];
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Add connection state listener
|
|
99
|
+
*/
|
|
100
|
+
onConnectionChange(listener: (state: WSConnectionState) => void): () => void;
|
|
101
|
+
/**
|
|
102
|
+
* Add event listener
|
|
103
|
+
*/
|
|
104
|
+
onEvent(eventType: BridgeEventType | '*', listener: (event: BridgeEvent) => void): () => void;
|
|
105
|
+
/**
|
|
106
|
+
* Add error listener
|
|
107
|
+
*/
|
|
108
|
+
onError(listener: (error: Error) => void): () => void;
|
|
109
|
+
private setState;
|
|
110
|
+
private handleMessage;
|
|
111
|
+
private handleResponse;
|
|
112
|
+
private notifyEvent;
|
|
113
|
+
private notifyError;
|
|
114
|
+
private sendRequest;
|
|
115
|
+
private scheduleReconnect;
|
|
116
|
+
private startPingInterval;
|
|
117
|
+
private stopPingInterval;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Create a WebSocket client instance
|
|
121
|
+
*/
|
|
122
|
+
declare function createWSClient(config: WSClientConfig): UIBridgeWSClient;
|
|
123
|
+
|
|
124
|
+
export { UIBridgeWSClient as U, createWSClient as c };
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@qontinui/ui-bridge",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "UI Bridge Framework - React hooks and providers for UI observation, control, and debugging",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./core": {
|
|
15
|
+
"types": "./dist/core/index.d.ts",
|
|
16
|
+
"import": "./dist/core/index.mjs",
|
|
17
|
+
"require": "./dist/core/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./react": {
|
|
20
|
+
"types": "./dist/react/index.d.ts",
|
|
21
|
+
"import": "./dist/react/index.mjs",
|
|
22
|
+
"require": "./dist/react/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./control": {
|
|
25
|
+
"types": "./dist/control/index.d.ts",
|
|
26
|
+
"import": "./dist/control/index.mjs",
|
|
27
|
+
"require": "./dist/control/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./render-log": {
|
|
30
|
+
"types": "./dist/render-log/index.d.ts",
|
|
31
|
+
"import": "./dist/render-log/index.mjs",
|
|
32
|
+
"require": "./dist/render-log/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./debug": {
|
|
35
|
+
"types": "./dist/debug/index.d.ts",
|
|
36
|
+
"import": "./dist/debug/index.mjs",
|
|
37
|
+
"require": "./dist/debug/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:watch": "vitest",
|
|
49
|
+
"typecheck": "tsc --noEmit",
|
|
50
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
51
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
55
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@testing-library/react": "^14.1.0",
|
|
59
|
+
"@types/react": "^18.2.0",
|
|
60
|
+
"@types/react-dom": "^18.2.0",
|
|
61
|
+
"jsdom": "^23.0.0",
|
|
62
|
+
"react": "^18.2.0",
|
|
63
|
+
"react-dom": "^18.2.0",
|
|
64
|
+
"tsup": "^8.0.0",
|
|
65
|
+
"typescript": "^5.3.0",
|
|
66
|
+
"vitest": "^1.0.0"
|
|
67
|
+
},
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "https://github.com/qontinui/ui-bridge.git",
|
|
72
|
+
"directory": "packages/ui-bridge"
|
|
73
|
+
},
|
|
74
|
+
"keywords": [
|
|
75
|
+
"react",
|
|
76
|
+
"ui",
|
|
77
|
+
"automation",
|
|
78
|
+
"testing",
|
|
79
|
+
"ai",
|
|
80
|
+
"debugging",
|
|
81
|
+
"hooks"
|
|
82
|
+
]
|
|
83
|
+
}
|