@qontinui/ui-bridge 0.2.0 → 0.3.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 (140) hide show
  1. package/dist/ai/index.d.mts +312 -155
  2. package/dist/ai/index.d.ts +312 -155
  3. package/dist/ai/index.js +2363 -67
  4. package/dist/ai/index.js.map +1 -1
  5. package/dist/ai/index.mjs +2328 -68
  6. package/dist/ai/index.mjs.map +1 -1
  7. package/dist/annotations/index.d.mts +218 -0
  8. package/dist/annotations/index.d.ts +218 -0
  9. package/dist/annotations/index.js +246 -0
  10. package/dist/annotations/index.js.map +1 -0
  11. package/dist/annotations/index.mjs +241 -0
  12. package/dist/annotations/index.mjs.map +1 -0
  13. package/dist/assertions-BSR3afVr.d.ts +161 -0
  14. package/dist/assertions-CTw1hfOx.d.mts +161 -0
  15. package/dist/babel-plugin/index.js +504 -0
  16. package/dist/babel-plugin/index.js.map +1 -0
  17. package/dist/babel-plugin/index.mjs +488 -0
  18. package/dist/babel-plugin/index.mjs.map +1 -0
  19. package/dist/browser-capture-Bms60T6f.d.mts +47 -0
  20. package/dist/browser-capture-CsTU29mb.d.ts +47 -0
  21. package/dist/control/index.d.mts +26 -7
  22. package/dist/control/index.d.ts +26 -7
  23. package/dist/control/index.js +276 -48
  24. package/dist/control/index.js.map +1 -1
  25. package/dist/control/index.mjs +276 -48
  26. package/dist/control/index.mjs.map +1 -1
  27. package/dist/core/index.d.mts +115 -44
  28. package/dist/core/index.d.ts +115 -44
  29. package/dist/core/index.js +0 -1560
  30. package/dist/core/index.js.map +1 -1
  31. package/dist/core/index.mjs +1 -1549
  32. package/dist/core/index.mjs.map +1 -1
  33. package/dist/debug/index.d.mts +5 -3
  34. package/dist/debug/index.d.ts +5 -3
  35. package/dist/debug/index.js +925 -1
  36. package/dist/debug/index.js.map +1 -1
  37. package/dist/debug/index.mjs +924 -2
  38. package/dist/debug/index.mjs.map +1 -1
  39. package/dist/index.d.mts +13 -9
  40. package/dist/index.d.ts +13 -9
  41. package/dist/index.js +8310 -3777
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +8246 -3766
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/{metrics-NC3csD0R.d.mts → metrics-DuA2qIIz.d.mts} +2 -2
  46. package/dist/{metrics-C9XRi_mL.d.ts → metrics-KFAAKNEB.d.ts} +2 -2
  47. package/dist/native/control/index.js +448 -0
  48. package/dist/native/control/index.js.map +1 -0
  49. package/dist/native/control/index.mjs +445 -0
  50. package/dist/native/control/index.mjs.map +1 -0
  51. package/dist/native/core/index.js +486 -0
  52. package/dist/native/core/index.js.map +1 -0
  53. package/dist/native/core/index.mjs +475 -0
  54. package/dist/native/core/index.mjs.map +1 -0
  55. package/dist/native/debug/index.js +408 -0
  56. package/dist/native/debug/index.js.map +1 -0
  57. package/dist/native/debug/index.mjs +406 -0
  58. package/dist/native/debug/index.mjs.map +1 -0
  59. package/dist/native/index.js +2232 -0
  60. package/dist/native/index.js.map +1 -0
  61. package/dist/native/index.mjs +2204 -0
  62. package/dist/native/index.mjs.map +1 -0
  63. package/dist/native/react/index.js +1377 -0
  64. package/dist/native/react/index.js.map +1 -0
  65. package/dist/native/react/index.mjs +1365 -0
  66. package/dist/native/react/index.mjs.map +1 -0
  67. package/dist/native/server/index.js +440 -0
  68. package/dist/native/server/index.js.map +1 -0
  69. package/dist/native/server/index.mjs +435 -0
  70. package/dist/native/server/index.mjs.map +1 -0
  71. package/dist/react/index.d.mts +121 -9
  72. package/dist/react/index.d.ts +121 -9
  73. package/dist/react/index.js +2239 -91
  74. package/dist/react/index.js.map +1 -1
  75. package/dist/react/index.mjs +2239 -92
  76. package/dist/react/index.mjs.map +1 -1
  77. package/dist/{registry-CIEDjbQ9.d.ts → registry-C6dDtn1v.d.ts} +34 -15
  78. package/dist/{registry-SsSDq46X.d.mts → registry-POtcxnal.d.mts} +34 -15
  79. package/dist/render-log/index.d.mts +1 -1
  80. package/dist/render-log/index.d.ts +1 -1
  81. package/dist/server/express.d.mts +37 -0
  82. package/dist/server/express.d.ts +37 -0
  83. package/dist/server/express.js +298 -0
  84. package/dist/server/express.js.map +1 -0
  85. package/dist/server/express.mjs +294 -0
  86. package/dist/server/express.mjs.map +1 -0
  87. package/dist/server/handlers.d.mts +124 -0
  88. package/dist/server/handlers.d.ts +124 -0
  89. package/dist/server/handlers.js +7183 -0
  90. package/dist/server/handlers.js.map +1 -0
  91. package/dist/server/handlers.mjs +7180 -0
  92. package/dist/server/handlers.mjs.map +1 -0
  93. package/dist/server/index.d.mts +12 -0
  94. package/dist/server/index.d.ts +12 -0
  95. package/dist/server/index.js +8384 -0
  96. package/dist/server/index.js.map +1 -0
  97. package/dist/server/index.mjs +8369 -0
  98. package/dist/server/index.mjs.map +1 -0
  99. package/dist/server/nextjs.d.mts +128 -0
  100. package/dist/server/nextjs.d.ts +128 -0
  101. package/dist/server/nextjs.js +390 -0
  102. package/dist/server/nextjs.js.map +1 -0
  103. package/dist/server/nextjs.mjs +385 -0
  104. package/dist/server/nextjs.mjs.map +1 -0
  105. package/dist/server/standalone.d.mts +7 -0
  106. package/dist/server/standalone.d.ts +7 -0
  107. package/dist/server/standalone.js +845 -0
  108. package/dist/server/standalone.js.map +1 -0
  109. package/dist/server/standalone.mjs +841 -0
  110. package/dist/server/standalone.mjs.map +1 -0
  111. package/dist/specs/index.d.mts +365 -0
  112. package/dist/specs/index.d.ts +365 -0
  113. package/dist/specs/index.js +2809 -0
  114. package/dist/specs/index.js.map +1 -0
  115. package/dist/specs/index.mjs +2786 -0
  116. package/dist/specs/index.mjs.map +1 -0
  117. package/dist/standalone-B6GLIEmR.d.ts +216 -0
  118. package/dist/standalone-CjdYqj3P.d.mts +216 -0
  119. package/dist/swc-plugin/index.d.mts +79 -0
  120. package/dist/swc-plugin/index.d.ts +79 -0
  121. package/dist/swc-plugin/index.js +15 -0
  122. package/dist/swc-plugin/index.js.map +1 -0
  123. package/dist/swc-plugin/index.mjs +9 -0
  124. package/dist/swc-plugin/index.mjs.map +1 -0
  125. package/dist/types-B2EfvEaq.d.ts +236 -0
  126. package/dist/{types-Dr6tH-bm.d.mts → types-C7gVYRnF.d.ts} +72 -2
  127. package/dist/{types-oCTrRxSw.d.ts → types-CJGrBEhC.d.mts} +72 -2
  128. package/dist/types-CebMQj76.d.ts +1275 -0
  129. package/dist/types-D_ypYl3T.d.mts +1275 -0
  130. package/dist/types-UBtp7R0u.d.mts +132 -0
  131. package/dist/types-UBtp7R0u.d.ts +132 -0
  132. package/dist/types-gO696T_t.d.mts +236 -0
  133. package/dist/{types-CPMbN_Iw.d.mts → types-suaYwWWg.d.mts} +519 -152
  134. package/dist/{types-CPMbN_Iw.d.ts → types-suaYwWWg.d.ts} +519 -152
  135. package/package.json +123 -4
  136. package/swc-plugin-wasm/ui_bridge_swc_plugin.wasm +0 -0
  137. package/dist/types-BvCfFuEV.d.ts +0 -534
  138. package/dist/types-CFT3Dnx4.d.mts +0 -534
  139. package/dist/websocket-client-CX4QJesI.d.ts +0 -124
  140. package/dist/websocket-client-C_Na0OSp.d.mts +0 -124
