@qontinui/ui-bridge-native 0.6.8 → 0.6.9

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.
@@ -55,6 +55,11 @@ var UI_BRIDGE_NATIVE_ROUTES = {
55
55
  path: "/ui-bridge/control/snapshot",
56
56
  description: "Get full bridge snapshot"
57
57
  },
58
+ DISCOVER: {
59
+ method: "GET",
60
+ path: "/ui-bridge/control/discover",
61
+ description: "Discover elements (alias for snapshot; web/runner parity)"
62
+ },
58
63
  PAGE_HEALTH: {
59
64
  method: "POST",
60
65
  path: "/ui-bridge/control/page-health",
@@ -182,6 +187,18 @@ var UI_BRIDGE_NATIVE_ROUTES = {
182
187
  path: "/ui-bridge/control/modal/dismiss/:id",
183
188
  description: "Dismiss a modal by id (testHooks)"
184
189
  },
190
+ // Observability — last-N ring buffers (always mounted; `installed:false`
191
+ // when the console/network patches are off, i.e. no testHooks).
192
+ CONSOLE_ERRORS: {
193
+ method: "GET",
194
+ path: "/ui-bridge/control/console-errors",
195
+ description: "Last-N captured console.error/console.warn entries"
196
+ },
197
+ NETWORK_REQUESTS: {
198
+ method: "GET",
199
+ path: "/ui-bridge/sdk/network-requests",
200
+ description: "Last-N captured fetch/XHR requests with status + duration"
201
+ },
185
202
  // Health
186
203
  HEALTH: {
187
204
  method: "GET",
@@ -1714,7 +1731,8 @@ function createServerHandlers(registry, executor, config) {
1714
1731
  return success2({
1715
1732
  entries: [],
1716
1733
  count: 0,
1717
- bufferSize: 0
1734
+ bufferSize: 0,
1735
+ installed: false
1718
1736
  });
1719
1737
  }
1720
1738
  const entries = buf.entries({
@@ -1724,7 +1742,8 @@ function createServerHandlers(registry, executor, config) {
1724
1742
  return success2({
1725
1743
  entries,
1726
1744
  count: entries.length,
1727
- bufferSize: buf.size()
1745
+ bufferSize: buf.size(),
1746
+ installed: buf.isInstalled()
1728
1747
  });
1729
1748
  },
1730
1749
  getNetworkRequests: async (ctx) => {
@@ -1735,7 +1754,8 @@ function createServerHandlers(registry, executor, config) {
1735
1754
  return success2({
1736
1755
  entries: [],
1737
1756
  count: 0,
1738
- bufferSize: 0
1757
+ bufferSize: 0,
1758
+ installed: false
1739
1759
  });
1740
1760
  }
1741
1761
  const entries = buf.entries({
@@ -1745,7 +1765,8 @@ function createServerHandlers(registry, executor, config) {
1745
1765
  return success2({
1746
1766
  entries,
1747
1767
  count: entries.length,
1748
- bufferSize: buf.size()
1768
+ bufferSize: buf.size(),
1769
+ installed: buf.isInstalled()
1749
1770
  });
1750
1771
  },
1751
1772
  // Test hooks — modal stack manipulation
@@ -2164,7 +2185,10 @@ var WS_ROUTES = [
2164
2185
  // same handler at both paths to keep agents portable across platforms.
2165
2186
  { pattern: "ai/find", handler: "find", httpMethods: ["POST"] },
2166
2187
  { pattern: "control/snapshot", handler: "getSnapshot", httpMethods: ["GET"] },
2167
- { pattern: "control/discover", handler: "getSnapshot" },
2188
+ // Discovery alias — web/runner parity with `POST /control/discover` (a
2189
+ // legacy alias for snapshot/find). Mounted on HTTP (GET+POST) so mobile
2190
+ // doesn't 404 where web returns 200; delegates to the snapshot handler.
2191
+ { pattern: "control/discover", handler: "getSnapshot", httpMethods: ["GET", "POST"] },
2168
2192
  // Page health — accepts both GET and POST so the canonical skill invocation
2169
2193
  // (`POST .../control/page-health` with an empty body) and ad-hoc curls both
2170
2194
  // work without a body-shape gotcha.
@@ -2258,19 +2282,26 @@ var WS_ROUTES = [
2258
2282
  httpMethods: ["POST"],
2259
2283
  requiresTestHooks: true
2260
2284
  },
2261
- // Observability — last-N console errors + network requests. testHooks-gated
2262
- // because patching `console.error` / `fetch` is invasive in production.
2285
+ // Observability — last-N console errors + network requests.
2286
+ //
2287
+ // Always mounted (not testHooks-gated) so they return a schema-valid 200
2288
+ // on every build instead of a 404 that agents can't distinguish from a
2289
+ // missing route. The INVASIVE part — monkey-patching `console.error` /
2290
+ // `fetch` / `XMLHttpRequest` — stays gated behind `testHooks` (see
2291
+ // NativeUIBridgeServer.start → buffer.install()). When the patches aren't
2292
+ // installed the handlers report `installed: false` + empty entries, so
2293
+ // production builds expose the contract without observing real users'
2294
+ // console/network traffic. Set `features.testHooks` (typically on
2295
+ // `__DEV__`) to populate the buffers with live data.
2263
2296
  {
2264
2297
  pattern: "control/console-errors",
2265
2298
  handler: "getConsoleErrors",
2266
- httpMethods: ["GET"],
2267
- requiresTestHooks: true
2299
+ httpMethods: ["GET"]
2268
2300
  },
2269
2301
  {
2270
2302
  pattern: "sdk/network-requests",
2271
2303
  handler: "getNetworkRequests",
2272
- httpMethods: ["GET"],
2273
- requiresTestHooks: true
2304
+ httpMethods: ["GET"]
2274
2305
  }
2275
2306
  ];
2276
2307
  var HANDLER_DESCRIPTIONS = {
@@ -2317,8 +2348,8 @@ var HANDLER_DESCRIPTIONS = {
2317
2348
  typeInto: "App-agnostic: type into the input matching a label: body { label, text, clear?, visibleOnly? }. (selector form is web-only)",
2318
2349
  readValue: "STUB \u2014 selector-based; NOT_SUPPORTED on native (no DOM). Use /control/element/:id/state to read a value.",
2319
2350
  findByText: "App-agnostic: list elements matching free-text (no press): body { text, visibleOnly? }",
2320
- getConsoleErrors: "TEST HOOK \u2014 last-N console.error/console.warn entries; ?since=<ms>&limit=<n>",
2321
- getNetworkRequests: "TEST HOOK \u2014 last-N fetch/XHR entries with status + duration; ?since=<ms>&limit=<n>",
2351
+ getConsoleErrors: "Last-N console.error/console.warn entries; ?since=<ms>&limit=<n>. `installed:false` when capture is off (no testHooks) \u2014 entries empty but schema-valid.",
2352
+ getNetworkRequests: "Last-N fetch/XHR entries with status + duration; ?since=<ms>&limit=<n>. `installed:false` when capture is off (no testHooks) \u2014 entries empty but schema-valid.",
2322
2353
  pushModal: "TEST HOOK \u2014 push a modal onto the snapshot.modalStack via the registry ModalDetector",
2323
2354
  dismissModal: "TEST HOOK \u2014 dismiss a modal by id from the snapshot.modalStack via the registry ModalDetector",
2324
2355
  keepAwake: "TEST HOOK \u2014 keep the device screen awake via the injected keepAwakeProvider: body { enabled: boolean, durationMs?: number }"