@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
@@ -0,0 +1,294 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // src/server/types.ts
9
+ var UI_BRIDGE_ROUTES = [
10
+ // Render log
11
+ { method: "GET", path: "/render-log", handler: "getRenderLog" },
12
+ { method: "DELETE", path: "/render-log", handler: "clearRenderLog" },
13
+ { method: "POST", path: "/render-log/snapshot", handler: "captureSnapshot" },
14
+ { method: "GET", path: "/render-log/path", handler: "getRenderLogPath" },
15
+ // Control - Elements
16
+ { method: "GET", path: "/control/elements", handler: "getElements" },
17
+ { method: "GET", path: "/control/element/:id", handler: "getElement", params: ["id"] },
18
+ { method: "GET", path: "/control/element/:id/state", handler: "getElementState", params: ["id"] },
19
+ {
20
+ method: "POST",
21
+ path: "/control/element/:id/action",
22
+ handler: "executeElementAction",
23
+ params: ["id"],
24
+ bodyRequired: true
25
+ },
26
+ // Control - Components
27
+ { method: "GET", path: "/control/components", handler: "getComponents" },
28
+ { method: "GET", path: "/control/component/:id", handler: "getComponent", params: ["id"] },
29
+ {
30
+ method: "GET",
31
+ path: "/control/component/:id/state",
32
+ handler: "getComponentState",
33
+ params: ["id"]
34
+ },
35
+ {
36
+ method: "POST",
37
+ path: "/control/component/:id/action/:actionId",
38
+ handler: "executeComponentAction",
39
+ params: ["id", "actionId"],
40
+ bodyRequired: true
41
+ },
42
+ // Find (formerly Discovery)
43
+ { method: "POST", path: "/control/find", handler: "find" },
44
+ { method: "POST", path: "/control/discover", handler: "discover" },
45
+ // @deprecated Use /control/find
46
+ { method: "GET", path: "/control/snapshot", handler: "getControlSnapshot" },
47
+ // Workflows
48
+ { method: "GET", path: "/control/workflows", handler: "getWorkflows" },
49
+ { method: "POST", path: "/control/workflow/:id/run", handler: "runWorkflow", params: ["id"] },
50
+ {
51
+ method: "GET",
52
+ path: "/control/workflow/:runId/status",
53
+ handler: "getWorkflowStatus",
54
+ params: ["runId"]
55
+ },
56
+ // Debug
57
+ { method: "GET", path: "/debug/action-history", handler: "getActionHistory" },
58
+ { method: "GET", path: "/debug/metrics", handler: "getMetrics" },
59
+ { method: "POST", path: "/debug/highlight/:id", handler: "highlightElement", params: ["id"] },
60
+ { method: "GET", path: "/debug/element-tree", handler: "getElementTree" },
61
+ { method: "GET", path: "/control/console-errors", handler: "getConsoleErrors" },
62
+ { method: "POST", path: "/control/console-errors/clear", handler: "clearConsoleErrors" },
63
+ // AI-native endpoints
64
+ { method: "POST", path: "/ai/search", handler: "aiSearch", bodyRequired: true },
65
+ { method: "POST", path: "/ai/execute", handler: "aiExecute", bodyRequired: true },
66
+ { method: "POST", path: "/ai/assert", handler: "aiAssert", bodyRequired: true },
67
+ { method: "POST", path: "/ai/assert/batch", handler: "aiAssertBatch", bodyRequired: true },
68
+ { method: "GET", path: "/ai/snapshot", handler: "getSemanticSnapshot" },
69
+ { method: "GET", path: "/ai/diff", handler: "getSemanticDiff" },
70
+ { method: "GET", path: "/ai/summary", handler: "getPageSummary" },
71
+ { method: "POST", path: "/ai/semantic-search", handler: "aiSemanticSearch", bodyRequired: true },
72
+ // State management (static routes before parameterized)
73
+ { method: "GET", path: "/control/states", handler: "getStates" },
74
+ { method: "GET", path: "/control/states/active", handler: "getActiveStates" },
75
+ { method: "GET", path: "/control/states/snapshot", handler: "getStateSnapshot" },
76
+ { method: "POST", path: "/control/states/find-path", handler: "findPath", bodyRequired: true },
77
+ { method: "POST", path: "/control/states/navigate", handler: "navigateTo", bodyRequired: true },
78
+ { method: "GET", path: "/control/state/:id", handler: "getState", params: ["id"] },
79
+ { method: "POST", path: "/control/state/:id/activate", handler: "activateState", params: ["id"] },
80
+ {
81
+ method: "POST",
82
+ path: "/control/state/:id/deactivate",
83
+ handler: "deactivateState",
84
+ params: ["id"]
85
+ },
86
+ { method: "GET", path: "/control/state-groups", handler: "getStateGroups" },
87
+ {
88
+ method: "POST",
89
+ path: "/control/state-group/:id/activate",
90
+ handler: "activateStateGroup",
91
+ params: ["id"]
92
+ },
93
+ {
94
+ method: "POST",
95
+ path: "/control/state-group/:id/deactivate",
96
+ handler: "deactivateStateGroup",
97
+ params: ["id"]
98
+ },
99
+ { method: "GET", path: "/control/transitions", handler: "getTransitions" },
100
+ {
101
+ method: "GET",
102
+ path: "/control/transition/:id/can-execute",
103
+ handler: "canExecuteTransition",
104
+ params: ["id"]
105
+ },
106
+ {
107
+ method: "POST",
108
+ path: "/control/transition/:id/execute",
109
+ handler: "executeTransition",
110
+ params: ["id"]
111
+ },
112
+ // Intent endpoints
113
+ { method: "GET", path: "/ai/intents", handler: "listIntents" },
114
+ { method: "POST", path: "/ai/intents/execute", handler: "executeIntent", bodyRequired: true },
115
+ { method: "POST", path: "/ai/intents/find", handler: "findIntent", bodyRequired: true },
116
+ { method: "POST", path: "/ai/intents/register", handler: "registerIntent", bodyRequired: true },
117
+ {
118
+ method: "POST",
119
+ path: "/ai/intents/execute-from-query",
120
+ handler: "executeIntentFromQuery",
121
+ bodyRequired: true
122
+ },
123
+ // Recovery endpoints
124
+ {
125
+ method: "POST",
126
+ path: "/ai/recovery/attempt",
127
+ handler: "attemptRecovery",
128
+ bodyRequired: true
129
+ },
130
+ // Cross-app analysis endpoints
131
+ { method: "GET", path: "/ai/analyze/data", handler: "analyzePageData" },
132
+ { method: "GET", path: "/ai/analyze/regions", handler: "analyzePageRegions" },
133
+ { method: "GET", path: "/ai/analyze/structured-data", handler: "analyzeStructuredData" },
134
+ {
135
+ method: "POST",
136
+ path: "/ai/analyze/cross-app-compare",
137
+ handler: "crossAppCompare",
138
+ bodyRequired: true
139
+ },
140
+ // Page navigation
141
+ { method: "POST", path: "/control/page/refresh", handler: "pageRefresh" },
142
+ { method: "POST", path: "/control/page/navigate", handler: "pageNavigate", bodyRequired: true },
143
+ { method: "POST", path: "/control/page/back", handler: "pageGoBack" },
144
+ { method: "POST", path: "/control/page/forward", handler: "pageGoForward" },
145
+ // Annotations (static routes before parameterized)
146
+ { method: "GET", path: "/annotations", handler: "getAnnotations" },
147
+ { method: "GET", path: "/annotations/export", handler: "exportAnnotations" },
148
+ { method: "GET", path: "/annotations/coverage", handler: "getAnnotationCoverage" },
149
+ { method: "POST", path: "/annotations/import", handler: "importAnnotations", bodyRequired: true },
150
+ { method: "GET", path: "/annotations/:id", handler: "getAnnotation", params: ["id"] },
151
+ {
152
+ method: "PUT",
153
+ path: "/annotations/:id",
154
+ handler: "setAnnotation",
155
+ params: ["id"],
156
+ bodyRequired: true
157
+ },
158
+ { method: "DELETE", path: "/annotations/:id", handler: "deleteAnnotation", params: ["id"] },
159
+ // Performance diagnostics
160
+ { method: "GET", path: "/control/performance-entries", handler: "getPerformanceEntries" },
161
+ {
162
+ method: "POST",
163
+ path: "/control/performance-entries/clear",
164
+ handler: "clearPerformanceEntries"
165
+ },
166
+ { method: "GET", path: "/control/browser-events", handler: "getBrowserEvents" }
167
+ ];
168
+
169
+ // src/server/express.ts
170
+ function createCORSMiddleware(options) {
171
+ const corsOptions = typeof options === "boolean" ? { origin: options, methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"] } : options;
172
+ return (req, res, next) => {
173
+ if (corsOptions.origin === true) {
174
+ res.setHeader("Access-Control-Allow-Origin", "*");
175
+ } else if (typeof corsOptions.origin === "string") {
176
+ res.setHeader("Access-Control-Allow-Origin", corsOptions.origin);
177
+ } else if (Array.isArray(corsOptions.origin)) {
178
+ const origin = req.headers.origin;
179
+ if (origin && corsOptions.origin.includes(origin)) {
180
+ res.setHeader("Access-Control-Allow-Origin", origin);
181
+ }
182
+ }
183
+ if (corsOptions.methods) {
184
+ res.setHeader("Access-Control-Allow-Methods", corsOptions.methods.join(", "));
185
+ }
186
+ if (corsOptions.headers) {
187
+ res.setHeader("Access-Control-Allow-Headers", corsOptions.headers.join(", "));
188
+ } else {
189
+ res.setHeader(
190
+ "Access-Control-Allow-Headers",
191
+ "Content-Type, Authorization, X-Requested-With"
192
+ );
193
+ }
194
+ if (corsOptions.credentials) {
195
+ res.setHeader("Access-Control-Allow-Credentials", "true");
196
+ }
197
+ if (corsOptions.maxAge) {
198
+ res.setHeader("Access-Control-Max-Age", String(corsOptions.maxAge));
199
+ }
200
+ if (req.method === "OPTIONS") {
201
+ res.status(204).end();
202
+ return;
203
+ }
204
+ next();
205
+ };
206
+ }
207
+ function wrapError(error, code) {
208
+ return {
209
+ success: false,
210
+ error: typeof error === "string" ? error : error.message,
211
+ code,
212
+ timestamp: Date.now()
213
+ };
214
+ }
215
+ function createExpressRouter(handlers, config = {}) {
216
+ const express = __require("express");
217
+ const router = express.Router();
218
+ if (config.cors) {
219
+ router.use(createCORSMiddleware(config.cors));
220
+ }
221
+ if (config.useBodyParser) {
222
+ router.use(express.json());
223
+ }
224
+ if (config.authenticate) {
225
+ router.use(async (req, res, next) => {
226
+ try {
227
+ const authenticated = await config.authenticate(req);
228
+ if (!authenticated) {
229
+ res.status(401).json(wrapError("Unauthorized", "UNAUTHORIZED"));
230
+ return;
231
+ }
232
+ next();
233
+ } catch (error) {
234
+ res.status(500).json(wrapError(error, "AUTH_ERROR"));
235
+ }
236
+ });
237
+ }
238
+ for (const route of UI_BRIDGE_ROUTES) {
239
+ const method = route.method.toLowerCase();
240
+ const path = route.path;
241
+ const handlerName = route.handler;
242
+ const handler = handlers[handlerName];
243
+ if (!handler) {
244
+ console.warn(`Handler not found for route: ${route.method} ${route.path}`);
245
+ continue;
246
+ }
247
+ router[method](
248
+ path,
249
+ createRouteHandler(route, handler)
250
+ );
251
+ }
252
+ return router;
253
+ }
254
+ function createRouteHandler(route, handler) {
255
+ return async (req, res) => {
256
+ try {
257
+ const args = [];
258
+ if (route.params) {
259
+ for (const param of route.params) {
260
+ args.push(req.params[param]);
261
+ }
262
+ }
263
+ if (route.bodyRequired || route.method === "POST") {
264
+ args.push(req.body);
265
+ }
266
+ if (route.method === "GET" && Object.keys(req.query).length > 0) {
267
+ args.push(req.query);
268
+ }
269
+ const result = await handler(...args);
270
+ res.json(result);
271
+ } catch (error) {
272
+ res.status(500).json(wrapError(error, "INTERNAL_ERROR"));
273
+ }
274
+ };
275
+ }
276
+ function createExpressApp(handlers, config = {}) {
277
+ const express = __require("express");
278
+ const app = express();
279
+ app.use(express.json());
280
+ const basePath = config.basePath || "/ui-bridge";
281
+ const router = createExpressRouter(handlers, { ...config, useBodyParser: false });
282
+ app.use(basePath, router);
283
+ app.get("/health", (_req, res) => {
284
+ res.json({ status: "ok", timestamp: Date.now() });
285
+ });
286
+ return app;
287
+ }
288
+ function uiBridgeMiddleware(handlers, config = {}) {
289
+ return createExpressRouter(handlers, config);
290
+ }
291
+
292
+ export { createExpressApp, createExpressRouter, uiBridgeMiddleware };
293
+ //# sourceMappingURL=express.mjs.map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AAQ,SAAS,CAAA;AACjC,EAAA,MAAM,MAAM,OAAA,EAAQ;AAEpB,EAAA,GAAA,CAAI,GAAA,CAAI,OAAA,CAAQ,IAAA,EAAM,CAAA;AAEtB,EAAA,MAAM,QAAA,GAAW,OAAO,QAAA,IAAY,YAAA;AACpC,EAAA,MAAM,MAAA,GAAS,oBAAoB,QAAA,EAAU,EAAE,GAAG,MAAA,EAAQ,aAAA,EAAe,OAAO,CAAA;AAEhF,EAAA,GAAA,CAAI,GAAA,CAAI,UAAU,MAAM,CAAA;AAGxB,EAAA,GAAA,CAAI,GAAA,CAAI,SAAA,EAAW,CAAC,IAAA,EAAe,GAAA,KAAkB;AACnD,IAAA,GAAA,CAAI,IAAA,CAAK,EAAE,MAAA,EAAQ,IAAA,EAAM,WAAW,IAAA,CAAK,GAAA,IAAO,CAAA;AAAA,EAClD,CAAC,CAAA;AAED,EAAA,OAAO,GAAA;AACT;AAKO,SAAS,kBAAA,CACd,QAAA,EACA,MAAA,GAA+B,EAAC,EACxB;AACR,EAAA,OAAO,mBAAA,CAAoB,UAAU,MAAM,CAAA;AAC7C","file":"express.mjs","sourcesContent":["/**\n * UI Bridge Server Types\n *\n * Shared types for server adapters.\n */\n\nimport type { UIBridgeConfig } from '../core';\nimport type {\n ControlActionRequest,\n ControlActionResponse,\n ComponentActionRequest,\n ComponentActionResponse,\n FindRequest,\n FindResponse,\n ControlSnapshot,\n WorkflowRunRequest,\n WorkflowRunResponse,\n PageNavigateRequest,\n PageNavigationResponse,\n} from '../control';\nimport type { RenderLogEntry, RenderLogEntryType } from '../render-log';\nimport type {\n SearchCriteria,\n SearchResponse,\n NLActionRequest,\n NLActionResponse,\n AssertionRequest,\n AssertionResult,\n BatchAssertionRequest,\n BatchAssertionResult,\n SemanticSnapshot,\n SemanticDiff,\n SemanticSearchCriteria,\n SemanticSearchResponse,\n Intent,\n IntentSearchResponse,\n IntentExecutionResult,\n RecoveryAttemptRequest,\n RecoveryAttemptResult,\n PageDataMap,\n PageRegionMap,\n StructuredDataExtraction,\n CrossAppComparisonReport,\n ComponentInfo,\n} from '../ai';\nimport type {\n UIState,\n UIStateGroup,\n UITransition,\n PathResult,\n TransitionResult,\n NavigationResult,\n StateSnapshot,\n} from '../core';\nimport type { ElementAnnotation, AnnotationConfig, AnnotationCoverage } from '../annotations';\nimport type { CapturedError } from '../debug/browser-capture-types';\n\n/**\n * Server configuration\n */\nexport interface UIBridgeServerConfig extends UIBridgeConfig {\n /** Base path for API routes */\n basePath?: string;\n /** Enable CORS */\n cors?: boolean | CORSOptions;\n /** Authentication middleware */\n authenticate?: (req: unknown) => boolean | Promise<boolean>;\n /** Rate limiting */\n rateLimit?: RateLimitOptions;\n}\n\n/**\n * CORS options\n */\nexport interface CORSOptions {\n /** Allowed origins */\n origin?: string | string[] | boolean;\n /** Allowed methods */\n methods?: string[];\n /** Allowed headers */\n headers?: string[];\n /** Expose headers */\n exposeHeaders?: string[];\n /** Allow credentials */\n credentials?: boolean;\n /** Max age for preflight cache */\n maxAge?: number;\n}\n\n/**\n * Rate limit options\n */\nexport interface RateLimitOptions {\n /** Time window in milliseconds */\n windowMs?: number;\n /** Max requests per window */\n max?: number;\n /** Message when rate limited */\n message?: string;\n}\n\n/**\n * API response wrapper\n */\nexport interface APIResponse<T = unknown> {\n /** Whether the request succeeded */\n success: boolean;\n /** Response data */\n data?: T;\n /** Error message if failed */\n error?: string;\n /** Error code */\n code?: string;\n /** Request timestamp */\n timestamp: number;\n}\n\n/**\n * Render log query parameters\n */\nexport interface RenderLogQuery {\n /** Filter by entry type */\n type?: RenderLogEntryType;\n /** Filter entries since timestamp */\n since?: number;\n /** Filter entries until timestamp */\n until?: number;\n /** Limit number of results */\n limit?: number;\n}\n\n/**\n * Server handler interface\n *\n * Implementations provide these handlers for different frameworks.\n */\nexport interface UIBridgeServerHandlers {\n // Render log endpoints\n getRenderLog: (query?: RenderLogQuery) => Promise<APIResponse<RenderLogEntry[]>>;\n clearRenderLog: () => Promise<APIResponse<void>>;\n captureSnapshot: () => Promise<APIResponse<unknown>>;\n getRenderLogPath: () => Promise<APIResponse<{ path: string }>>;\n\n // Control endpoints\n getElements: () => Promise<APIResponse<ControlSnapshot['elements']>>;\n getElement: (id: string) => Promise<APIResponse<ControlSnapshot['elements'][0]>>;\n getElementState: (id: string) => Promise<APIResponse<unknown>>;\n executeElementAction: (\n id: string,\n request: ControlActionRequest\n ) => Promise<APIResponse<ControlActionResponse>>;\n\n // Component endpoints\n getComponents: () => Promise<APIResponse<ControlSnapshot['components']>>;\n getComponent: (id: string) => Promise<APIResponse<ControlSnapshot['components'][0]>>;\n getComponentState: (id: string) => Promise<\n APIResponse<{\n state: Record<string, unknown>;\n computed: Record<string, unknown>;\n timestamp: number;\n }>\n >;\n executeComponentAction: (\n id: string,\n request: ComponentActionRequest\n ) => Promise<APIResponse<ComponentActionResponse>>;\n\n // Find endpoints\n find: (request?: FindRequest) => Promise<APIResponse<FindResponse>>;\n /**\n * @deprecated Use find() instead\n */\n discover: (request?: FindRequest) => Promise<APIResponse<FindResponse>>;\n getControlSnapshot: () => Promise<APIResponse<ControlSnapshot>>;\n\n // Workflow endpoints\n getWorkflows: () => Promise<APIResponse<ControlSnapshot['workflows']>>;\n runWorkflow: (\n id: string,\n request?: WorkflowRunRequest\n ) => Promise<APIResponse<WorkflowRunResponse>>;\n getWorkflowStatus: (runId: string) => Promise<APIResponse<WorkflowRunResponse>>;\n\n // Debug endpoints\n getActionHistory: (limit?: number) => Promise<APIResponse<unknown[]>>;\n getMetrics: () => Promise<APIResponse<unknown>>;\n highlightElement: (id: string) => Promise<APIResponse<void>>;\n getElementTree: () => Promise<APIResponse<unknown>>;\n getConsoleErrors: (params?: {\n since?: number;\n limit?: number;\n }) => Promise<APIResponse<{ errors: CapturedError[]; count: number }>>;\n clearConsoleErrors: () => Promise<APIResponse<{ cleared: boolean }>>;\n\n // AI-native endpoints\n aiSearch: (criteria: SearchCriteria) => Promise<APIResponse<SearchResponse>>;\n aiExecute: (request: NLActionRequest) => Promise<APIResponse<NLActionResponse>>;\n aiAssert: (request: AssertionRequest) => Promise<APIResponse<AssertionResult>>;\n aiAssertBatch: (request: BatchAssertionRequest) => Promise<APIResponse<BatchAssertionResult>>;\n getSemanticSnapshot: () => Promise<APIResponse<SemanticSnapshot>>;\n getSemanticDiff: (since?: number) => Promise<APIResponse<SemanticDiff | null>>;\n getPageSummary: () => Promise<APIResponse<string>>;\n\n // Semantic search (embedding-based)\n aiSemanticSearch: (\n criteria: SemanticSearchCriteria\n ) => Promise<APIResponse<SemanticSearchResponse>>;\n\n // State management endpoints\n getStates: () => Promise<APIResponse<UIState[]>>;\n getState: (id: string) => Promise<APIResponse<UIState>>;\n getActiveStates: () => Promise<APIResponse<UIState[]>>;\n activateState: (id: string) => Promise<APIResponse<void>>;\n deactivateState: (id: string) => Promise<APIResponse<void>>;\n getStateGroups: () => Promise<APIResponse<UIStateGroup[]>>;\n activateStateGroup: (id: string) => Promise<APIResponse<void>>;\n deactivateStateGroup: (id: string) => Promise<APIResponse<void>>;\n getTransitions: () => Promise<APIResponse<UITransition[]>>;\n canExecuteTransition: (\n id: string\n ) => Promise<APIResponse<{ canExecute: boolean; reason?: string }>>;\n executeTransition: (id: string) => Promise<APIResponse<TransitionResult>>;\n findPath: (request: { targetStates: string[] }) => Promise<APIResponse<PathResult>>;\n navigateTo: (request: { targetStates: string[] }) => Promise<APIResponse<NavigationResult>>;\n getStateSnapshot: () => Promise<APIResponse<StateSnapshot>>;\n\n // Intent endpoints\n executeIntent: (request: {\n intentId: string;\n params?: Record<string, unknown>;\n }) => Promise<APIResponse<IntentExecutionResult>>;\n findIntent: (request: { query: string }) => Promise<APIResponse<IntentSearchResponse>>;\n listIntents: () => Promise<APIResponse<Intent[]>>;\n registerIntent: (intent: Intent) => Promise<APIResponse<Intent>>;\n executeIntentFromQuery: (request: {\n query: string;\n params?: Record<string, unknown>;\n }) => Promise<APIResponse<IntentExecutionResult>>;\n\n // Recovery endpoints\n attemptRecovery: (request: RecoveryAttemptRequest) => Promise<APIResponse<RecoveryAttemptResult>>;\n\n // Cross-app analysis endpoints\n analyzePageData: () => Promise<APIResponse<PageDataMap>>;\n analyzePageRegions: () => Promise<APIResponse<PageRegionMap>>;\n analyzeStructuredData: () => Promise<APIResponse<StructuredDataExtraction>>;\n crossAppCompare: (request: {\n sourceSnapshot: SemanticSnapshot;\n targetSnapshot: SemanticSnapshot;\n sourceComponents?: ComponentInfo[];\n targetComponents?: ComponentInfo[];\n }) => Promise<APIResponse<CrossAppComparisonReport>>;\n\n // Page navigation endpoints\n pageRefresh: () => Promise<APIResponse<PageNavigationResponse>>;\n pageNavigate: (request: PageNavigateRequest) => Promise<APIResponse<PageNavigationResponse>>;\n pageGoBack: () => Promise<APIResponse<PageNavigationResponse>>;\n pageGoForward: () => Promise<APIResponse<PageNavigationResponse>>;\n\n // Annotation endpoints\n getAnnotations: () => Promise<APIResponse<Record<string, ElementAnnotation>>>;\n getAnnotation: (id: string) => Promise<APIResponse<ElementAnnotation>>;\n setAnnotation: (\n id: string,\n annotation: ElementAnnotation\n ) => Promise<APIResponse<ElementAnnotation>>;\n deleteAnnotation: (id: string) => Promise<APIResponse<void>>;\n importAnnotations: (config: AnnotationConfig) => Promise<APIResponse<{ count: number }>>;\n exportAnnotations: () => Promise<APIResponse<AnnotationConfig>>;\n getAnnotationCoverage: () => Promise<APIResponse<AnnotationCoverage>>;\n\n // Performance diagnostics endpoints\n getPerformanceEntries: () => Promise<APIResponse<unknown>>;\n clearPerformanceEntries: () => Promise<APIResponse<{ cleared: boolean }>>;\n getBrowserEvents: (params?: {\n type?: string;\n since?: number;\n limit?: number;\n }) => Promise<APIResponse<{ events: unknown[]; count: number }>>;\n}\n\n/**\n * Route definition\n */\nexport interface RouteDefinition {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';\n path: string;\n handler: string; // Key in UIBridgeServerHandlers\n params?: string[]; // URL params to extract\n bodyRequired?: boolean;\n}\n\n/**\n * All UI Bridge routes\n */\nexport const UI_BRIDGE_ROUTES: RouteDefinition[] = [\n // Render log\n { method: 'GET', path: '/render-log', handler: 'getRenderLog' },\n { method: 'DELETE', path: '/render-log', handler: 'clearRenderLog' },\n { method: 'POST', path: '/render-log/snapshot', handler: 'captureSnapshot' },\n { method: 'GET', path: '/render-log/path', handler: 'getRenderLogPath' },\n\n // Control - Elements\n { method: 'GET', path: '/control/elements', handler: 'getElements' },\n { method: 'GET', path: '/control/element/:id', handler: 'getElement', params: ['id'] },\n { method: 'GET', path: '/control/element/:id/state', handler: 'getElementState', params: ['id'] },\n {\n method: 'POST',\n path: '/control/element/:id/action',\n handler: 'executeElementAction',\n params: ['id'],\n bodyRequired: true,\n },\n\n // Control - Components\n { method: 'GET', path: '/control/components', handler: 'getComponents' },\n { method: 'GET', path: '/control/component/:id', handler: 'getComponent', params: ['id'] },\n {\n method: 'GET',\n path: '/control/component/:id/state',\n handler: 'getComponentState',\n params: ['id'],\n },\n {\n method: 'POST',\n path: '/control/component/:id/action/:actionId',\n handler: 'executeComponentAction',\n params: ['id', 'actionId'],\n bodyRequired: true,\n },\n\n // Find (formerly Discovery)\n { method: 'POST', path: '/control/find', handler: 'find' },\n { method: 'POST', path: '/control/discover', handler: 'discover' }, // @deprecated Use /control/find\n { method: 'GET', path: '/control/snapshot', handler: 'getControlSnapshot' },\n\n // Workflows\n { method: 'GET', path: '/control/workflows', handler: 'getWorkflows' },\n { method: 'POST', path: '/control/workflow/:id/run', handler: 'runWorkflow', params: ['id'] },\n {\n method: 'GET',\n path: '/control/workflow/:runId/status',\n handler: 'getWorkflowStatus',\n params: ['runId'],\n },\n\n // Debug\n { method: 'GET', path: '/debug/action-history', handler: 'getActionHistory' },\n { method: 'GET', path: '/debug/metrics', handler: 'getMetrics' },\n { method: 'POST', path: '/debug/highlight/:id', handler: 'highlightElement', params: ['id'] },\n { method: 'GET', path: '/debug/element-tree', handler: 'getElementTree' },\n { method: 'GET', path: '/control/console-errors', handler: 'getConsoleErrors' },\n { method: 'POST', path: '/control/console-errors/clear', handler: 'clearConsoleErrors' },\n\n // AI-native endpoints\n { method: 'POST', path: '/ai/search', handler: 'aiSearch', bodyRequired: true },\n { method: 'POST', path: '/ai/execute', handler: 'aiExecute', bodyRequired: true },\n { method: 'POST', path: '/ai/assert', handler: 'aiAssert', bodyRequired: true },\n { method: 'POST', path: '/ai/assert/batch', handler: 'aiAssertBatch', bodyRequired: true },\n { method: 'GET', path: '/ai/snapshot', handler: 'getSemanticSnapshot' },\n { method: 'GET', path: '/ai/diff', handler: 'getSemanticDiff' },\n { method: 'GET', path: '/ai/summary', handler: 'getPageSummary' },\n { method: 'POST', path: '/ai/semantic-search', handler: 'aiSemanticSearch', bodyRequired: true },\n\n // State management (static routes before parameterized)\n { method: 'GET', path: '/control/states', handler: 'getStates' },\n { method: 'GET', path: '/control/states/active', handler: 'getActiveStates' },\n { method: 'GET', path: '/control/states/snapshot', handler: 'getStateSnapshot' },\n { method: 'POST', path: '/control/states/find-path', handler: 'findPath', bodyRequired: true },\n { method: 'POST', path: '/control/states/navigate', handler: 'navigateTo', bodyRequired: true },\n { method: 'GET', path: '/control/state/:id', handler: 'getState', params: ['id'] },\n { method: 'POST', path: '/control/state/:id/activate', handler: 'activateState', params: ['id'] },\n {\n method: 'POST',\n path: '/control/state/:id/deactivate',\n handler: 'deactivateState',\n params: ['id'],\n },\n { method: 'GET', path: '/control/state-groups', handler: 'getStateGroups' },\n {\n method: 'POST',\n path: '/control/state-group/:id/activate',\n handler: 'activateStateGroup',\n params: ['id'],\n },\n {\n method: 'POST',\n path: '/control/state-group/:id/deactivate',\n handler: 'deactivateStateGroup',\n params: ['id'],\n },\n { method: 'GET', path: '/control/transitions', handler: 'getTransitions' },\n {\n method: 'GET',\n path: '/control/transition/:id/can-execute',\n handler: 'canExecuteTransition',\n params: ['id'],\n },\n {\n method: 'POST',\n path: '/control/transition/:id/execute',\n handler: 'executeTransition',\n params: ['id'],\n },\n\n // Intent endpoints\n { method: 'GET', path: '/ai/intents', handler: 'listIntents' },\n { method: 'POST', path: '/ai/intents/execute', handler: 'executeIntent', bodyRequired: true },\n { method: 'POST', path: '/ai/intents/find', handler: 'findIntent', bodyRequired: true },\n { method: 'POST', path: '/ai/intents/register', handler: 'registerIntent', bodyRequired: true },\n {\n method: 'POST',\n path: '/ai/intents/execute-from-query',\n handler: 'executeIntentFromQuery',\n bodyRequired: true,\n },\n\n // Recovery endpoints\n {\n method: 'POST',\n path: '/ai/recovery/attempt',\n handler: 'attemptRecovery',\n bodyRequired: true,\n },\n\n // Cross-app analysis endpoints\n { method: 'GET', path: '/ai/analyze/data', handler: 'analyzePageData' },\n { method: 'GET', path: '/ai/analyze/regions', handler: 'analyzePageRegions' },\n { method: 'GET', path: '/ai/analyze/structured-data', handler: 'analyzeStructuredData' },\n {\n method: 'POST',\n path: '/ai/analyze/cross-app-compare',\n handler: 'crossAppCompare',\n bodyRequired: true,\n },\n\n // Page navigation\n { method: 'POST', path: '/control/page/refresh', handler: 'pageRefresh' },\n { method: 'POST', path: '/control/page/navigate', handler: 'pageNavigate', bodyRequired: true },\n { method: 'POST', path: '/control/page/back', handler: 'pageGoBack' },\n { method: 'POST', path: '/control/page/forward', handler: 'pageGoForward' },\n\n // Annotations (static routes before parameterized)\n { method: 'GET', path: '/annotations', handler: 'getAnnotations' },\n { method: 'GET', path: '/annotations/export', handler: 'exportAnnotations' },\n { method: 'GET', path: '/annotations/coverage', handler: 'getAnnotationCoverage' },\n { method: 'POST', path: '/annotations/import', handler: 'importAnnotations', bodyRequired: true },\n { method: 'GET', path: '/annotations/:id', handler: 'getAnnotation', params: ['id'] },\n {\n method: 'PUT',\n path: '/annotations/:id',\n handler: 'setAnnotation',\n params: ['id'],\n bodyRequired: true,\n },\n { method: 'DELETE', path: '/annotations/:id', handler: 'deleteAnnotation', params: ['id'] },\n\n // Performance diagnostics\n { method: 'GET', path: '/control/performance-entries', handler: 'getPerformanceEntries' },\n {\n method: 'POST',\n path: '/control/performance-entries/clear',\n handler: 'clearPerformanceEntries',\n },\n { method: 'GET', path: '/control/browser-events', handler: 'getBrowserEvents' },\n];\n\n/**\n * WebSocket message types\n */\nexport type WebSocketMessageType =\n | 'subscribe'\n | 'unsubscribe'\n | 'event'\n | 'snapshot'\n | 'action'\n | 'error';\n\n/**\n * WebSocket message\n */\nexport interface WebSocketMessage<T = unknown> {\n type: WebSocketMessageType;\n channel?: string;\n data?: T;\n error?: string;\n timestamp: number;\n}\n","/**\n * Express Adapter\n *\n * Express.js middleware for UI Bridge server.\n */\n\nimport type { Router, Request, Response, NextFunction } from 'express';\nimport type {\n UIBridgeServerConfig,\n UIBridgeServerHandlers,\n APIResponse,\n RouteDefinition,\n CORSOptions,\n} from './types';\nimport { UI_BRIDGE_ROUTES } from './types';\n\n/**\n * Express-specific configuration\n */\nexport interface ExpressAdapterConfig extends UIBridgeServerConfig {\n /** Use JSON body parser (if not already configured) */\n useBodyParser?: boolean;\n}\n\n/**\n * Create CORS middleware\n */\nfunction createCORSMiddleware(options: CORSOptions | boolean) {\n const corsOptions: CORSOptions =\n typeof options === 'boolean'\n ? { origin: options, methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'] }\n : options;\n\n return (req: Request, res: Response, next: NextFunction) => {\n // Origin\n if (corsOptions.origin === true) {\n res.setHeader('Access-Control-Allow-Origin', '*');\n } else if (typeof corsOptions.origin === 'string') {\n res.setHeader('Access-Control-Allow-Origin', corsOptions.origin);\n } else if (Array.isArray(corsOptions.origin)) {\n const origin = req.headers.origin;\n if (origin && corsOptions.origin.includes(origin)) {\n res.setHeader('Access-Control-Allow-Origin', origin);\n }\n }\n\n // Methods\n if (corsOptions.methods) {\n res.setHeader('Access-Control-Allow-Methods', corsOptions.methods.join(', '));\n }\n\n // Headers\n if (corsOptions.headers) {\n res.setHeader('Access-Control-Allow-Headers', corsOptions.headers.join(', '));\n } else {\n res.setHeader(\n 'Access-Control-Allow-Headers',\n 'Content-Type, Authorization, X-Requested-With'\n );\n }\n\n // Credentials\n if (corsOptions.credentials) {\n res.setHeader('Access-Control-Allow-Credentials', 'true');\n }\n\n // Max age\n if (corsOptions.maxAge) {\n res.setHeader('Access-Control-Max-Age', String(corsOptions.maxAge));\n }\n\n // Handle preflight\n if (req.method === 'OPTIONS') {\n res.status(204).end();\n return;\n }\n\n next();\n };\n}\n\n/**\n * Wrap error in API format\n */\nfunction wrapError(error: Error | string, code?: string): APIResponse<never> {\n return {\n success: false,\n error: typeof error === 'string' ? error : error.message,\n code,\n timestamp: Date.now(),\n };\n}\n\n/**\n * Create Express router with UI Bridge routes\n */\nexport function createExpressRouter(\n handlers: UIBridgeServerHandlers,\n config: ExpressAdapterConfig = {}\n): Router {\n // Dynamic import to avoid bundling Express if not used\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const express = require('express');\n const router: Router = express.Router();\n\n // Add CORS middleware if configured\n if (config.cors) {\n router.use(createCORSMiddleware(config.cors));\n }\n\n // Add body parser if requested\n if (config.useBodyParser) {\n router.use(express.json());\n }\n\n // Add authentication middleware if configured\n if (config.authenticate) {\n router.use(async (req: Request, res: Response, next: NextFunction) => {\n try {\n const authenticated = await config.authenticate!(req);\n if (!authenticated) {\n res.status(401).json(wrapError('Unauthorized', 'UNAUTHORIZED'));\n return;\n }\n next();\n } catch (error) {\n res.status(500).json(wrapError(error as Error, 'AUTH_ERROR'));\n }\n });\n }\n\n // Register routes\n for (const route of UI_BRIDGE_ROUTES) {\n const method = route.method.toLowerCase() as 'get' | 'post' | 'put' | 'delete' | 'patch';\n const path = route.path;\n const handlerName = route.handler as keyof UIBridgeServerHandlers;\n const handler = handlers[handlerName];\n\n if (!handler) {\n console.warn(`Handler not found for route: ${route.method} ${route.path}`);\n continue;\n }\n\n router[method](\n path,\n createRouteHandler(route, handler as (...args: unknown[]) => Promise<APIResponse<unknown>>)\n );\n }\n\n return router;\n}\n\n/**\n * Create a route handler from a route definition\n */\nfunction createRouteHandler(\n route: RouteDefinition,\n handler: (...args: unknown[]) => Promise<APIResponse<unknown>>\n) {\n return async (req: Request, res: Response) => {\n try {\n // Extract params\n const args: unknown[] = [];\n\n if (route.params) {\n for (const param of route.params) {\n args.push(req.params[param]);\n }\n }\n\n // Add body if required\n if (route.bodyRequired || route.method === 'POST') {\n args.push(req.body);\n }\n\n // Add query params for GET requests\n if (route.method === 'GET' && Object.keys(req.query).length > 0) {\n args.push(req.query);\n }\n\n const result = await handler(...args);\n res.json(result);\n } catch (error) {\n res.status(500).json(wrapError(error as Error, 'INTERNAL_ERROR'));\n }\n };\n}\n\n/**\n * Create Express app with UI Bridge routes\n *\n * Convenience function that creates a complete Express app with UI Bridge.\n */\nexport function createExpressApp(\n handlers: UIBridgeServerHandlers,\n config: ExpressAdapterConfig = {}\n): unknown {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const express = require('express');\n const app = express();\n\n app.use(express.json());\n\n const basePath = config.basePath || '/ui-bridge';\n const router = createExpressRouter(handlers, { ...config, useBodyParser: false });\n\n app.use(basePath, router);\n\n // Health check\n app.get('/health', (_req: Request, res: Response) => {\n res.json({ status: 'ok', timestamp: Date.now() });\n });\n\n return app;\n}\n\n/**\n * Express middleware that adds UI Bridge to an existing app\n */\nexport function uiBridgeMiddleware(\n handlers: UIBridgeServerHandlers,\n config: ExpressAdapterConfig = {}\n): Router {\n return createExpressRouter(handlers, config);\n}\n"]}
@@ -0,0 +1,124 @@
1
+ import { c as UIBridgeServerHandlers } from '../types-gO696T_t.mjs';
2
+ import { d as ControlSnapshot } from '../types-CJGrBEhC.mjs';
3
+ import { C as CapturedError, a3 as UIState, a4 as UIStateGroup, a5 as UITransition, a0 as TransitionResult, T as PathResult, O as NavigationResult, $ as StateSnapshot } from '../types-suaYwWWg.mjs';
4
+ import { RenderLogEntry } from '../render-log/index.mjs';
5
+ import { AnnotationStore } from '../annotations/index.mjs';
6
+ import '../types-D_ypYl3T.mjs';
7
+ import '../types-UBtp7R0u.mjs';
8
+
9
+ /**
10
+ * UI Bridge Server Handlers
11
+ *
12
+ * Factory function to create handler implementations for all UI Bridge endpoints.
13
+ */
14
+
15
+ /**
16
+ * Registry interface - minimal contract for handler usage
17
+ */
18
+ interface RegistryLike {
19
+ getAllElements(): unknown[];
20
+ getElement(id: string): unknown | undefined;
21
+ getAllComponents(): unknown[];
22
+ getComponent(id: string): unknown | undefined;
23
+ getComponentState?(id: string): {
24
+ state: Record<string, unknown>;
25
+ computed: Record<string, unknown>;
26
+ timestamp: number;
27
+ } | null;
28
+ createSnapshot(): ControlSnapshot;
29
+ getRenderLog?(): RenderLogEntry[];
30
+ clearRenderLog?(): void;
31
+ captureSnapshot?(): unknown;
32
+ findElements?(request?: unknown): unknown[];
33
+ getAllWorkflows?(): unknown[];
34
+ getWorkflow?(id: string): unknown;
35
+ getActionHistory?(): unknown[];
36
+ getMetrics?(): unknown;
37
+ highlightElement?(id: string): void;
38
+ getElementTree?(): unknown;
39
+ getStates?(): UIState[];
40
+ getState?(id: string): UIState | undefined;
41
+ getActiveStates?(): UIState[];
42
+ activateState?(id: string): void;
43
+ deactivateState?(id: string): void;
44
+ getStateGroups?(): UIStateGroup[];
45
+ activateStateGroup?(id: string): void;
46
+ deactivateStateGroup?(id: string): void;
47
+ getTransitions?(): UITransition[];
48
+ canExecuteTransition?(id: string): {
49
+ canExecute: boolean;
50
+ reason?: string;
51
+ };
52
+ executeTransition?(id: string): Promise<TransitionResult>;
53
+ findPath?(targetStates: string[]): PathResult;
54
+ navigateTo?(targetStates: string[]): Promise<NavigationResult>;
55
+ getStateSnapshot?(): StateSnapshot;
56
+ }
57
+ /**
58
+ * Action executor interface - minimal contract for handler usage
59
+ */
60
+ interface ActionExecutorLike {
61
+ executeAction(elementId: string, request: {
62
+ action: string;
63
+ params?: Record<string, unknown>;
64
+ waitOptions?: unknown;
65
+ }): Promise<unknown>;
66
+ executeComponentAction(componentId: string, request: {
67
+ action: string;
68
+ params?: Record<string, unknown>;
69
+ }): Promise<unknown>;
70
+ }
71
+ /**
72
+ * Console capture interface — minimal contract for handler usage
73
+ */
74
+ interface ConsoleCapturelike {
75
+ getConsoleSince(ts: number): CapturedError[];
76
+ getConsoleRecent(n?: number): CapturedError[];
77
+ clear(): void;
78
+ }
79
+ /**
80
+ * Configuration for creating handlers
81
+ */
82
+ interface CreateHandlersConfig {
83
+ /** Optional render log path */
84
+ renderLogPath?: string;
85
+ /** Verbose logging */
86
+ verbose?: boolean;
87
+ /** Optional annotation store (defaults to global singleton) */
88
+ annotationStore?: AnnotationStore;
89
+ /** Optional console capture instance for error monitoring */
90
+ consoleCapture?: ConsoleCapturelike;
91
+ }
92
+ /**
93
+ * Create server handlers for UI Bridge
94
+ *
95
+ * @param registry - The UI Bridge registry instance
96
+ * @param actionExecutor - The action executor instance
97
+ * @param config - Optional configuration
98
+ * @returns Handler implementations for all endpoints
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * import { createHandlers } from '@qontinui/ui-bridge/server';
103
+ * import { getGlobalRegistry, createActionExecutor } from '@qontinui/ui-bridge';
104
+ *
105
+ * const registry = getGlobalRegistry();
106
+ * const executor = createActionExecutor(registry);
107
+ * const handlers = createHandlers(registry, executor);
108
+ *
109
+ * // Use with Express
110
+ * const router = createExpressRouter(handlers);
111
+ *
112
+ * // Use with standalone server
113
+ * const server = new StandaloneServer(handlers);
114
+ * ```
115
+ */
116
+ declare function createHandlers(registry: RegistryLike, actionExecutor: ActionExecutorLike, config?: CreateHandlersConfig): UIBridgeServerHandlers;
117
+ /**
118
+ * Create partial handlers for AI-specific functionality only
119
+ *
120
+ * Use this when you want to add AI endpoints to an existing handler setup.
121
+ */
122
+ declare function createAIHandlers(registry: RegistryLike, actionExecutor: ActionExecutorLike): Pick<UIBridgeServerHandlers, 'aiSearch' | 'aiExecute' | 'aiAssert' | 'aiAssertBatch' | 'getSemanticSnapshot' | 'getSemanticDiff' | 'getPageSummary'>;
123
+
124
+ export { type ActionExecutorLike, type ConsoleCapturelike, type CreateHandlersConfig, type RegistryLike, createAIHandlers, createHandlers };
@@ -0,0 +1,124 @@
1
+ import { c as UIBridgeServerHandlers } from '../types-B2EfvEaq.js';
2
+ import { d as ControlSnapshot } from '../types-C7gVYRnF.js';
3
+ import { C as CapturedError, a3 as UIState, a4 as UIStateGroup, a5 as UITransition, a0 as TransitionResult, T as PathResult, O as NavigationResult, $ as StateSnapshot } from '../types-suaYwWWg.js';
4
+ import { RenderLogEntry } from '../render-log/index.js';
5
+ import { AnnotationStore } from '../annotations/index.js';
6
+ import '../types-CebMQj76.js';
7
+ import '../types-UBtp7R0u.js';
8
+
9
+ /**
10
+ * UI Bridge Server Handlers
11
+ *
12
+ * Factory function to create handler implementations for all UI Bridge endpoints.
13
+ */
14
+
15
+ /**
16
+ * Registry interface - minimal contract for handler usage
17
+ */
18
+ interface RegistryLike {
19
+ getAllElements(): unknown[];
20
+ getElement(id: string): unknown | undefined;
21
+ getAllComponents(): unknown[];
22
+ getComponent(id: string): unknown | undefined;
23
+ getComponentState?(id: string): {
24
+ state: Record<string, unknown>;
25
+ computed: Record<string, unknown>;
26
+ timestamp: number;
27
+ } | null;
28
+ createSnapshot(): ControlSnapshot;
29
+ getRenderLog?(): RenderLogEntry[];
30
+ clearRenderLog?(): void;
31
+ captureSnapshot?(): unknown;
32
+ findElements?(request?: unknown): unknown[];
33
+ getAllWorkflows?(): unknown[];
34
+ getWorkflow?(id: string): unknown;
35
+ getActionHistory?(): unknown[];
36
+ getMetrics?(): unknown;
37
+ highlightElement?(id: string): void;
38
+ getElementTree?(): unknown;
39
+ getStates?(): UIState[];
40
+ getState?(id: string): UIState | undefined;
41
+ getActiveStates?(): UIState[];
42
+ activateState?(id: string): void;
43
+ deactivateState?(id: string): void;
44
+ getStateGroups?(): UIStateGroup[];
45
+ activateStateGroup?(id: string): void;
46
+ deactivateStateGroup?(id: string): void;
47
+ getTransitions?(): UITransition[];
48
+ canExecuteTransition?(id: string): {
49
+ canExecute: boolean;
50
+ reason?: string;
51
+ };
52
+ executeTransition?(id: string): Promise<TransitionResult>;
53
+ findPath?(targetStates: string[]): PathResult;
54
+ navigateTo?(targetStates: string[]): Promise<NavigationResult>;
55
+ getStateSnapshot?(): StateSnapshot;
56
+ }
57
+ /**
58
+ * Action executor interface - minimal contract for handler usage
59
+ */
60
+ interface ActionExecutorLike {
61
+ executeAction(elementId: string, request: {
62
+ action: string;
63
+ params?: Record<string, unknown>;
64
+ waitOptions?: unknown;
65
+ }): Promise<unknown>;
66
+ executeComponentAction(componentId: string, request: {
67
+ action: string;
68
+ params?: Record<string, unknown>;
69
+ }): Promise<unknown>;
70
+ }
71
+ /**
72
+ * Console capture interface — minimal contract for handler usage
73
+ */
74
+ interface ConsoleCapturelike {
75
+ getConsoleSince(ts: number): CapturedError[];
76
+ getConsoleRecent(n?: number): CapturedError[];
77
+ clear(): void;
78
+ }
79
+ /**
80
+ * Configuration for creating handlers
81
+ */
82
+ interface CreateHandlersConfig {
83
+ /** Optional render log path */
84
+ renderLogPath?: string;
85
+ /** Verbose logging */
86
+ verbose?: boolean;
87
+ /** Optional annotation store (defaults to global singleton) */
88
+ annotationStore?: AnnotationStore;
89
+ /** Optional console capture instance for error monitoring */
90
+ consoleCapture?: ConsoleCapturelike;
91
+ }
92
+ /**
93
+ * Create server handlers for UI Bridge
94
+ *
95
+ * @param registry - The UI Bridge registry instance
96
+ * @param actionExecutor - The action executor instance
97
+ * @param config - Optional configuration
98
+ * @returns Handler implementations for all endpoints
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * import { createHandlers } from '@qontinui/ui-bridge/server';
103
+ * import { getGlobalRegistry, createActionExecutor } from '@qontinui/ui-bridge';
104
+ *
105
+ * const registry = getGlobalRegistry();
106
+ * const executor = createActionExecutor(registry);
107
+ * const handlers = createHandlers(registry, executor);
108
+ *
109
+ * // Use with Express
110
+ * const router = createExpressRouter(handlers);
111
+ *
112
+ * // Use with standalone server
113
+ * const server = new StandaloneServer(handlers);
114
+ * ```
115
+ */
116
+ declare function createHandlers(registry: RegistryLike, actionExecutor: ActionExecutorLike, config?: CreateHandlersConfig): UIBridgeServerHandlers;
117
+ /**
118
+ * Create partial handlers for AI-specific functionality only
119
+ *
120
+ * Use this when you want to add AI endpoints to an existing handler setup.
121
+ */
122
+ declare function createAIHandlers(registry: RegistryLike, actionExecutor: ActionExecutorLike): Pick<UIBridgeServerHandlers, 'aiSearch' | 'aiExecute' | 'aiAssert' | 'aiAssertBatch' | 'getSemanticSnapshot' | 'getSemanticDiff' | 'getPageSummary'>;
123
+
124
+ export { type ActionExecutorLike, type ConsoleCapturelike, type CreateHandlersConfig, type RegistryLike, createAIHandlers, createHandlers };