@@ -1,12 +1,13 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
- import { n as UIBridgeFeatures, U as UIBridgeConfig, t as WSConnectionState, l as RegisteredElement, R as RegisteredComponent, f as BridgeSnapshot, e as BridgeEventType, d as BridgeEventListener, X as WSSubscriptionOptions, c as BridgeEvent, i as ElementType, S as StandardAction, g as CustomAction, h as ElementState, E as ElementIdentifier, a1 as Workflow, p as UIStateGroup, o as UIState, m as StateSnapshot, a2 as WorkflowStep, T as TransitionResult, q as UITransition, N as NavigationResult, P as PathResult } from '../types-CPMbN_Iw.mjs';
4
- import { U as UIBridgeRegistry } from '../registry-SsSDq46X.mjs';
5
- import { U as UIBridgeWSClient } from '../websocket-client-C_Na0OSp.mjs';
3
+ import { a2 as UIBridgeFeatures, a1 as UIBridgeConfig, aa as WSConnectionState, X as RegisteredElement, W as RegisteredComponent, m as BridgeSnapshot, l as BridgeEventType, k as BridgeEventListener, as as WSSubscriptionOptions, j as BridgeEvent, Q as OnBrowserEventCallback, n as BrowserCaptureConfig, F as ElementType, Z as StandardAction, x as CustomAction, z as ElementState, y as ElementIdentifier, az as Workflow, a4 as UIStateGroup, a3 as UIState, $ as StateSnapshot, aA as WorkflowStep, a0 as TransitionResult, a5 as UITransition, O as NavigationResult, T as PathResult, v as ContentRole } from '../types-suaYwWWg.mjs';
4
+ import { U as UIBridgeRegistry } from '../registry-POtcxnal.mjs';
5
+ import { UIBridgeWSClient } from '../core/index.mjs';
6
6
  import { RenderLogManager } from '../render-log/index.mjs';
