@qontinui/ui-bridge 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.d.mts +4 -4
- package/dist/ai/index.d.ts +4 -4
- package/dist/babel-plugin/index.js +515 -0
- package/dist/babel-plugin/index.js.map +1 -0
- package/dist/babel-plugin/index.mjs +499 -0
- package/dist/babel-plugin/index.mjs.map +1 -0
- package/dist/control/index.d.mts +5 -5
- package/dist/control/index.d.ts +5 -5
- package/dist/core/index.d.mts +115 -44
- package/dist/core/index.d.ts +115 -44
- package/dist/core/index.js +0 -1560
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +1 -1549
- package/dist/core/index.mjs.map +1 -1
- package/dist/debug/index.d.mts +3 -3
- package/dist/debug/index.d.ts +3 -3
- package/dist/index.d.mts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +859 -873
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +860 -862
- package/dist/index.mjs.map +1 -1
- package/dist/{metrics-C9XRi_mL.d.ts → metrics-BfiT_rhZ.d.ts} +2 -2
- package/dist/{metrics-NC3csD0R.d.mts → metrics-DTA2bwG7.d.mts} +2 -2
- package/dist/native/control/index.js +453 -0
- package/dist/native/control/index.js.map +1 -0
- package/dist/native/control/index.mjs +450 -0
- package/dist/native/control/index.mjs.map +1 -0
- package/dist/native/core/index.js +486 -0
- package/dist/native/core/index.js.map +1 -0
- package/dist/native/core/index.mjs +475 -0
- package/dist/native/core/index.mjs.map +1 -0
- package/dist/native/debug/index.js +451 -0
- package/dist/native/debug/index.js.map +1 -0
- package/dist/native/debug/index.mjs +449 -0
- package/dist/native/debug/index.mjs.map +1 -0
- package/dist/native/index.js +2274 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native/index.mjs +2246 -0
- package/dist/native/index.mjs.map +1 -0
- package/dist/native/react/index.js +1401 -0
- package/dist/native/react/index.js.map +1 -0
- package/dist/native/react/index.mjs +1389 -0
- package/dist/native/react/index.mjs.map +1 -0
- package/dist/native/server/index.js +415 -0
- package/dist/native/server/index.js.map +1 -0
- package/dist/native/server/index.mjs +410 -0
- package/dist/native/server/index.mjs.map +1 -0
- package/dist/react/index.d.mts +20 -7
- package/dist/react/index.d.ts +20 -7
- package/dist/react/index.js +42 -4
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +42 -4
- package/dist/react/index.mjs.map +1 -1
- package/dist/{registry-CIEDjbQ9.d.ts → registry-BKLEm-yk.d.ts} +9 -15
- package/dist/{registry-SsSDq46X.d.mts → registry-BmZgyCz8.d.mts} +9 -15
- package/dist/render-log/index.d.mts +1 -1
- package/dist/render-log/index.d.ts +1 -1
- package/dist/server/express.d.mts +36 -0
- package/dist/server/express.d.ts +36 -0
- package/dist/server/express.js +196 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/express.mjs +192 -0
- package/dist/server/express.mjs.map +1 -0
- package/dist/server/handlers.d.mts +93 -0
- package/dist/server/handlers.d.ts +93 -0
- package/dist/server/handlers.js +4278 -0
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/handlers.mjs +4275 -0
- package/dist/server/handlers.mjs.map +1 -0
- package/dist/server/index.d.mts +10 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.js +5352 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +5337 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/nextjs.d.mts +126 -0
- package/dist/server/nextjs.d.ts +126 -0
- package/dist/server/nextjs.js +287 -0
- package/dist/server/nextjs.js.map +1 -0
- package/dist/server/nextjs.mjs +282 -0
- package/dist/server/nextjs.mjs.map +1 -0
- package/dist/server/standalone.d.mts +6 -0
- package/dist/server/standalone.d.ts +6 -0
- package/dist/server/standalone.js +719 -0
- package/dist/server/standalone.js.map +1 -0
- package/dist/server/standalone.mjs +715 -0
- package/dist/server/standalone.mjs.map +1 -0
- package/dist/standalone-BURj8J3G.d.ts +212 -0
- package/dist/standalone-Dwmel29d.d.mts +212 -0
- package/dist/swc-plugin/index.d.mts +79 -0
- package/dist/swc-plugin/index.d.ts +79 -0
- package/dist/swc-plugin/index.js +15 -0
- package/dist/swc-plugin/index.js.map +1 -0
- package/dist/swc-plugin/index.mjs +9 -0
- package/dist/swc-plugin/index.mjs.map +1 -0
- package/dist/{types-CFT3Dnx4.d.mts → types-B5Q0GVo0.d.mts} +115 -3
- package/dist/{types-Dr6tH-bm.d.mts → types-B7J7noLK.d.mts} +1 -1
- package/dist/{types-oCTrRxSw.d.ts → types-BkNRILUa.d.ts} +1 -1
- package/dist/types-CEQLnFMv.d.mts +156 -0
- package/dist/types-CHnlwiTK.d.ts +156 -0
- package/dist/{types-BvCfFuEV.d.ts → types-DfPqwU-i.d.ts} +115 -3
- package/dist/{types-CPMbN_Iw.d.mts → types-jKVgTI6_.d.mts} +356 -160
- package/dist/{types-CPMbN_Iw.d.ts → types-jKVgTI6_.d.ts} +356 -160
- package/package.json +106 -3
- package/swc-plugin-wasm/ui_bridge_swc_plugin.wasm +0 -0
- package/dist/websocket-client-CX4QJesI.d.ts +0 -124
- package/dist/websocket-client-C_Na0OSp.d.mts +0 -124
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Bridge SWC Plugin Configuration
|
|
3
|
+
*/
|
|
4
|
+
interface UIBridgeSwcPluginConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Elements to automatically instrument
|
|
7
|
+
* @default ['button', 'input', 'select', 'textarea', 'a', 'form']
|
|
8
|
+
*/
|
|
9
|
+
elements?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Prefix for generated IDs
|
|
12
|
+
* @default 'ui'
|
|
13
|
+
*/
|
|
14
|
+
idPrefix?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Attribute name for the generated ID
|
|
17
|
+
* @default 'data-ui-id'
|
|
18
|
+
*/
|
|
19
|
+
idAttribute?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Attribute name for aliases
|
|
22
|
+
* @default 'data-ui-aliases'
|
|
23
|
+
*/
|
|
24
|
+
aliasesAttribute?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Attribute name for element type
|
|
27
|
+
* @default 'data-ui-type'
|
|
28
|
+
*/
|
|
29
|
+
typeAttribute?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Generate aliases from text content
|
|
32
|
+
* @default true
|
|
33
|
+
*/
|
|
34
|
+
generateAliases?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Include component name in generated ID
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
includeComponentName?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Include file path in generated ID
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
includeFilePath?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Hash the generated ID for shorter strings
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
hashIds?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Maximum alias count per element
|
|
52
|
+
* @default 5
|
|
53
|
+
*/
|
|
54
|
+
maxAliases?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Skip elements that already have data-ui-id
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
skipExisting?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Only instrument elements inside components with specific names
|
|
62
|
+
* @default []
|
|
63
|
+
*/
|
|
64
|
+
onlyInComponents?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Skip instrumentation for elements inside these components
|
|
67
|
+
* @default []
|
|
68
|
+
*/
|
|
69
|
+
skipInComponents?: string[];
|
|
70
|
+
/**
|
|
71
|
+
* Enable verbose logging during build
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
verbose?: boolean;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare const pluginPath: string;
|
|
78
|
+
|
|
79
|
+
export { type UIBridgeSwcPluginConfig, pluginPath as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var path = require('path');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
8
|
+
|
|
9
|
+
// src/swc-plugin/index.ts
|
|
10
|
+
var pluginPath = path__default.default.join(__dirname, "..", "..", "swc-plugin-wasm", "ui_bridge_swc_plugin.wasm");
|
|
11
|
+
var swc_plugin_default = pluginPath;
|
|
12
|
+
|
|
13
|
+
module.exports = swc_plugin_default;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/swc-plugin/index.ts"],"names":["path"],"mappings":";;;;;;;;;AAqBA,IAAM,aAAaA,qBAAA,CAAK,IAAA,CAAK,WAAW,IAAA,EAAM,IAAA,EAAM,mBAAmB,2BAA2B,CAAA;AAElG,IAAO,kBAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * SWC Plugin for UI Bridge\n *\n * Provides the path to the pre-built WASM plugin binary.\n *\n * @example\n * ```js\n * // next.config.js\n * const swcPluginPath = require('@qontinui/ui-bridge/swc-plugin').default;\n *\n * module.exports = {\n * experimental: {\n * swcPlugins: [[swcPluginPath, { elements: ['button', 'input'] }]]\n * }\n * };\n * ```\n */\nimport path from 'path';\n\nexport type { UIBridgeSwcPluginConfig } from './types';\n\nconst pluginPath = path.join(__dirname, '..', '..', 'swc-plugin-wasm', 'ui_bridge_swc_plugin.wasm');\n\nexport default pluginPath;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
// src/swc-plugin/index.ts
|
|
4
|
+
var pluginPath = path.join(__dirname, "..", "..", "swc-plugin-wasm", "ui_bridge_swc_plugin.wasm");
|
|
5
|
+
var swc_plugin_default = pluginPath;
|
|
6
|
+
|
|
7
|
+
export { swc_plugin_default as default };
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/swc-plugin/index.ts"],"names":[],"mappings":";;;AAqBA,IAAM,aAAa,IAAA,CAAK,IAAA,CAAK,WAAW,IAAA,EAAM,IAAA,EAAM,mBAAmB,2BAA2B,CAAA;AAElG,IAAO,kBAAA,GAAQ","file":"index.mjs","sourcesContent":["/**\n * SWC Plugin for UI Bridge\n *\n * Provides the path to the pre-built WASM plugin binary.\n *\n * @example\n * ```js\n * // next.config.js\n * const swcPluginPath = require('@qontinui/ui-bridge/swc-plugin').default;\n *\n * module.exports = {\n * experimental: {\n * swcPlugins: [[swcPluginPath, { elements: ['button', 'input'] }]]\n * }\n * };\n * ```\n */\nimport path from 'path';\n\nexport type { UIBridgeSwcPluginConfig } from './types';\n\nconst pluginPath = path.join(__dirname, '..', '..', 'swc-plugin-wasm', 'ui_bridge_swc_plugin.wasm');\n\nexport default pluginPath;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as DiscoveredElement } from './types-
|
|
1
|
+
import { r as ElementType, q as ElementState } from './types-jKVgTI6_.mjs';
|
|
2
|
+
import { D as DiscoveredElement } from './types-B7J7noLK.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* AI Module Types
|
|
@@ -212,6 +212,63 @@ interface ParsedAction {
|
|
|
212
212
|
/** Parse confidence */
|
|
213
213
|
parseConfidence: number;
|
|
214
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Partial match information for structured failures
|
|
217
|
+
*/
|
|
218
|
+
interface PartialMatchInfo {
|
|
219
|
+
/** Element ID */
|
|
220
|
+
elementId: string;
|
|
221
|
+
/** Match confidence 0-1 */
|
|
222
|
+
confidence: number;
|
|
223
|
+
/** Why this element was considered but not selected */
|
|
224
|
+
reason: string;
|
|
225
|
+
/** Element type */
|
|
226
|
+
type: string;
|
|
227
|
+
/** Element description/label */
|
|
228
|
+
description?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Recovery suggestion for structured failures
|
|
232
|
+
*/
|
|
233
|
+
interface RecoverySuggestionInfo {
|
|
234
|
+
/** Human-readable suggestion */
|
|
235
|
+
suggestion: string;
|
|
236
|
+
/** Machine-executable command (if applicable) */
|
|
237
|
+
command?: string;
|
|
238
|
+
/** Confidence that this action will help (0-1) */
|
|
239
|
+
confidence: number;
|
|
240
|
+
/** Whether retry with same parameters might help */
|
|
241
|
+
retryable: boolean;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Structured failure information for NL action responses
|
|
245
|
+
*/
|
|
246
|
+
interface StructuredFailureInfo {
|
|
247
|
+
/** Machine-readable error code */
|
|
248
|
+
errorCode: string;
|
|
249
|
+
/** Human-readable error message */
|
|
250
|
+
message: string;
|
|
251
|
+
/** Target element ID (if known) */
|
|
252
|
+
elementId?: string;
|
|
253
|
+
/** Selectors/strategies that were attempted */
|
|
254
|
+
selectorsTried?: string[];
|
|
255
|
+
/** Similar elements that were found but not used */
|
|
256
|
+
partialMatches?: PartialMatchInfo[];
|
|
257
|
+
/** Current state of the target element (if found) */
|
|
258
|
+
elementState?: ElementState;
|
|
259
|
+
/** Reference to visual context (screenshot path/id) */
|
|
260
|
+
screenshotContext?: string;
|
|
261
|
+
/** Suggested recovery actions */
|
|
262
|
+
suggestedActions?: RecoverySuggestionInfo[];
|
|
263
|
+
/** Whether retry with same parameters might help */
|
|
264
|
+
retryRecommended: boolean;
|
|
265
|
+
/** Additional context data */
|
|
266
|
+
context?: Record<string, unknown>;
|
|
267
|
+
/** Duration before failure in milliseconds */
|
|
268
|
+
durationMs?: number;
|
|
269
|
+
/** Timeout value that was exceeded (for timeout errors) */
|
|
270
|
+
timeoutMs?: number;
|
|
271
|
+
}
|
|
215
272
|
/**
|
|
216
273
|
* Response from executing a natural language action
|
|
217
274
|
*/
|
|
@@ -238,6 +295,8 @@ interface NLActionResponse {
|
|
|
238
295
|
suggestions?: string[];
|
|
239
296
|
/** Alternative elements that could have been used */
|
|
240
297
|
alternatives?: SearchResult[];
|
|
298
|
+
/** Detailed failure information when success is false */
|
|
299
|
+
failureInfo?: StructuredFailureInfo;
|
|
241
300
|
}
|
|
242
301
|
/**
|
|
243
302
|
* Types of assertions that can be made about elements
|
|
@@ -464,6 +523,59 @@ interface ElementModification {
|
|
|
464
523
|
/** Whether this is a significant change */
|
|
465
524
|
significant: boolean;
|
|
466
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Semantic search criteria using embeddings
|
|
528
|
+
*/
|
|
529
|
+
interface SemanticSearchCriteria {
|
|
530
|
+
/** Natural language query for semantic matching */
|
|
531
|
+
query: string;
|
|
532
|
+
/** Minimum similarity score (0-1, default: 0.5) */
|
|
533
|
+
threshold?: number;
|
|
534
|
+
/** Maximum results to return */
|
|
535
|
+
limit?: number;
|
|
536
|
+
/** Filter by element type */
|
|
537
|
+
type?: string;
|
|
538
|
+
/** Filter by ARIA role */
|
|
539
|
+
role?: string;
|
|
540
|
+
/** Combine with text-based search */
|
|
541
|
+
combineWithText?: boolean;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Semantic search result
|
|
545
|
+
*/
|
|
546
|
+
interface SemanticSearchResult {
|
|
547
|
+
/** The matched element */
|
|
548
|
+
element: AIDiscoveredElement;
|
|
549
|
+
/** Semantic similarity score (0-1) */
|
|
550
|
+
similarity: number;
|
|
551
|
+
/** Rank in results (1-indexed) */
|
|
552
|
+
rank: number;
|
|
553
|
+
/** Text that was used for embedding */
|
|
554
|
+
embeddedText: string;
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Response from semantic search operations
|
|
558
|
+
*/
|
|
559
|
+
interface SemanticSearchResponse {
|
|
560
|
+
/** All matching results sorted by similarity */
|
|
561
|
+
results: SemanticSearchResult[];
|
|
562
|
+
/** Best match (highest similarity above threshold) */
|
|
563
|
+
bestMatch: SemanticSearchResult | null;
|
|
564
|
+
/** Total elements scanned */
|
|
565
|
+
scannedCount: number;
|
|
566
|
+
/** Search duration in milliseconds */
|
|
567
|
+
durationMs: number;
|
|
568
|
+
/** Query used */
|
|
569
|
+
query: string;
|
|
570
|
+
/** Embedding provider info */
|
|
571
|
+
providerInfo?: {
|
|
572
|
+
provider: string;
|
|
573
|
+
model: string;
|
|
574
|
+
dimension: number;
|
|
575
|
+
};
|
|
576
|
+
/** Timestamp */
|
|
577
|
+
timestamp: number;
|
|
578
|
+
}
|
|
467
579
|
/**
|
|
468
580
|
* Rich error context for AI agents
|
|
469
581
|
*/
|
|
@@ -531,4 +643,4 @@ interface AIElementRegistrationOptions {
|
|
|
531
643
|
autoGenerateAliases?: boolean;
|
|
532
644
|
}
|
|
533
645
|
|
|
534
|
-
export type { AIDiscoveredElement as A, BatchAssertionRequest as B, ElementChange as E, FormAnalysis as F, ModalState as M, NLActionRequest as N, PageContext as P, RecoverySuggestion as R, SearchCriteria as S, AIElementRegistrationOptions as a, AIErrorContext as b, AIFindResponse as c, AssertionRequest as d, AssertionResult as e, AssertionType as f, BatchAssertionResult as g, ElementModification as h, FormFieldAnalysis as i, FormFieldState as j, FormState as k, NLActionResponse as l, ParsedAction as m, SearchResponse as n, SearchResult as o, SemanticDiff as p,
|
|
646
|
+
export type { AIDiscoveredElement as A, BatchAssertionRequest as B, ElementChange as E, FormAnalysis as F, ModalState as M, NLActionRequest as N, PageContext as P, RecoverySuggestion as R, SearchCriteria as S, AIElementRegistrationOptions as a, AIErrorContext as b, AIFindResponse as c, AssertionRequest as d, AssertionResult as e, AssertionType as f, BatchAssertionResult as g, ElementModification as h, FormFieldAnalysis as i, FormFieldState as j, FormState as k, NLActionResponse as l, ParsedAction as m, SearchResponse as n, SearchResult as o, SemanticDiff as p, SemanticSearchCriteria as q, SemanticSearchResponse as r, SemanticSearchResult as s, SemanticSnapshot as t };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { U as UIBridgeConfig } from './types-jKVgTI6_.mjs';
|
|
2
|
+
import { d as ControlSnapshot, 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-B7J7noLK.mjs';
|
|
3
|
+
import { S as SearchCriteria, n as SearchResponse, N as NLActionRequest, l as NLActionResponse, d as AssertionRequest, e as AssertionResult, B as BatchAssertionRequest, g as BatchAssertionResult, t as SemanticSnapshot, p as SemanticDiff, q as SemanticSearchCriteria, r as SemanticSearchResponse } from './types-B5Q0GVo0.mjs';
|
|
4
|
+
import { RenderLogEntryType, RenderLogEntry } from './render-log/index.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* UI Bridge Server Types
|
|
8
|
+
*
|
|
9
|
+
* Shared types for server adapters.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Server configuration
|
|
14
|
+
*/
|
|
15
|
+
interface UIBridgeServerConfig extends UIBridgeConfig {
|
|
16
|
+
/** Base path for API routes */
|
|
17
|
+
basePath?: string;
|
|
18
|
+
/** Enable CORS */
|
|
19
|
+
cors?: boolean | CORSOptions;
|
|
20
|
+
/** Authentication middleware */
|
|
21
|
+
authenticate?: (req: unknown) => boolean | Promise<boolean>;
|
|
22
|
+
/** Rate limiting */
|
|
23
|
+
rateLimit?: RateLimitOptions;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* CORS options
|
|
27
|
+
*/
|
|
28
|
+
interface CORSOptions {
|
|
29
|
+
/** Allowed origins */
|
|
30
|
+
origin?: string | string[] | boolean;
|
|
31
|
+
/** Allowed methods */
|
|
32
|
+
methods?: string[];
|
|
33
|
+
/** Allowed headers */
|
|
34
|
+
headers?: string[];
|
|
35
|
+
/** Expose headers */
|
|
36
|
+
exposeHeaders?: string[];
|
|
37
|
+
/** Allow credentials */
|
|
38
|
+
credentials?: boolean;
|
|
39
|
+
/** Max age for preflight cache */
|
|
40
|
+
maxAge?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Rate limit options
|
|
44
|
+
*/
|
|
45
|
+
interface RateLimitOptions {
|
|
46
|
+
/** Time window in milliseconds */
|
|
47
|
+
windowMs?: number;
|
|
48
|
+
/** Max requests per window */
|
|
49
|
+
max?: number;
|
|
50
|
+
/** Message when rate limited */
|
|
51
|
+
message?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* API response wrapper
|
|
55
|
+
*/
|
|
56
|
+
interface APIResponse<T = unknown> {
|
|
57
|
+
/** Whether the request succeeded */
|
|
58
|
+
success: boolean;
|
|
59
|
+
/** Response data */
|
|
60
|
+
data?: T;
|
|
61
|
+
/** Error message if failed */
|
|
62
|
+
error?: string;
|
|
63
|
+
/** Error code */
|
|
64
|
+
code?: string;
|
|
65
|
+
/** Request timestamp */
|
|
66
|
+
timestamp: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Render log query parameters
|
|
70
|
+
*/
|
|
71
|
+
interface RenderLogQuery {
|
|
72
|
+
/** Filter by entry type */
|
|
73
|
+
type?: RenderLogEntryType;
|
|
74
|
+
/** Filter entries since timestamp */
|
|
75
|
+
since?: number;
|
|
76
|
+
/** Filter entries until timestamp */
|
|
77
|
+
until?: number;
|
|
78
|
+
/** Limit number of results */
|
|
79
|
+
limit?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Server handler interface
|
|
83
|
+
*
|
|
84
|
+
* Implementations provide these handlers for different frameworks.
|
|
85
|
+
*/
|
|
86
|
+
interface UIBridgeServerHandlers {
|
|
87
|
+
getRenderLog: (query?: RenderLogQuery) => Promise<APIResponse<RenderLogEntry[]>>;
|
|
88
|
+
clearRenderLog: () => Promise<APIResponse<void>>;
|
|
89
|
+
captureSnapshot: () => Promise<APIResponse<unknown>>;
|
|
90
|
+
getRenderLogPath: () => Promise<APIResponse<{
|
|
91
|
+
path: string;
|
|
92
|
+
}>>;
|
|
93
|
+
getElements: () => Promise<APIResponse<ControlSnapshot['elements']>>;
|
|
94
|
+
getElement: (id: string) => Promise<APIResponse<ControlSnapshot['elements'][0]>>;
|
|
95
|
+
getElementState: (id: string) => Promise<APIResponse<unknown>>;
|
|
96
|
+
executeElementAction: (id: string, request: ControlActionRequest) => Promise<APIResponse<ControlActionResponse>>;
|
|
97
|
+
getComponents: () => Promise<APIResponse<ControlSnapshot['components']>>;
|
|
98
|
+
getComponent: (id: string) => Promise<APIResponse<ControlSnapshot['components'][0]>>;
|
|
99
|
+
getComponentState: (id: string) => Promise<APIResponse<{
|
|
100
|
+
state: Record<string, unknown>;
|
|
101
|
+
computed: Record<string, unknown>;
|
|
102
|
+
timestamp: number;
|
|
103
|
+
}>>;
|
|
104
|
+
executeComponentAction: (id: string, request: ComponentActionRequest) => Promise<APIResponse<ComponentActionResponse>>;
|
|
105
|
+
find: (request?: FindRequest) => Promise<APIResponse<FindResponse>>;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated Use find() instead
|
|
108
|
+
*/
|
|
109
|
+
discover: (request?: FindRequest) => Promise<APIResponse<FindResponse>>;
|
|
110
|
+
getControlSnapshot: () => Promise<APIResponse<ControlSnapshot>>;
|
|
111
|
+
getWorkflows: () => Promise<APIResponse<ControlSnapshot['workflows']>>;
|
|
112
|
+
runWorkflow: (id: string, request?: WorkflowRunRequest) => Promise<APIResponse<WorkflowRunResponse>>;
|
|
113
|
+
getWorkflowStatus: (runId: string) => Promise<APIResponse<WorkflowRunResponse>>;
|
|
114
|
+
getActionHistory: (limit?: number) => Promise<APIResponse<unknown[]>>;
|
|
115
|
+
getMetrics: () => Promise<APIResponse<unknown>>;
|
|
116
|
+
highlightElement: (id: string) => Promise<APIResponse<void>>;
|
|
117
|
+
getElementTree: () => Promise<APIResponse<unknown>>;
|
|
118
|
+
aiSearch: (criteria: SearchCriteria) => Promise<APIResponse<SearchResponse>>;
|
|
119
|
+
aiExecute: (request: NLActionRequest) => Promise<APIResponse<NLActionResponse>>;
|
|
120
|
+
aiAssert: (request: AssertionRequest) => Promise<APIResponse<AssertionResult>>;
|
|
121
|
+
aiAssertBatch: (request: BatchAssertionRequest) => Promise<APIResponse<BatchAssertionResult>>;
|
|
122
|
+
getSemanticSnapshot: () => Promise<APIResponse<SemanticSnapshot>>;
|
|
123
|
+
getSemanticDiff: (since?: number) => Promise<APIResponse<SemanticDiff | null>>;
|
|
124
|
+
getPageSummary: () => Promise<APIResponse<string>>;
|
|
125
|
+
aiSemanticSearch: (criteria: SemanticSearchCriteria) => Promise<APIResponse<SemanticSearchResponse>>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Route definition
|
|
129
|
+
*/
|
|
130
|
+
interface RouteDefinition {
|
|
131
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
132
|
+
path: string;
|
|
133
|
+
handler: string;
|
|
134
|
+
params?: string[];
|
|
135
|
+
bodyRequired?: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* All UI Bridge routes
|
|
139
|
+
*/
|
|
140
|
+
declare const UI_BRIDGE_ROUTES: RouteDefinition[];
|
|
141
|
+
/**
|
|
142
|
+
* WebSocket message types
|
|
143
|
+
*/
|
|
144
|
+
type WebSocketMessageType = 'subscribe' | 'unsubscribe' | 'event' | 'snapshot' | 'action' | 'error';
|
|
145
|
+
/**
|
|
146
|
+
* WebSocket message
|
|
147
|
+
*/
|
|
148
|
+
interface WebSocketMessage<T = unknown> {
|
|
149
|
+
type: WebSocketMessageType;
|
|
150
|
+
channel?: string;
|
|
151
|
+
data?: T;
|
|
152
|
+
error?: string;
|
|
153
|
+
timestamp: number;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { type APIResponse as A, type CORSOptions as C, type RateLimitOptions as R, type UIBridgeServerConfig as U, type WebSocketMessage as W, type RenderLogQuery as a, type RouteDefinition as b, type UIBridgeServerHandlers as c, UI_BRIDGE_ROUTES as d, type WebSocketMessageType as e };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { U as UIBridgeConfig } from './types-jKVgTI6_.js';
|
|
2
|
+
import { d as ControlSnapshot, 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-BkNRILUa.js';
|
|
3
|
+
import { S as SearchCriteria, n as SearchResponse, N as NLActionRequest, l as NLActionResponse, d as AssertionRequest, e as AssertionResult, B as BatchAssertionRequest, g as BatchAssertionResult, t as SemanticSnapshot, p as SemanticDiff, q as SemanticSearchCriteria, r as SemanticSearchResponse } from './types-DfPqwU-i.js';
|
|
4
|
+
import { RenderLogEntryType, RenderLogEntry } from './render-log/index.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* UI Bridge Server Types
|
|
8
|
+
*
|
|
9
|
+
* Shared types for server adapters.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Server configuration
|
|
14
|
+
*/
|
|
15
|
+
interface UIBridgeServerConfig extends UIBridgeConfig {
|
|
16
|
+
/** Base path for API routes */
|
|
17
|
+
basePath?: string;
|
|
18
|
+
/** Enable CORS */
|
|
19
|
+
cors?: boolean | CORSOptions;
|
|
20
|
+
/** Authentication middleware */
|
|
21
|
+
authenticate?: (req: unknown) => boolean | Promise<boolean>;
|
|
22
|
+
/** Rate limiting */
|
|
23
|
+
rateLimit?: RateLimitOptions;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* CORS options
|
|
27
|
+
*/
|
|
28
|
+
interface CORSOptions {
|
|
29
|
+
/** Allowed origins */
|
|
30
|
+
origin?: string | string[] | boolean;
|
|
31
|
+
/** Allowed methods */
|
|
32
|
+
methods?: string[];
|
|
33
|
+
/** Allowed headers */
|
|
34
|
+
headers?: string[];
|
|
35
|
+
/** Expose headers */
|
|
36
|
+
exposeHeaders?: string[];
|
|
37
|
+
/** Allow credentials */
|
|
38
|
+
credentials?: boolean;
|
|
39
|
+
/** Max age for preflight cache */
|
|
40
|
+
maxAge?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Rate limit options
|
|
44
|
+
*/
|
|
45
|
+
interface RateLimitOptions {
|
|
46
|
+
/** Time window in milliseconds */
|
|
47
|
+
windowMs?: number;
|
|
48
|
+
/** Max requests per window */
|
|
49
|
+
max?: number;
|
|
50
|
+
/** Message when rate limited */
|
|
51
|
+
message?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* API response wrapper
|
|
55
|
+
*/
|
|
56
|
+
interface APIResponse<T = unknown> {
|
|
57
|
+
/** Whether the request succeeded */
|
|
58
|
+
success: boolean;
|
|
59
|
+
/** Response data */
|
|
60
|
+
data?: T;
|
|
61
|
+
/** Error message if failed */
|
|
62
|
+
error?: string;
|
|
63
|
+
/** Error code */
|
|
64
|
+
code?: string;
|
|
65
|
+
/** Request timestamp */
|
|
66
|
+
timestamp: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Render log query parameters
|
|
70
|
+
*/
|
|
71
|
+
interface RenderLogQuery {
|
|
72
|
+
/** Filter by entry type */
|
|
73
|
+
type?: RenderLogEntryType;
|
|
74
|
+
/** Filter entries since timestamp */
|
|
75
|
+
since?: number;
|
|
76
|
+
/** Filter entries until timestamp */
|
|
77
|
+
until?: number;
|
|
78
|
+
/** Limit number of results */
|
|
79
|
+
limit?: number;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Server handler interface
|
|
83
|
+
*
|
|
84
|
+
* Implementations provide these handlers for different frameworks.
|
|
85
|
+
*/
|
|
86
|
+
interface UIBridgeServerHandlers {
|
|
87
|
+
getRenderLog: (query?: RenderLogQuery) => Promise<APIResponse<RenderLogEntry[]>>;
|
|
88
|
+
clearRenderLog: () => Promise<APIResponse<void>>;
|
|
89
|
+
captureSnapshot: () => Promise<APIResponse<unknown>>;
|
|
90
|
+
getRenderLogPath: () => Promise<APIResponse<{
|
|
91
|
+
path: string;
|
|
92
|
+
}>>;
|
|
93
|
+
getElements: () => Promise<APIResponse<ControlSnapshot['elements']>>;
|
|
94
|
+
getElement: (id: string) => Promise<APIResponse<ControlSnapshot['elements'][0]>>;
|
|
95
|
+
getElementState: (id: string) => Promise<APIResponse<unknown>>;
|
|
96
|
+
executeElementAction: (id: string, request: ControlActionRequest) => Promise<APIResponse<ControlActionResponse>>;
|
|
97
|
+
getComponents: () => Promise<APIResponse<ControlSnapshot['components']>>;
|
|
98
|
+
getComponent: (id: string) => Promise<APIResponse<ControlSnapshot['components'][0]>>;
|
|
99
|
+
getComponentState: (id: string) => Promise<APIResponse<{
|
|
100
|
+
state: Record<string, unknown>;
|
|
101
|
+
computed: Record<string, unknown>;
|
|
102
|
+
timestamp: number;
|
|
103
|
+
}>>;
|
|
104
|
+
executeComponentAction: (id: string, request: ComponentActionRequest) => Promise<APIResponse<ComponentActionResponse>>;
|
|
105
|
+
find: (request?: FindRequest) => Promise<APIResponse<FindResponse>>;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated Use find() instead
|
|
108
|
+
*/
|
|
109
|
+
discover: (request?: FindRequest) => Promise<APIResponse<FindResponse>>;
|
|
110
|
+
getControlSnapshot: () => Promise<APIResponse<ControlSnapshot>>;
|
|
111
|
+
getWorkflows: () => Promise<APIResponse<ControlSnapshot['workflows']>>;
|
|
112
|
+
runWorkflow: (id: string, request?: WorkflowRunRequest) => Promise<APIResponse<WorkflowRunResponse>>;
|
|
113
|
+
getWorkflowStatus: (runId: string) => Promise<APIResponse<WorkflowRunResponse>>;
|
|
114
|
+
getActionHistory: (limit?: number) => Promise<APIResponse<unknown[]>>;
|
|
115
|
+
getMetrics: () => Promise<APIResponse<unknown>>;
|
|
116
|
+
highlightElement: (id: string) => Promise<APIResponse<void>>;
|
|
117
|
+
getElementTree: () => Promise<APIResponse<unknown>>;
|
|
118
|
+
aiSearch: (criteria: SearchCriteria) => Promise<APIResponse<SearchResponse>>;
|
|
119
|
+
aiExecute: (request: NLActionRequest) => Promise<APIResponse<NLActionResponse>>;
|
|
120
|
+
aiAssert: (request: AssertionRequest) => Promise<APIResponse<AssertionResult>>;
|
|
121
|
+
aiAssertBatch: (request: BatchAssertionRequest) => Promise<APIResponse<BatchAssertionResult>>;
|
|
122
|
+
getSemanticSnapshot: () => Promise<APIResponse<SemanticSnapshot>>;
|
|
123
|
+
getSemanticDiff: (since?: number) => Promise<APIResponse<SemanticDiff | null>>;
|
|
124
|
+
getPageSummary: () => Promise<APIResponse<string>>;
|
|
125
|
+
aiSemanticSearch: (criteria: SemanticSearchCriteria) => Promise<APIResponse<SemanticSearchResponse>>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Route definition
|
|
129
|
+
*/
|
|
130
|
+
interface RouteDefinition {
|
|
131
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
132
|
+
path: string;
|
|
133
|
+
handler: string;
|
|
134
|
+
params?: string[];
|
|
135
|
+
bodyRequired?: boolean;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* All UI Bridge routes
|
|
139
|
+
*/
|
|
140
|
+
declare const UI_BRIDGE_ROUTES: RouteDefinition[];
|
|
141
|
+
/**
|
|
142
|
+
* WebSocket message types
|
|
143
|
+
*/
|
|
144
|
+
type WebSocketMessageType = 'subscribe' | 'unsubscribe' | 'event' | 'snapshot' | 'action' | 'error';
|
|
145
|
+
/**
|
|
146
|
+
* WebSocket message
|
|
147
|
+
*/
|
|
148
|
+
interface WebSocketMessage<T = unknown> {
|
|
149
|
+
type: WebSocketMessageType;
|
|
150
|
+
channel?: string;
|
|
151
|
+
data?: T;
|
|
152
|
+
error?: string;
|
|
153
|
+
timestamp: number;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { type APIResponse as A, type CORSOptions as C, type RateLimitOptions as R, type UIBridgeServerConfig as U, type WebSocketMessage as W, type RenderLogQuery as a, type RouteDefinition as b, type UIBridgeServerHandlers as c, UI_BRIDGE_ROUTES as d, type WebSocketMessageType as e };
|