@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.
Files changed (47) hide show
  1. package/dist/control/index.d.mts +134 -0
  2. package/dist/control/index.d.ts +134 -0
  3. package/dist/control/index.js +924 -0
  4. package/dist/control/index.js.map +1 -0
  5. package/dist/control/index.mjs +919 -0
  6. package/dist/control/index.mjs.map +1 -0
  7. package/dist/core/index.d.mts +52 -0
  8. package/dist/core/index.d.ts +52 -0
  9. package/dist/core/index.js +1424 -0
  10. package/dist/core/index.js.map +1 -0
  11. package/dist/core/index.mjs +1409 -0
  12. package/dist/core/index.mjs.map +1 -0
  13. package/dist/debug/index.d.mts +93 -0
  14. package/dist/debug/index.d.ts +93 -0
  15. package/dist/debug/index.js +673 -0
  16. package/dist/debug/index.js.map +1 -0
  17. package/dist/debug/index.mjs +664 -0
  18. package/dist/debug/index.mjs.map +1 -0
  19. package/dist/index.d.mts +12 -0
  20. package/dist/index.d.ts +12 -0
  21. package/dist/index.js +4719 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/index.mjs +4665 -0
  24. package/dist/index.mjs.map +1 -0
  25. package/dist/metrics-BCG7z7Aq.d.mts +147 -0
  26. package/dist/metrics-QCnK0EFw.d.ts +147 -0
  27. package/dist/react/index.d.mts +786 -0
  28. package/dist/react/index.d.ts +786 -0
  29. package/dist/react/index.js +4312 -0
  30. package/dist/react/index.js.map +1 -0
  31. package/dist/react/index.mjs +4290 -0
  32. package/dist/react/index.mjs.map +1 -0
  33. package/dist/registry-CT6BVVKr.d.mts +253 -0
  34. package/dist/registry-D4mQ01B3.d.ts +253 -0
  35. package/dist/render-log/index.d.mts +340 -0
  36. package/dist/render-log/index.d.ts +340 -0
  37. package/dist/render-log/index.js +702 -0
  38. package/dist/render-log/index.js.map +1 -0
  39. package/dist/render-log/index.mjs +695 -0
  40. package/dist/render-log/index.mjs.map +1 -0
  41. package/dist/types-BDkXy5si.d.ts +354 -0
  42. package/dist/types-BpvpStn3.d.mts +802 -0
  43. package/dist/types-BpvpStn3.d.ts +802 -0
  44. package/dist/types-DdJD9yw5.d.mts +354 -0
  45. package/dist/websocket-client-B2LC9CYc.d.mts +124 -0
  46. package/dist/websocket-client-DupH0X7B.d.ts +124 -0
  47. package/package.json +83 -0