7
- import { M as MetricsCollector } from '../metrics-NC3csD0R.mjs';
8
- import { A as ActionExecutor, i as WorkflowEngine, b as ControlActionRequest, c as ControlActionResponse, C as ComponentActionRequest, a as ComponentActionResponse, F as FindRequest, g as FindResponse, j as WorkflowRunRequest, k as WorkflowRunResponse } from '../types-Dr6tH-bm.mjs';
9
- import '../types-CFT3Dnx4.mjs';
7
+ import { M as MetricsCollector } from '../metrics-DuA2qIIz.mjs';
8
+ import { A as ActionExecutor, k as WorkflowEngine, b as ControlActionRequest, c as ControlActionResponse, C as ComponentActionRequest, a as ComponentActionResponse, F as FindRequest, h as FindResponse, l as WorkflowRunRequest, m as WorkflowRunResponse } from '../types-CJGrBEhC.mjs';
9
+ import { E as ElementAnnotation } from '../types-UBtp7R0u.mjs';
10
+ import '../types-D_ypYl3T.mjs';
10
11
 
11
12
  /**
12
13
  * UI Bridge context value
@@ -36,6 +37,8 @@ interface UIBridgeContextValue {
36
37
  getComponents: () => RegisteredComponent[];
37
38
  /** Create a snapshot */
38
39
  createSnapshot: () => BridgeSnapshot;
40
+ /** Create a snapshot asynchronously (non-blocking) */
41
+ createSnapshotAsync: (batchSize?: number) => Promise<BridgeSnapshot>;
39
42
  /** Subscribe to events */
40
43
  on: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => () => void;
41
44
  /** Unsubscribe from events */
@@ -63,13 +66,17 @@ interface UIBridgeProviderProps {
63
66
  config?: UIBridgeConfig;
64
67
  /** Event handler */
65
68
  onEvent?: BridgeEventListener;
69
+ /** Callback fired for each captured browser event */
70
+ onBrowserEvent?: OnBrowserEventCallback;
71
+ /** Configuration for browser event capture sub-modules */
72
+ browserCaptureConfig?: BrowserCaptureConfig;
66
73
  }
67
74
  /**
68
75
  * UI Bridge Provider
69
76
  *
70
77
  * Provides UI Bridge context to child components.
71
78
  */
72
- declare function UIBridgeProvider({ children, features, config, onEvent, }: UIBridgeProviderProps): react_jsx_runtime.JSX.Element;
79
+ declare function UIBridgeProvider({ children, features, config, onEvent, onBrowserEvent, browserCaptureConfig, }: UIBridgeProviderProps): react_jsx_runtime.JSX.Element;
73
80
  /**
74
81
  * useUIBridgeContext hook
75
82
  *
@@ -181,6 +188,15 @@ interface ComponentActionDef<TParams = unknown, TResult = unknown> {
181
188
  /** Handler function */
182
189
  handler: (params?: TParams) => TResult | Promise<TResult>;
183
190
  }
191
+ /**
192
+ * Computed property definition for useUIComponent
193
+ */
194
+ interface ComputedPropertyDef<T = unknown> {
195
+ /** Getter function for the computed value */
196
+ getter: () => T;
197
+ /** Description of what the computed property represents */
198
+ description?: string;
199
+ }
184
200
  /**
185
201
  * useUIComponent options
186
202
  */
