@qontinui/ui-bridge-native 0.1.5 → 0.2.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/control/index.d.mts +9 -5
- package/dist/control/index.d.ts +9 -5
- package/dist/control/index.js +75 -12
- package/dist/control/index.js.map +1 -1
- package/dist/control/index.mjs +75 -12
- package/dist/control/index.mjs.map +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +69 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +69 -1
- package/dist/core/index.mjs.map +1 -1
- package/dist/debug/index.js.map +1 -1
- package/dist/debug/index.mjs.map +1 -1
- package/dist/design/index.d.mts +1 -1
- package/dist/design/index.d.ts +1 -1
- package/dist/{http-server-D7uVANBU.d.mts → http-server-DCdR8WlL.d.mts} +3 -3
- package/dist/{http-server-B7KudcYJ.d.ts → http-server-Dj3grQW4.d.ts} +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +498 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +493 -17
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +5 -5
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +504 -16
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +502 -17
- package/dist/react/index.mjs.map +1 -1
- package/dist/{registry-DhbGbl9c.d.mts → registry-Cahd8Gn2.d.mts} +16 -1
- package/dist/{registry-B8A_EoxS.d.ts → registry-z-3WJsxp.d.ts} +16 -1
- package/dist/server/index.d.mts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +102 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +102 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/{types-Bcj7ji97.d.mts → types-DAfCeWXc.d.mts} +22 -2
- package/dist/{types-BPNuYxDx.d.mts → types-Oz13YLZq.d.mts} +95 -1
- package/dist/{types-BPNuYxDx.d.ts → types-Oz13YLZq.d.ts} +95 -1
- package/dist/{types-BCYWwyVy.d.ts → types-ajakyp-l.d.ts} +22 -2
- package/dist/{useUIBridge-CDZbWxII.d.ts → useUIBridgeToast-D32KXyL1.d.ts} +154 -5
- package/dist/{useUIBridge-DfIEq9EQ.d.mts → useUIBridgeToast-GmT1TzUe.d.mts} +154 -5
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -1102,6 +1102,10 @@ var WS_ROUTES = [
|
|
|
1102
1102
|
{ pattern: "health", handler: "health", httpMethods: ["GET"] },
|
|
1103
1103
|
// Elements
|
|
1104
1104
|
{ pattern: "control/elements", handler: "getElements", httpMethods: ["GET"] },
|
|
1105
|
+
// Flat alias — matches the runner UI Bridge's `/ui-bridge/elements` path so
|
|
1106
|
+
// agents can use the same URL across runner + mobile without remembering
|
|
1107
|
+
// the `control/` prefix. Delegates to the same handler.
|
|
1108
|
+
{ pattern: "elements", handler: "getElements", httpMethods: ["GET"] },
|
|
1105
1109
|
{ pattern: "control/element/:id", handler: "getElement", httpMethods: ["GET"] },
|
|
1106
1110
|
{ pattern: "control/element/:id/state", handler: "getElementState", httpMethods: ["GET"] },
|
|
1107
1111
|
{ pattern: "control/element/:id/action", handler: "executeAction", httpMethods: ["POST"] },
|
|
@@ -1152,6 +1156,87 @@ var WS_ROUTES = [
|
|
|
1152
1156
|
// Meta / Introspection
|
|
1153
1157
|
{ pattern: "meta/methods", handler: "getMethods", httpMethods: ["GET"] }
|
|
1154
1158
|
];
|
|
1159
|
+
var HANDLER_DESCRIPTIONS = {
|
|
1160
|
+
health: "Liveness probe; returns app metadata + element count",
|
|
1161
|
+
getElements: "Flat list of registered UI elements",
|
|
1162
|
+
getElement: "Single element by id",
|
|
1163
|
+
getElementState: "Dynamic state (value, focused, checked) for one element",
|
|
1164
|
+
executeAction: 'Run an action on an element (see "actions" below for names)',
|
|
1165
|
+
getComponents: "Higher-level components with action schemas",
|
|
1166
|
+
getComponent: "Component detail + per-action paramSchema",
|
|
1167
|
+
executeComponentAction: "Invoke a component action directly (preferred over button clicks)",
|
|
1168
|
+
find: "AI-powered element search by natural-language query",
|
|
1169
|
+
getSnapshot: "Full snapshot: elements + route + state. Supports ?visibleOnly=true and ?currentRouteOnly=true",
|
|
1170
|
+
getWorkflows: "List registered workflows",
|
|
1171
|
+
runWorkflow: "Trigger a workflow by id",
|
|
1172
|
+
pageRefresh: "Reload the current route",
|
|
1173
|
+
pageNavigate: "Imperative router.push(url) \u2014 preferred over tapping tab buttons",
|
|
1174
|
+
pageReplace: "router.replace(url)",
|
|
1175
|
+
pageGoBack: "router.back()",
|
|
1176
|
+
pageGoForward: "router.forward()",
|
|
1177
|
+
getScreenshot: "PNG screenshot of the current screen",
|
|
1178
|
+
getElementStyles: "Computed styles for an element (design review)",
|
|
1179
|
+
getElementStateStyles: "Computed styles per interaction state (hover/focus/disabled)",
|
|
1180
|
+
getDesignSnapshot: "Visual + style snapshot for design review",
|
|
1181
|
+
getResponsiveSnapshots: "Screenshots at multiple viewport widths",
|
|
1182
|
+
runDesignAudit: "Accessibility + visual audit",
|
|
1183
|
+
loadStyleGuide: "Load a design system style guide",
|
|
1184
|
+
getStyleGuide: "Fetch the currently loaded style guide",
|
|
1185
|
+
clearStyleGuide: "Unload the style guide",
|
|
1186
|
+
evaluateQuality: "Score the current UI against a quality context",
|
|
1187
|
+
getQualityContexts: "List available quality evaluation contexts",
|
|
1188
|
+
saveBaseline: "Save a quality baseline snapshot",
|
|
1189
|
+
diffBaseline: "Diff current UI against a saved baseline",
|
|
1190
|
+
getMethods: "List every handler name (legacy introspection)"
|
|
1191
|
+
};
|
|
1192
|
+
var ACTION_REFERENCE = [
|
|
1193
|
+
{ name: "press", aliases: ["click"], params: "PressActionParams (optional position)" },
|
|
1194
|
+
{ name: "longPress", params: "PressActionParams (optional position)" },
|
|
1195
|
+
{ name: "doubleTap", params: "none" },
|
|
1196
|
+
{
|
|
1197
|
+
name: "type",
|
|
1198
|
+
params: "TypeActionParams { text, delay?, clear? | clearFirst? } \u2014 `clear:true` replaces content atomically"
|
|
1199
|
+
},
|
|
1200
|
+
{ name: "clear", params: "none \u2014 empties the input" },
|
|
1201
|
+
{ name: "focus", params: "none" },
|
|
1202
|
+
{ name: "blur", params: "none" },
|
|
1203
|
+
{ name: "scroll", params: "ScrollActionParams { offset? {x,y}, to? }" },
|
|
1204
|
+
{ name: "swipe", params: "SwipeActionParams { direction, distance }" },
|
|
1205
|
+
{ name: "toggle", params: "none \u2014 flips boolean controls" }
|
|
1206
|
+
];
|
|
1207
|
+
function buildRoutesPayload() {
|
|
1208
|
+
const entries = [];
|
|
1209
|
+
for (const r of WS_ROUTES) {
|
|
1210
|
+
if (!r.httpMethods) continue;
|
|
1211
|
+
for (const m of r.httpMethods) {
|
|
1212
|
+
entries.push({ method: m, path: `/ui-bridge/${r.pattern}` });
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
entries.push({ method: "GET", path: "/ui-bridge/_help" });
|
|
1216
|
+
entries.push({ method: "GET", path: "/ui-bridge/_routes" });
|
|
1217
|
+
entries.sort((a, b) => a.path.localeCompare(b.path) || a.method.localeCompare(b.method));
|
|
1218
|
+
return { routes: entries, count: entries.length };
|
|
1219
|
+
}
|
|
1220
|
+
function buildHelpPayload() {
|
|
1221
|
+
return {
|
|
1222
|
+
version: 1,
|
|
1223
|
+
description: "UI Bridge Native HTTP surface. Prefix every path with /ui-bridge/.",
|
|
1224
|
+
routes: WS_ROUTES.map((r) => ({
|
|
1225
|
+
pattern: r.pattern,
|
|
1226
|
+
httpMethods: r.httpMethods ?? [],
|
|
1227
|
+
wsOnly: !r.httpMethods,
|
|
1228
|
+
handler: r.handler,
|
|
1229
|
+
description: HANDLER_DESCRIPTIONS[r.handler] ?? ""
|
|
1230
|
+
})),
|
|
1231
|
+
actions: ACTION_REFERENCE,
|
|
1232
|
+
tips: [
|
|
1233
|
+
"Start with `GET /ui-bridge/control/snapshot?visibleOnly=true` to see what the user actually sees.",
|
|
1234
|
+
"Prefer `control/component/:id/action/:actionId` over button presses \u2014 typed paramSchema, no button-id guessing.",
|
|
1235
|
+
"Use `pageNavigate` for tab switches instead of pressing tab buttons; gesture state often swallows clicks.",
|
|
1236
|
+
"The `type` action supports `clear:true` to replace existing text atomically in one call."
|
|
1237
|
+
]
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1155
1240
|
var NativeUIBridgeServer = class {
|
|
1156
1241
|
constructor(registry, executor, config = {}) {
|
|
1157
1242
|
this.registry = registry;
|
|
@@ -1168,7 +1253,9 @@ var NativeUIBridgeServer = class {
|
|
|
1168
1253
|
cors: true,
|
|
1169
1254
|
...config
|
|
1170
1255
|
};
|
|
1171
|
-
this.handlers = createServerHandlers(registry, executor
|
|
1256
|
+
this.handlers = createServerHandlers(registry, executor, {
|
|
1257
|
+
appInfo: this.config.appInfo
|
|
1258
|
+
});
|
|
1172
1259
|
this.handlers.getMethods = async () => {
|
|
1173
1260
|
const methods = WS_ROUTES.map((r) => ({
|
|
1174
1261
|
method: r.pattern,
|
|
@@ -1972,6 +2059,20 @@ var NativeUIBridgeServer = class {
|
|
|
1972
2059
|
};
|
|
1973
2060
|
}
|
|
1974
2061
|
const stripped = path.slice(PREFIX.length);
|
|
2062
|
+
if (method === "GET" && stripped === "_help") {
|
|
2063
|
+
return {
|
|
2064
|
+
success: true,
|
|
2065
|
+
data: buildHelpPayload(),
|
|
2066
|
+
timestamp: Date.now()
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
if (method === "GET" && stripped === "_routes") {
|
|
2070
|
+
return {
|
|
2071
|
+
success: true,
|
|
2072
|
+
data: buildRoutesPayload(),
|
|
2073
|
+
timestamp: Date.now()
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
1975
2076
|
let patternMatchedButWrongVerb = false;
|
|
1976
2077
|
for (const route of WS_ROUTES) {
|
|
1977
2078
|
const pathParams = parsePath(route.pattern, stripped);
|