@@ -0,0 +1,802 @@
1
+ /**
2
+ * UI Bridge Core Types
3
+ *
4
+ * Defines the fundamental types used throughout the UI Bridge framework.
5
+ */
6
+ /**
7
+ * Element identification using multiple strategies
8
+ */
9
+ interface ElementIdentifier {
10
+ /** Explicit UI Bridge identifier (data-ui-id attribute) */
11
+ uiId?: string;
12
+ /** Testing library convention (data-testid attribute) */
13
+ testId?: string;
14
+ /** Legacy AWAS support (data-awas-element attribute) */
15
+ awasId?: string;
16
+ /** HTML id attribute */
17
+ htmlId?: string;
18
+ /** Generated XPath selector */
19
+ xpath: string;
20
+ /** Generated CSS selector */
21
+ selector: string;
22
+ }
23
+ /**
24
+ * Current state of a UI element
25
+ */
26
+ interface ElementState {
27
+ /** Whether the element is visible in the viewport */
28
+ visible: boolean;
29
+ /** Whether the element is enabled (not disabled) */
30
+ enabled: boolean;
31
+ /** Whether the element has focus */
32
+ focused: boolean;
33
+ /** Bounding rectangle of the element */
34
+ rect: {
35
+ x: number;
36
+ y: number;
37
+ width: number;
38
+ height: number;
39
+ top: number;
40
+ right: number;
41
+ bottom: number;
42
+ left: number;
43
+ };
44
+ /** Current value for inputs */
45
+ value?: string;
46
+ /** Checked state for checkboxes/radios */
47
+ checked?: boolean;
48
+ /** Selected options for select elements */
49
+ selectedOptions?: string[];
50
+ /** Text content of the element */
51
+ textContent?: string;
52
+ /** Inner HTML of the element (sanitized) */
53
+ innerHTML?: string;
54
+ /** Computed styles relevant for automation */
55
+ computedStyles?: {
56
+ display: string;
57
+ visibility: string;
58
+ opacity: string;
59
+ pointerEvents: string;
60
+ };
61
+ }
62
+ /**
63
+ * Types of UI elements that can be registered
64
+ */
65
+ type ElementType = 'button' | 'input' | 'select' | 'checkbox' | 'radio' | 'link' | 'form' | 'textarea' | 'menu' | 'menuitem' | 'tab' | 'dialog' | 'custom' | 'switch' | 'slider' | 'combobox' | 'listbox' | 'option' | 'textbox' | 'generic';
66
+ /**
67
+ * Standard actions available on elements
68
+ */
69
+ type StandardAction = 'click' | 'doubleClick' | 'rightClick' | 'type' | 'clear' | 'select' | 'focus' | 'blur' | 'hover' | 'scroll' | 'check' | 'uncheck' | 'toggle' | 'setValue' | 'drag' | 'submit' | 'reset';
70
+ /**
71
+ * Handler for custom actions
72
+ */
73
+ type ActionHandler<TParams = unknown, TResult = unknown> = (params?: TParams) => TResult | Promise<TResult>;
74
+ /**
75
+ * Custom action definition
76
+ */
77
+ interface CustomAction<TParams = unknown, TResult = unknown> {
78
+ /** Action identifier */
79
+ id: string;
80
+ /** Human-readable label */
81
+ label?: string;
82
+ /** Description of what the action does */
83
+ description?: string;
84
+ /** Action handler function */
85
+ handler: ActionHandler<TParams, TResult>;
86
+ }
87
+ /**
88
+ * A UI element registered with the bridge
89
+ */
90
+ interface RegisteredElement {
91
+ /** Unique identifier for this element */
92
+ id: string;
93
+ /** The DOM element reference */
94
+ element: HTMLElement;
95
+ /** Type of UI element */
96
+ type: ElementType;
97
+ /** Human-readable label */
98
+ label?: string;
99
+ /** Available standard actions for this element */
100
+ actions: StandardAction[];
101
+ /** Custom actions specific to this element */
102
+ customActions?: Record<string, CustomAction>;
103
+ /** Function to get the current state */
104
+ getState: () => ElementState;
105
+ /** Function to get the element identifier */
106
+ getIdentifier: () => ElementIdentifier;
107
+ /** Timestamp when the element was registered */
108
+ registeredAt: number;
109
+ /** Whether this element is currently mounted */
110
+ mounted: boolean;
111
+ }
112
+ /**
113
+ * Component action definition
114
+ */
115
+ interface ComponentAction<TParams = unknown, TResult = unknown> {
116
+ /** Action identifier */
117
+ id: string;
118
+ /** Human-readable label */
119
+ label?: string;
120
+ /** Description of what the action does */
121
+ description?: string;
122
+ /** Parameter schema (for documentation/validation) */
123
+ paramSchema?: Record<string, unknown>;
124
+ /** Action handler function */
125
+ handler: ActionHandler<TParams, TResult>;
126
+ }
127
+ /**
128
+ * A component registered with the bridge (higher-level than elements)
129
+ */
130
+ interface RegisteredComponent {
131
+ /** Unique identifier for this component */
132
+ id: string;
133
+ /** Human-readable name */
134
+ name: string;
135
+ /** Description of the component's purpose */
136
+ description?: string;
137
+ /** Available actions on this component */
138
+ actions: ComponentAction[];
139
+ /** Child element IDs owned by this component */
140
+ elementIds?: string[];
141
+ /** Timestamp when the component was registered */
142
+ registeredAt: number;
143
+ /** Whether this component is currently mounted */
144
+ mounted: boolean;
145
+ }
146
+ /**
147
+ * Workflow step types
148
+ */
149
+ type WorkflowStepType = 'element-action' | 'component-action' | 'wait' | 'assert' | 'navigate' | 'branch' | 'loop' | 'extract' | 'log' | 'custom';
150
+ /**
151
+ * Branch condition for conditional workflow execution
152
+ */
153
+ interface BranchCondition {
154
+ /** State IDs that must be active */
155
+ activeStates?: string[];
156
+ /** State IDs that must be inactive */
157
+ inactiveStates?: string[];
158
+ /** Element ID to check state of */
159
+ elementId?: string;
160
+ /** Expected element state */
161
+ elementState?: Partial<ElementState>;
162
+ /** Custom condition function */
163
+ condition?: () => boolean | Promise<boolean>;
164
+ }
165
+ /**
166
+ * Loop configuration for repeated workflow steps
167
+ */
168
+ interface LoopConfig {
169
+ /** Maximum number of iterations */
170
+ maxIterations?: number;
171
+ /** Continue while these states are active */
172
+ whileStatesActive?: string[];
173
+ /** Continue while these states are inactive */
174
+ whileStatesInactive?: string[];
175
+ /** Custom continue condition */
176
+ whileCondition?: () => boolean | Promise<boolean>;
177
+ /** Delay between iterations in ms */
178
+ delayMs?: number;
179
+ }
180
+ /**
181
+ * Extract configuration for data extraction
182
+ */
183
+ interface ExtractConfig {
184
+ /** Element ID to extract from */
185
+ elementId: string;
186
+ /** Property to extract (value, textContent, innerHTML, attribute) */
187
+ property: 'value' | 'textContent' | 'innerHTML' | 'attribute' | 'state';
188
+ /** Attribute name (if property is 'attribute') */
189
+ attributeName?: string;
190
+ /** Variable name to store extracted value */
191
+ variableName: string;
192
+ /** Optional transformation function */
193
+ transform?: (value: unknown) => unknown;
194
+ }
195
+ /**
196
+ * Log configuration for debugging
197
+ */
198
+ interface LogConfig {
199
+ /** Log level */
200
+ level: 'debug' | 'info' | 'warn' | 'error';
201
+ /** Message to log */
202
+ message: string;
203
+ /** Additional data to include */
204
+ data?: Record<string, unknown>;
205
+ /** Include current active states */
206
+ includeStates?: boolean;
207
+ /** Include element state */
208
+ elementId?: string;
209
+ }
210
+ /**
211
+ * Workflow step definition
212
+ */
213
+ interface WorkflowStep {
214
+ /** Step identifier */
215
+ id: string;
216
+ /** Type of step */
217
+ type: WorkflowStepType;
218
+ /** Target element or component ID */
219
+ target?: string;
220
+ /** Action to execute */
221
+ action?: string;
222
+ /** Action parameters */
223
+ params?: Record<string, unknown>;
224
+ /** Wait conditions */
225
+ waitOptions?: WaitOptions;
226
+ /** Expected state for assertions */
227
+ expectedState?: Partial<ElementState>;
228
+ /** Custom step handler */
229
+ handler?: () => unknown | Promise<unknown>;
230
+ /** Target states for navigation (type: 'navigate') */
231
+ targetStates?: string[];
232
+ /** Branch condition (type: 'branch') */
233
+ branchCondition?: BranchCondition;
234
+ /** Steps to execute if branch condition is true */
235
+ thenSteps?: WorkflowStep[];
236
+ /** Steps to execute if branch condition is false */
237
+ elseSteps?: WorkflowStep[];
238
+ /** Loop configuration (type: 'loop') */
239
+ loopConfig?: LoopConfig;
240
+ /** Steps to execute in loop */
241
+ loopSteps?: WorkflowStep[];
242
+ /** Extract configuration (type: 'extract') */
243
+ extractConfig?: ExtractConfig;
244
+ /** Log configuration (type: 'log') */
245
+ logConfig?: LogConfig;
246
+ }
247
+ /**
248
+ * Workflow definition
249
+ */
250
+ interface Workflow {
251
+ /** Unique identifier */
252
+ id: string;
253
+ /** Human-readable name */
254
+ name: string;
255
+ /** Description of what the workflow does */
256
+ description?: string;
257
+ /** Steps to execute */
258
+ steps: WorkflowStep[];
259
+ /** Default parameters for the workflow */
260
+ defaultParams?: Record<string, unknown>;
261
+ }
262
+ /**
263
+ * Wait options for actions
264
+ */
265
+ interface WaitOptions {
266
+ /** Wait for element to be visible */
267
+ visible?: boolean;
268
+ /** Wait for element to be enabled */
269
+ enabled?: boolean;
270
+ /** Wait for element to have focus */
271
+ focused?: boolean;
272
+ /** Wait for element state to match */
273
+ state?: Partial<ElementState>;
274
+ /** Timeout in milliseconds */
275
+ timeout?: number;
276
+ /** Polling interval in milliseconds */
277
+ interval?: number;
278
+ }
279
+ /**
280
+ * Action request sent to the control API
281
+ */
282
+ interface ActionRequest {
283
+ /** Action to execute */
284
+ action: StandardAction | string;
285
+ /** Action parameters */
286
+ params?: {
287
+ /** Text to type */
288
+ text?: string;
289
+ /** Value to select */
290
+ value?: string;
291
+ /** Scroll offset */
292
+ offset?: {
293
+ x: number;
294
+ y: number;
295
+ };
296
+ /** Key modifiers */
297
+ modifiers?: {
298
+ ctrl?: boolean;
299
+ shift?: boolean;
300
+ alt?: boolean;
301
+ meta?: boolean;
302
+ };
303
+ /** Additional custom parameters */
304
+ [key: string]: unknown;
305
+ };
306
+ /** Wait options before executing */
307
+ waitOptions?: WaitOptions;
308
+ }
309
+ /**
310
+ * Response from an action execution
311
+ */
312
+ interface ActionResponse {
313
+ /** Whether the action succeeded */
314
+ success: boolean;
315
+ /** Element state after the action */
316
+ elementState?: ElementState;
317
+ /** Result of the action (for custom actions) */
318
+ result?: unknown;
319
+ /** Error message if failed */
320
+ error?: string;
321
+ /** Stack trace if failed */
322
+ stack?: string;
323
+ /** Duration of the action in milliseconds */
324
+ durationMs: number;
325
+ /** Timestamp when the action completed */
326
+ timestamp: number;
327
+ }
328
+ /**
329
+ * Snapshot of the entire UI bridge state
330
+ */
331
+ interface BridgeSnapshot {
332
+ /** Timestamp of the snapshot */
333
+ timestamp: number;
334
+ /** All registered elements */
335
+ elements: Array<{
336
+ id: string;
337
+ type: ElementType;
338
+ label?: string;
339
+ identifier: ElementIdentifier;
340
+ state: ElementState;
341
+ actions: StandardAction[];
342
+ customActions?: string[];
343
+ }>;
344
+ /** All registered components */
345
+ components: Array<{
346
+ id: string;
347
+ name: string;
348
+ description?: string;
349
+ actions: string[];
350
+ elementIds?: string[];
351
+ }>;
352
+ /** Available workflows */
353
+ workflows: Array<{
354
+ id: string;
355
+ name: string;
356
+ description?: string;
357
+ stepCount: number;
358
+ }>;
359
+ }
360
+ /**
361
+ * UI Bridge feature flags
362
+ */
363
+ interface UIBridgeFeatures {
364
+ /** Enable render logging (DOM observation) */
365
+ renderLog?: boolean;
366
+ /** Enable HTTP control endpoints */
367
+ control?: boolean;
368
+ /** Enable debug tools (inspector, metrics) */
369
+ debug?: boolean;
370
+ }
371
+ /**
372
+ * UI Bridge configuration
373
+ */
374
+ interface UIBridgeConfig {
375
+ /** Port for standalone server */
376
+ serverPort?: number;
377
+ /** API path prefix for integrated servers */
378
+ apiPath?: string;
379
+ /** Enable WebSocket for real-time updates */
380
+ websocket?: boolean;
381
+ /** WebSocket port (defaults to serverPort) */
382
+ websocketPort?: number;
383
+ /** Log file path for render logs */
384
+ logFilePath?: string;
385
+ /** Maximum number of render log entries to keep */
386
+ maxLogEntries?: number;
387
+ /** Enable verbose logging */
388
+ verbose?: boolean;
389
+ }
390
+ /**
391
+ * Event types emitted by the bridge
392
+ */
393
+ type BridgeEventType = 'element:registered' | 'element:unregistered' | 'element:stateChanged' | 'component:registered' | 'component:unregistered' | 'action:started' | 'action:completed' | 'action:failed' | 'workflow:started' | 'workflow:stepCompleted' | 'workflow:completed' | 'workflow:failed' | 'render:snapshot' | 'error';
394
+ /**
395
+ * Event payload structure
396
+ */
397
+ interface BridgeEvent<T = unknown> {
398
+ type: BridgeEventType;
399
+ timestamp: number;
400
+ data: T;
401
+ }
402
+ /**
403
+ * Event listener function
404
+ */
405
+ type BridgeEventListener<T = unknown> = (event: BridgeEvent<T>) => void;
406
+ /**
407
+ * WebSocket message types from client to server
408
+ */
409
+ type WSClientMessageType = 'subscribe' | 'unsubscribe' | 'ping' | 'find' | 'discover' | 'getElement' | 'getSnapshot' | 'executeAction' | 'executeComponentAction' | 'executeWorkflow';
410
+ /**
411
+ * WebSocket message types from server to client
412
+ */
413
+ type WSServerMessageType = 'welcome' | 'pong' | 'subscribed' | 'unsubscribed' | 'event' | 'response' | 'error' | 'workflowProgress';
414
+ /**
415
+ * Base WebSocket message structure
416
+ */
417
+ interface WSMessageBase {
418
+ /** Unique message ID for request/response correlation */
419
+ id: string;
420
+ /** Message type */
421
+ type: WSClientMessageType | WSServerMessageType;
422
+ /** Timestamp when message was created */
423
+ timestamp: number;
424
+ }
425
+ /**
426
+ * Client message: Subscribe to events
427
+ */
428
+ interface WSSubscribeMessage extends WSMessageBase {
429
+ type: 'subscribe';
430
+ payload: {
431
+ /** Event types to subscribe to (empty = all events) */
432
+ events?: BridgeEventType[];
433
+ /** Filter events by element ID */
434
+ elementIds?: string[];
435
+ /** Filter events by component ID */
436
+ componentIds?: string[];
437
+ };
438
+ }
439
+ /**
440
+ * Client message: Unsubscribe from events
441
+ */
442
+ interface WSUnsubscribeMessage extends WSMessageBase {
443
+ type: 'unsubscribe';
444
+ payload: {
445
+ /** Event types to unsubscribe from (empty = all) */
446
+ events?: BridgeEventType[];
447
+ };
448
+ }
449
+ /**
450
+ * Client message: Ping (keepalive)
451
+ */
452
+ interface WSPingMessage extends WSMessageBase {
453
+ type: 'ping';
454
+ }
455
+ /**
456
+ * Client message: Find elements
457
+ */
458
+ interface WSFindMessage extends WSMessageBase {
459
+ type: 'find';
460
+ payload?: {
461
+ interactiveOnly?: boolean;
462
+ includeState?: boolean;
463
+ selector?: string;
464
+ };
465
+ }
466
+ /**
467
+ * Client message: Discover elements
468
+ * @deprecated Use WSFindMessage instead
469
+ */
470
+ interface WSDiscoverMessage extends WSMessageBase {
471
+ type: 'discover';
472
+ payload?: {
473
+ interactiveOnly?: boolean;
474
+ includeState?: boolean;
475
+ selector?: string;
476
+ };
477
+ }
478
+ /**
479
+ * Client message: Get element details
480
+ */
481
+ interface WSGetElementMessage extends WSMessageBase {
482
+ type: 'getElement';
483
+ payload: {
484
+ elementId: string;
485
+ includeState?: boolean;
486
+ };
487
+ }
488
+ /**
489
+ * Client message: Get full snapshot
490
+ */
491
+ interface WSGetSnapshotMessage extends WSMessageBase {
492
+ type: 'getSnapshot';
493
+ }
494
+ /**
495
+ * Client message: Execute action on element
496
+ */
497
+ interface WSExecuteActionMessage extends WSMessageBase {
498
+ type: 'executeAction';
499
+ payload: {
500
+ elementId: string;
501
+ action: ActionRequest;
502
+ };
503
+ }
504
+ /**
505
+ * Client message: Execute component action
506
+ */
507
+ interface WSExecuteComponentActionMessage extends WSMessageBase {
508
+ type: 'executeComponentAction';
509
+ payload: {
510
+ componentId: string;
511
+ action: string;
512
+ params?: Record<string, unknown>;
513
+ };
514
+ }
515
+ /**
516
+ * Client message: Execute workflow
517
+ */
518
+ interface WSExecuteWorkflowMessage extends WSMessageBase {
519
+ type: 'executeWorkflow';
520
+ payload: {
521
+ workflowId: string;
522
+ params?: Record<string, unknown>;
523
+ /** Stream progress updates */
524
+ streamProgress?: boolean;
525
+ };
526
+ }
527
+ /**
528
+ * Union type for all client messages
529
+ */
530
+ type WSClientMessage = WSSubscribeMessage | WSUnsubscribeMessage | WSPingMessage | WSFindMessage | WSDiscoverMessage | WSGetElementMessage | WSGetSnapshotMessage | WSExecuteActionMessage | WSExecuteComponentActionMessage | WSExecuteWorkflowMessage;
531
+ /**
532
+ * Server message: Welcome (sent on connection)
533
+ */
534
+ interface WSWelcomeMessage extends WSMessageBase {
535
+ type: 'welcome';
536
+ payload: {
537
+ /** Server version */
538
+ version: string;
539
+ /** Available features */
540
+ features: UIBridgeFeatures;
541
+ /** Client ID assigned by server */
542
+ clientId: string;
543
+ };
544
+ }
545
+ /**
546
+ * Server message: Pong (response to ping)
547
+ */
548
+ interface WSPongMessage extends WSMessageBase {
549
+ type: 'pong';
550
+ }
551
+ /**
552
+ * Server message: Subscription confirmed
553
+ */
554
+ interface WSSubscribedMessage extends WSMessageBase {
555
+ type: 'subscribed';
556
+ payload: {
557
+ /** Events now subscribed to */
558
+ events: BridgeEventType[];
559
+ };
560
+ }
561
+ /**
562
+ * Server message: Unsubscription confirmed
563
+ */
564
+ interface WSUnsubscribedMessage extends WSMessageBase {
565
+ type: 'unsubscribed';
566
+ payload: {
567
+ /** Events unsubscribed from */
568
+ events: BridgeEventType[];
569
+ };
570
+ }
571
+ /**
572
+ * Server message: Event notification
573
+ */
574
+ interface WSEventMessage extends WSMessageBase {
575
+ type: 'event';
576
+ payload: BridgeEvent;
577
+ }
578
+ /**
579
+ * Server message: Response to a request
580
+ */
581
+ interface WSResponseMessage<T = unknown> extends WSMessageBase {
582
+ type: 'response';
583
+ /** ID of the request this responds to */
584
+ requestId: string;
585
+ payload: {
586
+ success: boolean;
587
+ data?: T;
588
+ error?: string;
589
+ };
590
+ }
591
+ /**
592
+ * Server message: Error
593
+ */
594
+ interface WSErrorMessage extends WSMessageBase {
595
+ type: 'error';
596
+ /** ID of the request that caused the error (if applicable) */
597
+ requestId?: string;
598
+ payload: {
599
+ code: string;
600
+ message: string;
601
+ details?: unknown;
602
+ };
603
+ }
604
+ /**
605
+ * Server message: Workflow progress update
606
+ */
607
+ interface WSWorkflowProgressMessage extends WSMessageBase {
608
+ type: 'workflowProgress';
609
+ /** ID of the workflow execution request */
610
+ requestId: string;
611
+ payload: {
612
+ workflowId: string;
613
+ /** Current step index (0-based) */
614
+ currentStep: number;
615
+ /** Total number of steps */
616
+ totalSteps: number;
617
+ /** Current step info */
618
+ step: {
619
+ id: string;
620
+ type: WorkflowStep['type'];
621
+ status: 'pending' | 'running' | 'completed' | 'failed';
622
+ };
623
+ /** Result of the current step (if completed) */
624
+ stepResult?: unknown;
625
+ /** Error (if failed) */
626
+ error?: string;
627
+ };
628
+ }
629
+ /**
630
+ * Union type for all server messages
631
+ */
632
+ type WSServerMessage = WSWelcomeMessage | WSPongMessage | WSSubscribedMessage | WSUnsubscribedMessage | WSEventMessage | WSResponseMessage | WSErrorMessage | WSWorkflowProgressMessage;
633
+ /**
634
+ * WebSocket connection state
635
+ */
636
+ type WSConnectionState = 'connecting' | 'connected' | 'disconnected' | 'reconnecting';
637
+ /**
638
+ * WebSocket client configuration
639
+ */
640
+ interface WSClientConfig {
641
+ /** WebSocket server URL */
642
+ url: string;
643
+ /** Auto-reconnect on disconnect */
644
+ autoReconnect?: boolean;
645
+ /** Reconnect delay in milliseconds */
646
+ reconnectDelay?: number;
647
+ /** Maximum reconnect attempts (0 = infinite) */
648
+ maxReconnectAttempts?: number;
649
+ /** Ping interval in milliseconds (0 = disabled) */
650
+ pingInterval?: number;
651
+ /** Connection timeout in milliseconds */
652
+ connectionTimeout?: number;
653
+ }
654
+ /**
655
+ * Subscription options for WebSocket client
656
+ */
657
+ interface WSSubscriptionOptions {
658
+ /** Event types to subscribe to */
659
+ events?: BridgeEventType[];
660
+ /** Filter by element IDs */
661
+ elementIds?: string[];
662
+ /** Filter by component IDs */
663
+ componentIds?: string[];
664
+ }
665
+ /**
666
+ * UI State definition
667
+ *
668
+ * Represents a distinct state in the UI (e.g., "LoginForm", "Dashboard", "Modal").
669
+ * States can be active or inactive, and can block other states from activating.
670
+ */
671
+ interface UIState {
672
+ /** Unique state identifier */
673
+ id: string;
674
+ /** Human-readable name */
675
+ name: string;
676
+ /** Element IDs belonging to this state */
677
+ elements: string[];
678
+ /** Optional function to detect if state is active */
679
+ activeWhen?: () => boolean;
680
+ /** If true, blocks other state activations (modal behavior) */
681
+ blocking?: boolean;
682
+ /** Specific state IDs this state blocks */
683
+ blocks?: string[];
684
+ /** State group membership */
685
+ group?: string;
686
+ /** Cost for pathfinding (default: 1.0) */
687
+ pathCost?: number;
688
+ /** Custom metadata */
689
+ metadata?: Record<string, unknown>;
690
+ }
691
+ /**
692
+ * State group - states that activate/deactivate atomically
693
+ *
694
+ * When a group is activated, all its states are activated together.
695
+ * When deactivated, all states are deactivated together.
696
+ */
697
+ interface UIStateGroup {
698
+ /** Unique group identifier */
699
+ id: string;
700
+ /** Human-readable name */
701
+ name: string;
702
+ /** State IDs belonging to this group */
703
+ states: string[];
704
+ }
705
+ /**
706
+ * State transition definition
707
+ *
708
+ * Defines how to move from one set of states to another,
709
+ * including any actions to execute during the transition.
710
+ */
711
+ interface UITransition {
712
+ /** Unique transition identifier */
713
+ id: string;
714
+ /** Human-readable name */
715
+ name: string;
716
+ /** Precondition: at least one must be active */
717
+ fromStates: string[];
718
+ /** States to activate */
719
+ activateStates: string[];
720
+ /** States to deactivate */
721
+ exitStates: string[];
722
+ /** Groups to activate */
723
+ activateGroups?: string[];
724
+ /** Groups to deactivate */
725
+ exitGroups?: string[];
726
+ /** Actions to execute during transition */
727
+ actions?: WorkflowStep[];
728
+ /** Cost for pathfinding */
729
+ pathCost?: number;
730
+ /** Whether source states remain visible during transition */
731
+ staysVisible?: boolean;
732
+ }
733
+ /**
734
+ * Path result from pathfinding
735
+ *
736
+ * Returned when searching for a path to target states.
737
+ */
738
+ interface PathResult {
739
+ /** Whether a path was found */
740
+ found: boolean;
741
+ /** Transition IDs in order to reach target */
742
+ transitions: string[];
743
+ /** Total cost of the path */
744
+ totalCost: number;
745
+ /** Target state IDs */
746
+ targetStates: string[];
747
+ /** Estimated number of steps */
748
+ estimatedSteps: number;
749
+ }
750
+ /**
751
+ * Transition execution result
752
+ */
753
+ interface TransitionResult {
754
+ /** Whether the transition succeeded */
755
+ success: boolean;
756
+ /** States that were activated */
757
+ activatedStates: string[];
758
+ /** States that were deactivated */
759
+ deactivatedStates: string[];
760
+ /** Error message if failed */
761
+ error?: string;
762
+ /** Phase where failure occurred (if any) */
763
+ failedPhase?: string;
764
+ /** Duration of the transition in milliseconds */
765
+ durationMs: number;
766
+ }
767
+ /**
768
+ * Navigation result
769
+ *
770
+ * Returned after navigating to target states via pathfinding.
771
+ */
772
+ interface NavigationResult {
773
+ /** Whether navigation succeeded */
774
+ success: boolean;
775
+ /** The path that was followed */
776
+ path: PathResult;
777
+ /** Transitions that were executed */
778
+ executedTransitions: string[];
779
+ /** Final active states after navigation */
780
+ finalActiveStates: string[];
781
+ /** Error message if failed */
782
+ error?: string;
783
+ /** Duration of the navigation in milliseconds */
784
+ durationMs: number;
785
+ }
786
+ /**
787
+ * State manager snapshot
788
+ */
789
+ interface StateSnapshot {
790
+ /** Timestamp of the snapshot */
791
+ timestamp: number;
792
+ /** Currently active state IDs */
793
+ activeStates: string[];
794
+ /** All registered states */
795
+ states: UIState[];
796
+ /** All registered state groups */
797
+ groups: UIStateGroup[];
798
+ /** All registered transitions */
799
+ transitions: UITransition[];
800
+ }
801
+
802
+ export type { WSWorkflowProgressMessage as $, ActionHandler as A, BranchCondition as B, ComponentAction as C, WSFindMessage as D, ElementIdentifier as E, WSGetElementMessage as F, WSGetSnapshotMessage as G, WSMessageBase as H, WSPingMessage as I, WSPongMessage as J, WSResponseMessage as K, LogConfig as L, WSServerMessage as M, NavigationResult as N, WSServerMessageType as O, PathResult as P, WSSubscribeMessage as Q, RegisteredComponent as R, StandardAction as S, TransitionResult as T, UIBridgeConfig as U, WSSubscribedMessage as V, WSClientConfig as W, WSSubscriptionOptions as X, WSUnsubscribeMessage as Y, WSUnsubscribedMessage as Z, WSWelcomeMessage as _, ActionRequest as a, WaitOptions as a0, Workflow as a1, WorkflowStep as a2, WorkflowStepType as a3, ActionResponse as b, BridgeEvent as c, BridgeEventListener as d, BridgeEventType as e, BridgeSnapshot as f, CustomAction as g, ElementState as h, ElementType as i, ExtractConfig as j, LoopConfig as k, RegisteredElement as l, StateSnapshot as m, UIBridgeFeatures as n, UIState as o, UIStateGroup as p, UITransition as q, WSClientMessage as r, WSClientMessageType as s, WSConnectionState as t, WSDiscoverMessage as u, WSErrorMessage as v, WSEventMessage as w, WSExecuteActionMessage as x, WSExecuteComponentActionMessage as y, WSExecuteWorkflowMessage as z };