@@ -197,6 +213,10 @@ interface UseUIComponentOptions {
197
213
  elementIds?: string[];
198
214
  /** Whether to automatically register on mount */
199
215
  autoRegister?: boolean;
216
+ /** Function to get the current component state */
217
+ state?: () => Record<string, unknown>;
218
+ /** Computed properties exposed by the component */
219
+ computed?: Record<string, ComputedPropertyDef | (() => unknown)>;
200
220
  }
201
221
  /**
202
222
  * useUIComponent return value
@@ -296,6 +316,8 @@ interface UseUIBridgeReturn {
296
316
  workflows: Workflow[];
297
317
  /** Create a snapshot of the current state */
298
318
  createSnapshot: () => BridgeSnapshot;
319
+ /** Create a snapshot asynchronously (non-blocking, yields between batches) */
320
+ createSnapshotAsync: (batchSize?: number) => Promise<BridgeSnapshot>;
299
321
  /** Execute an action on an element */
300
322
  executeAction: (elementId: string, request: ControlActionRequest) => Promise<ControlActionResponse>;
301
323
  /** Execute an action on a component */
@@ -702,6 +724,36 @@ declare function useCanNavigateTo(targetStates: string[]): boolean;
702
724
  */
703
725
  declare function useNavigationPath(targetStates: string[]): PathResult;
704
726
 
727
+ /**
728
+ * Content Discovery
729
+ *
730
+ * Discovers static text content elements (headings, paragraphs, table cells, etc.)
731
+ * and generates stable IDs and semantic metadata for AI consumption.
732
+ *
733
+ * Separate from the interactive element discovery in useAutoRegister.ts —
734
+ * content elements have no interactive actions and use ContentType instead of ElementType.
735
+ */
736
+
737
+ /**
738
+ * Options for content discovery
739
+ */
740
+ interface ContentDiscoveryOptions {
741
+ /** Enable content discovery (default: true) */
742
+ enabled?: boolean;
743
+ /** Additional CSS selectors to include */
744
+ includeContentSelectors?: string[];
745
+ /** Additional CSS selectors to exclude */
746
+ excludeContentSelectors?: string[];
747
+ /** Minimum text length to register (default: 1) */
748
+ minTextLength?: number;
749
+ /** Maximum content elements to register (default: 500) */
750
+ maxContentElements?: number;
751
+ /** Debounce interval for content registration (default: 250ms) */
752
+ contentDebounceMs?: number;
753
+ /** Only register elements with these content roles */
754
+ contentRoles?: ContentRole[];
755
+ }
756
+
705
757
  /**
706
758
  * useAutoRegister Hook
707
759
  *
@@ -715,6 +767,7 @@ declare function useNavigationPath(targetStates: string[]): PathResult;
715
767
  * - Debounced updates for performance
716
768
  * - Respects existing manually registered elements
717
769
  */
770
+
718
771
  /**
719
772
  * ID generation strategy
720
773
  */
@@ -743,6 +796,8 @@ interface AutoRegisterOptions {
743
796
  onRegister?: (id: string, element: HTMLElement) => void;
744
797
  /** Callback when element is unregistered */
745
798
  onUnregister?: (id: string) => void;
799
+ /** Content discovery options (enabled by default) */
800
+ contentDiscovery?: ContentDiscoveryOptions;
746
801
  }
747
802
  /**
748
803
  * Hook for automatic element registration
@@ -769,6 +824,8 @@ interface AutoRegisterProviderProps extends Omit<AutoRegisterOptions, 'root'> {
769
824
  children: ReactNode;
770
825
  /** Use this element as the observation root instead of document.body */
771
826
  scopeToChildren?: boolean;
827
+ /** Content discovery options (enabled by default) */
828
+ contentDiscovery?: ContentDiscoveryOptions;
772
829
  }
773
830
  /**
774
831
  * Provider component that enables automatic element registration.
@@ -782,6 +839,61 @@ interface AutoRegisterProviderProps extends Omit<AutoRegisterOptions, 'root'> {
782
839
  * Place this component at the root of your app (inside UIBridgeProvider)
783
840
  * for comprehensive automatic element registration.
784
841
  */
