@qontinui/ui-bridge-wrapper 0.5.0 → 0.6.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.
@@ -254,6 +254,7 @@ Underlying import error: ${cause}`
254
254
  );
255
255
  }
256
256
  const initScripts = await this.buildInitScripts();
257
+ const relayAuth = this.relayAuth();
257
258
  let tab;
258
259
  try {
259
260
  tab = await launchHeadlessTab({
@@ -267,7 +268,9 @@ Underlying import error: ${cause}`
267
268
  forwardConsole: this.options.forwardConsole,
268
269
  initScripts: initScripts.length > 0 ? initScripts : void 0,
269
270
  launchArgs: this.options.launchArgs && this.options.launchArgs.length > 0 ? this.options.launchArgs : void 0,
270
- storageStatePath: this.options.storageStatePath
271
+ storageStatePath: this.options.storageStatePath,
272
+ ...relayAuth.authToken ? { authToken: relayAuth.authToken } : {},
273
+ ...relayAuth.callerUserId ? { callerUserId: relayAuth.callerUserId } : {}
271
274
  });
272
275
  } catch (err) {
273
276
  const cause = err instanceof Error ? err.message : String(err);
@@ -299,6 +302,15 @@ Underlying launch error: ${cause}`
299
302
  async buildInitScripts() {
300
303
  return [];
301
304
  }
305
+ /**
306
+ * Subclass hook: credentials for the launcher's Node-side relay registration
307
+ * poll (`<uiBridgeBase>/tabs`). Default: none (anonymous poll — correct for an
308
+ * ungated relay). Injected mode overrides this with the `--auth-token` bearer
309
+ * and the `--registration-metadata` userId.
310
+ */
311
+ relayAuth() {
312
+ return {};
313
+ }
302
314
  /**
303
315
  * Subclass hook: run after launch + navigation, before `ready()` resolves.
304
316
  * Default: no-op. Injected mode overrides it to await the in-page runtime.
@@ -392,8 +404,8 @@ var InjectedTransport = class extends HeadlessTransport {
392
404
  cfg.registrationMetadata = this.injected.registrationMetadata;
393
405
  if (this.injected.appId) cfg.appId = this.injected.appId;
394
406
  if (this.injected.appName) cfg.appName = this.injected.appName;
395
- if (this.injected.tabId) cfg.tabId = this.injected.tabId;
396
407
  }
408
+ if (this.injected.tabId) cfg.tabId = this.injected.tabId;
397
409
  if (this.injected.settleQuietMs !== void 0)
398
410
  cfg.settleQuietMs = this.injected.settleQuietMs;
399
411
  if (this.injected.settleTimeoutMs !== void 0)
@@ -402,6 +414,18 @@ var InjectedTransport = class extends HeadlessTransport {
402
414
  cfg.expectSelector = this.injected.expectSelector;
403
415
  return Object.keys(cfg).length > 0 ? cfg : null;
404
416
  }
417
+ /**
418
+ * The relay credentials the Node-side registration poll needs. Same bearer the
419
+ * page-side client gets via `__uiBridgeInjectedConfig.authToken`; without it
420
+ * the poll against a gated relay 401s and the CLI reports `tabId: null` on a
421
+ * launch that actually registered.
422
+ */
423
+ relayAuth() {
424
+ return {
425
+ ...this.injected.authToken ? { authToken: this.injected.authToken } : {},
426
+ ...this.injected.registrationMetadata?.userId ? { callerUserId: this.injected.registrationMetadata.userId } : {}
427
+ };
428
+ }
405
429
  async buildInitScripts() {
406
430
  const scripts = [];
407
431
  const cfg = this.injectedConfig();