785
- declare function AutoRegisterProvider({ children, scopeToChildren, enabled, idStrategy, debounceMs, includeHidden, includeSelectors, excludeSelectors, generateId, onRegister, onUnregister, }: AutoRegisterProviderProps): react_jsx_runtime.JSX.Element;
842
+ declare function AutoRegisterProvider({ children, scopeToChildren, enabled, idStrategy, debounceMs, includeHidden, includeSelectors, excludeSelectors, generateId, onRegister, onUnregister, contentDiscovery, }: AutoRegisterProviderProps): react_jsx_runtime.JSX.Element;
843
+
844
+ /**
845
+ * useUIAnnotation Hook
846
+ *
847
+ * Registers a semantic annotation for a UI element in the global annotation store.
848
+ */
849
+
850
+ /**
851
+ * Register a semantic annotation for a UI element.
852
+ *
853
+ * The annotation is set in the global annotation store and persists
854
+ * across renders. It is NOT cleaned up on unmount because annotations
855
+ * represent persistent developer knowledge about elements.
856
+ *
857
+ * @param elementId - The UI Bridge element ID to annotate
858
+ * @param annotation - The annotation data
859
+ *
860
+ * @example Basic annotation for a button
861
+ * ```tsx
862
+ * function LoginButton() {
863
+ * useUIAnnotation('login-btn', {
864
+ * description: 'Primary login button',
865
+ * purpose: 'Submits the login form',
866
+ * tags: ['auth', 'primary-action'],
867
+ * });
868
+ *
869
+ * return <button data-ui-id="login-btn">Log In</button>;
870
+ * }
871
+ * ```
872
+ *
873
+ * @example Annotations enrich the semantic snapshot
874
+ * ```tsx
875
+ * // When an element has an annotation, the semantic snapshot includes it.
876
+ * // Without annotation, the snapshot only has DOM-derived information.
877
+ * // With annotation, the snapshot gains human-authored context.
878
+ *
879
+ * function SearchBar() {
880
+ * useUIAnnotation('search-input', {
881
+ * description: 'Global search input',
882
+ * purpose: 'Searches across all projects and workflows',
883
+ * notes: 'Debounces input by 300ms. Supports advanced query syntax.',
884
+ * tags: ['search', 'global'],
885
+ * relatedElements: ['search-results-panel', 'search-clear-btn'],
886
+ * });
887
+ *
888
+ * return <input data-ui-id="search-input" placeholder="Search..." />;
889
+ * }
890
+ *
891
+ * // The annotation data is then available via:
892
+ * // GET /annotations/search-input
893
+ * // GET /annotations/export (in the full config)
894
+ * // store.get('search-input')
895
+ * ```
896
+ */
897
+ declare function useUIAnnotation(elementId: string, annotation: ElementAnnotation): void;
786
898
 
787
- export { type AutoRegisterOptions, AutoRegisterProvider, type AutoRegisterProviderProps, type ComponentActionDef, type IdStrategy, type UIBridgeContextValue, UIBridgeProvider, type UIBridgeProviderProps, type UseUIBridgeReturn, type UseUIComponentOptions, type UseUIComponentReturn, type UseUIElementOptions, type UseUIElementReturn, type UseUINavigationReturn, type UseUIStateGroupOptions, type UseUIStateGroupReturn, type UseUIStateOptions, type UseUIStateReturn, type UseUITransitionOptions, type UseUITransitionReturn, useActiveStates, useAutoRegister, useAvailableTransitions, useCanNavigateTo, useNavigationPath, useStateSnapshot, useTransitions, useUIBridge, useUIBridgeContext, useUIBridgeOptional, useUIBridgeRequired, useUIComponent, useUIComponentAction, useUIElement, useUIElementRef, useUINavigation, useUIState, useUIStateGroup, useUITransition };
899
+ export { type AutoRegisterOptions, AutoRegisterProvider, type AutoRegisterProviderProps, type ComponentActionDef, type ComputedPropertyDef, type ContentDiscoveryOptions, type IdStrategy, type UIBridgeContextValue, UIBridgeProvider, type UIBridgeProviderProps, type UseUIBridgeReturn, type UseUIComponentOptions, type UseUIComponentReturn, type UseUIElementOptions, type UseUIElementReturn, type UseUINavigationReturn, type UseUIStateGroupOptions, type UseUIStateGroupReturn, type UseUIStateOptions, type UseUIStateReturn, type UseUITransitionOptions, type UseUITransitionReturn, useActiveStates, useAutoRegister, useAvailableTransitions, useCanNavigateTo, useNavigationPath, useStateSnapshot, useTransitions, useUIAnnotation, useUIBridge, useUIBridgeContext, useUIBridgeOptional, useUIBridgeRequired, useUIComponent, useUIComponentAction, useUIElement, useUIElementRef, useUINavigation, useUIState, useUIStateGroup, useUITransition };
@@ -1,12 +1,13 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode } from 'react';
3
- import { n as UIBridgeFeatures, U as UIBridgeConfig, t as WSConnectionState, l as RegisteredElement, R as RegisteredComponent, f as BridgeSnapshot, e as BridgeEventType, d as BridgeEventListener, X as WSSubscriptionOptions, c as BridgeEvent, i as ElementType, S as StandardAction, g as CustomAction, h as ElementState, E as ElementIdentifier, a1 as Workflow, p as UIStateGroup, o as UIState, m as StateSnapshot, a2 as WorkflowStep, T as TransitionResult, q as UITransition, N as NavigationResult, P as PathResult } from '../types-CPMbN_Iw.js';
4
- import { U as UIBridgeRegistry } from '../registry-CIEDjbQ9.js';
5
- import { U as UIBridgeWSClient } from '../websocket-client-CX4QJesI.js';
3
+ import { a2 as UIBridgeFeatures, a1 as UIBridgeConfig, aa as WSConnectionState, X as RegisteredElement, W as RegisteredComponent, m as BridgeSnapshot, l as BridgeEventType, k as BridgeEventListener, as as WSSubscriptionOptions, j as BridgeEvent, Q as OnBrowserEventCallback, n as BrowserCaptureConfig, F as ElementType, Z as StandardAction, x as CustomAction, z as ElementState, y as ElementIdentifier, az as Workflow, a4 as UIStateGroup, a3 as UIState, $ as StateSnapshot, aA as WorkflowStep, a0 as TransitionResult, a5 as UITransition, O as NavigationResult, T as PathResult, v as ContentRole } from '../types-suaYwWWg.js';
4
+ import { U as UIBridgeRegistry } from '../registry-C6dDtn1v.js';
5
+ import { UIBridgeWSClient } from '../core/index.js';
6
6
  import { RenderLogManager } from '../render-log/index.js';
7
- import { M as MetricsCollector } from '../metrics-C9XRi_mL.js';
8
- import { A as ActionExecutor, i as WorkflowEngine, b as ControlActionRequest, c as ControlActionResponse, C as ComponentActionRequest, a as ComponentActionResponse, F as FindRequest, g as FindResponse, j as WorkflowRunRequest, k as WorkflowRunResponse } from '../types-oCTrRxSw.js';
9
- import '../types-BvCfFuEV.js';
7
+ import { M as MetricsCollector } from '../metrics-KFAAKNEB.js';
8
+ import { A as ActionExecutor, k as WorkflowEngine, b as ControlActionRequest, c as ControlActionResponse, C as ComponentActionRequest, a as ComponentActionResponse, F as FindRequest, h as FindResponse, l as WorkflowRunRequest, m as WorkflowRunResponse } from '../types-C7gVYRnF.js';
9
+ import { E as ElementAnnotation } from '../types-UBtp7R0u.js';
10
+ import '../types-CebMQj76.js';
10
11
 
11
12
  /**
12
13
  * UI Bridge context value
@@ -36,6 +37,8 @@ interface UIBridgeContextValue {
36
37
  getComponents: () => RegisteredComponent[];
37
38
  /** Create a snapshot */
38
39
  createSnapshot: () => BridgeSnapshot;
40
+ /** Create a snapshot asynchronously (non-blocking) */
41
+ createSnapshotAsync: (batchSize?: number) => Promise<BridgeSnapshot>;
39
42
  /** Subscribe to events */
40
43
  on: <T = unknown>(type: BridgeEventType, listener: BridgeEventListener<T>) => () => void;
41
44
  /** Unsubscribe from events */
@@ -63,13 +66,17 @@ interface UIBridgeProviderProps {
63
66
  config?: UIBridgeConfig;
64
67
  /** Event handler */
65
68
  onEvent?: BridgeEventListener;
69
+ /** Callback fired for each captured browser event */
70
+ onBrowserEvent?: OnBrowserEventCallback;
71
+ /** Configuration for browser event capture sub-modules */
72
+ browserCaptureConfig?: BrowserCaptureConfig;
66
73
  }
67
74
  /**
68
75
  * UI Bridge Provider
69
76
  *
70
77
  * Provides UI Bridge context to child components.
71
78
  */
72
- declare function UIBridgeProvider({ children, features, config, onEvent, }: UIBridgeProviderProps): react_jsx_runtime.JSX.Element;
79
+ declare function UIBridgeProvider({ children, features, config, onEvent, onBrowserEvent, browserCaptureConfig, }: UIBridgeProviderProps): react_jsx_runtime.JSX.Element;
73
80
  /**
74
81
  * useUIBridgeContext hook
75
82
  *
@@ -181,6 +188,15 @@ interface ComponentActionDef<TParams = unknown, TResult = unknown> {
181
188
  /** Handler function */
182
189
  handler: (params?: TParams) => TResult | Promise<TResult>;
183
190
  }
191
+ /**
192
+ * Computed property definition for useUIComponent
193
+ */
194
+ interface ComputedPropertyDef<T = unknown> {
195
+ /** Getter function for the computed value */
196
+ getter: () => T;
197
+ /** Description of what the computed property represents */
198
+ description?: string;
199
+ }
184
200
  /**
185
201
  * useUIComponent options
186
202
  */
@@ -197,6 +213,10 @@ interface UseUIComponentOptions {
197
213
  elementIds?: string[];
198
214
  /** Whether to automatically register on mount */
199
215
  autoRegister?: boolean;
216
+ /** Function to get the current component state */
217
+ state?: () => Record<string, unknown>;
218
+ /** Computed properties exposed by the component */
219
+ computed?: Record<string, ComputedPropertyDef | (() => unknown)>;
200
220
  }
201
221
  /**
202
222
  * useUIComponent return value
@@ -296,6 +316,8 @@ interface UseUIBridgeReturn {
296
316
  workflows: Workflow[];
297
317
  /** Create a snapshot of the current state */
298
318
  createSnapshot: () => BridgeSnapshot;
319
+ /** Create a snapshot asynchronously (non-blocking, yields between batches) */
320
+ createSnapshotAsync: (batchSize?: number) => Promise<BridgeSnapshot>;
299
321
  /** Execute an action on an element */
300
322
  executeAction: (elementId: string, request: ControlActionRequest) => Promise<ControlActionResponse>;
301
323
  /** Execute an action on a component */
@@ -702,6 +724,36 @@ declare function useCanNavigateTo(targetStates: string[]): boolean;
702
724
  */
703
725
  declare function useNavigationPath(targetStates: string[]): PathResult;
704
726
 
727
+ /**
728
+ * Content Discovery
729
+ *
730
+ * Discovers static text content elements (headings, paragraphs, table cells, etc.)
731
+ * and generates stable IDs and semantic metadata for AI consumption.
732
+ *
733
+ * Separate from the interactive element discovery in useAutoRegister.ts —
734
+ * content elements have no interactive actions and use ContentType instead of ElementType.
735
+ */
736
+
737
+ /**
738
+ * Options for content discovery
739
+ */
740
+ interface ContentDiscoveryOptions {
741
+ /** Enable content discovery (default: true) */
742
+ enabled?: boolean;
743
+ /** Additional CSS selectors to include */
744
+ includeContentSelectors?: string[];
745
+ /** Additional CSS selectors to exclude */
746
+ excludeContentSelectors?: string[];
747
+ /** Minimum text length to register (default: 1) */
748
+ minTextLength?: number;
749
+ /** Maximum content elements to register (default: 500) */
750
+ maxContentElements?: number;
751
+ /** Debounce interval for content registration (default: 250ms) */
752
+ contentDebounceMs?: number;
753
+ /** Only register elements with these content roles */
754
+ contentRoles?: ContentRole[];
755
+ }
756
+
705
757
  /**
706
758
  * useAutoRegister Hook
707
759
  *
@@ -715,6 +767,7 @@ declare function useNavigationPath(targetStates: string[]): PathResult;
715
767
  * - Debounced updates for performance
716
768
  * - Respects existing manually registered elements
717
769
  */
770
+
718
771
  /**
719
772
  * ID generation strategy
720
773
  */
@@ -743,6 +796,8 @@ interface AutoRegisterOptions {
743
796
  onRegister?: (id: string, element: HTMLElement) => void;
744
797
  /** Callback when element is unregistered */
745
798
  onUnregister?: (id: string) => void;
799
+ /** Content discovery options (enabled by default) */
800
+ contentDiscovery?: ContentDiscoveryOptions;
746
801
  }
747
802
  /**
748
803
  * Hook for automatic element registration
@@ -769,6 +824,8 @@ interface AutoRegisterProviderProps extends Omit<AutoRegisterOptions, 'root'> {
769
824
  children: ReactNode;
770
825
  /** Use this element as the observation root instead of document.body */
771
826
  scopeToChildren?: boolean;
827
+ /** Content discovery options (enabled by default) */
828
+ contentDiscovery?: ContentDiscoveryOptions;
772
829
  }
773
830
  /**
774
831
  * Provider component that enables automatic element registration.
@@ -782,6 +839,61 @@ interface AutoRegisterProviderProps extends Omit<AutoRegisterOptions, 'root'> {
782
839
  * Place this component at the root of your app (inside UIBridgeProvider)
783
840
  * for comprehensive automatic element registration.
784
841
  */
785
- declare function AutoRegisterProvider({ children, scopeToChildren, enabled, idStrategy, debounceMs, includeHidden, includeSelectors, excludeSelectors, generateId, onRegister, onUnregister, }: AutoRegisterProviderProps): react_jsx_runtime.JSX.Element;
842
+ declare function AutoRegisterProvider({ children, scopeToChildren, enabled, idStrategy, debounceMs, includeHidden, includeSelectors, excludeSelectors, generateId, onRegister, onUnregister, contentDiscovery, }: AutoRegisterProviderProps): react_jsx_runtime.JSX.Element;
843
+
844
+ /**
845
+ * useUIAnnotation Hook
846
+ *
847
+ * Registers a semantic annotation for a UI element in the global annotation store.
848
+ */
849
+
850
+ /**
851
+ * Register a semantic annotation for a UI element.
852
+ *
853
+ * The annotation is set in the global annotation store and persists
854
+ * across renders. It is NOT cleaned up on unmount because annotations
855
+ * represent persistent developer knowledge about elements.
856
+ *
857
+ * @param elementId - The UI Bridge element ID to annotate
858
+ * @param annotation - The annotation data
859
+ *
860
+ * @example Basic annotation for a button
861
+ * ```tsx
862
+ * function LoginButton() {
863
+ * useUIAnnotation('login-btn', {
864
+ * description: 'Primary login button',
865
+ * purpose: 'Submits the login form',
866
+ * tags: ['auth', 'primary-action'],
867
+ * });
868
+ *
869
+ * return <button data-ui-id="login-btn">Log In</button>;
870
+ * }
871
+ * ```
872
+ *
873
+ * @example Annotations enrich the semantic snapshot
874
+ * ```tsx
875
+ * // When an element has an annotation, the semantic snapshot includes it.
876
+ * // Without annotation, the snapshot only has DOM-derived information.
877
+ * // With annotation, the snapshot gains human-authored context.
878
+ *
879
+ * function SearchBar() {
880
+ * useUIAnnotation('search-input', {
881
+ * description: 'Global search input',
882
+ * purpose: 'Searches across all projects and workflows',
883
+ * notes: 'Debounces input by 300ms. Supports advanced query syntax.',
884
+ * tags: ['search', 'global'],
885
+ * relatedElements: ['search-results-panel', 'search-clear-btn'],
886
+ * });
887
+ *
888
+ * return <input data-ui-id="search-input" placeholder="Search..." />;
889
+ * }
890
+ *
891
+ * // The annotation data is then available via:
892
+ * // GET /annotations/search-input
893
+ * // GET /annotations/export (in the full config)
894
+ * // store.get('search-input')
895
+ * ```
896
+ */
897
+ declare function useUIAnnotation(elementId: string, annotation: ElementAnnotation): void;
786
898
 
787
- export { type AutoRegisterOptions, AutoRegisterProvider, type AutoRegisterProviderProps, type ComponentActionDef, type IdStrategy, type UIBridgeContextValue, UIBridgeProvider, type UIBridgeProviderProps, type UseUIBridgeReturn, type UseUIComponentOptions, type UseUIComponentReturn, type UseUIElementOptions, type UseUIElementReturn, type UseUINavigationReturn, type UseUIStateGroupOptions, type UseUIStateGroupReturn, type UseUIStateOptions, type UseUIStateReturn, type UseUITransitionOptions, type UseUITransitionReturn, useActiveStates, useAutoRegister, useAvailableTransitions, useCanNavigateTo, useNavigationPath, useStateSnapshot, useTransitions, useUIBridge, useUIBridgeContext, useUIBridgeOptional, useUIBridgeRequired, useUIComponent, useUIComponentAction, useUIElement, useUIElementRef, useUINavigation, useUIState, useUIStateGroup, useUITransition };
899
+ export { type AutoRegisterOptions, AutoRegisterProvider, type AutoRegisterProviderProps, type ComponentActionDef, type ComputedPropertyDef, type ContentDiscoveryOptions, type IdStrategy, type UIBridgeContextValue, UIBridgeProvider, type UIBridgeProviderProps, type UseUIBridgeReturn, type UseUIComponentOptions, type UseUIComponentReturn, type UseUIElementOptions, type UseUIElementReturn, type UseUINavigationReturn, type UseUIStateGroupOptions, type UseUIStateGroupReturn, type UseUIStateOptions, type UseUIStateReturn, type UseUITransitionOptions, type UseUITransitionReturn, useActiveStates, useAutoRegister, useAvailableTransitions, useCanNavigateTo, useNavigationPath, useStateSnapshot, useTransitions, useUIAnnotation, useUIBridge, useUIBridgeContext, useUIBridgeOptional, useUIBridgeRequired, useUIComponent, useUIComponentAction, useUIElement, useUIElementRef, useUINavigation, useUIState, useUIStateGroup, useUITransition };