@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.
@@ -260,6 +260,7 @@ Underlying import error: ${cause}`
260
260
  );
261
261
  }
262
262
  const initScripts = await this.buildInitScripts();
263
+ const relayAuth = this.relayAuth();
263
264
  let tab;
264
265
  try {
265
266
  tab = await launchHeadlessTab({
@@ -273,7 +274,9 @@ Underlying import error: ${cause}`
273
274
  forwardConsole: this.options.forwardConsole,
274
275
  initScripts: initScripts.length > 0 ? initScripts : void 0,
275
276
  launchArgs: this.options.launchArgs && this.options.launchArgs.length > 0 ? this.options.launchArgs : void 0,
276
- storageStatePath: this.options.storageStatePath
277
+ storageStatePath: this.options.storageStatePath,
278
+ ...relayAuth.authToken ? { authToken: relayAuth.authToken } : {},
279
+ ...relayAuth.callerUserId ? { callerUserId: relayAuth.callerUserId } : {}
277
280
  });
278
281
  } catch (err) {
279
282
  const cause = err instanceof Error ? err.message : String(err);
@@ -305,6 +308,15 @@ Underlying launch error: ${cause}`
305
308
  async buildInitScripts() {
306
309
  return [];
307
310
  }
311
+ /**
312
+ * Subclass hook: credentials for the launcher's Node-side relay registration
313
+ * poll (`<uiBridgeBase>/tabs`). Default: none (anonymous poll — correct for an
314
+ * ungated relay). Injected mode overrides this with the `--auth-token` bearer
315
+ * and the `--registration-metadata` userId.
316
+ */
317
+ relayAuth() {
318
+ return {};
319
+ }
308
320
  /**
309
321
  * Subclass hook: run after launch + navigation, before `ready()` resolves.
310
322
  * Default: no-op. Injected mode overrides it to await the in-page runtime.
@@ -398,8 +410,8 @@ var InjectedTransport = class extends HeadlessTransport {
398
410
  cfg.registrationMetadata = this.injected.registrationMetadata;
399
411
  if (this.injected.appId) cfg.appId = this.injected.appId;
400
412
  if (this.injected.appName) cfg.appName = this.injected.appName;
401
- if (this.injected.tabId) cfg.tabId = this.injected.tabId;
402
413
  }
414
+ if (this.injected.tabId) cfg.tabId = this.injected.tabId;
403
415
  if (this.injected.settleQuietMs !== void 0)
404
416
  cfg.settleQuietMs = this.injected.settleQuietMs;
405
417
  if (this.injected.settleTimeoutMs !== void 0)
@@ -408,6 +420,18 @@ var InjectedTransport = class extends HeadlessTransport {
408
420
  cfg.expectSelector = this.injected.expectSelector;
409
421
  return Object.keys(cfg).length > 0 ? cfg : null;
410
422
  }
423
+ /**
424
+ * The relay credentials the Node-side registration poll needs. Same bearer the
425
+ * page-side client gets via `__uiBridgeInjectedConfig.authToken`; without it
426
+ * the poll against a gated relay 401s and the CLI reports `tabId: null` on a
427
+ * launch that actually registered.
428
+ */
429
+ relayAuth() {
430
+ return {
431
+ ...this.injected.authToken ? { authToken: this.injected.authToken } : {},
432
+ ...this.injected.registrationMetadata?.userId ? { callerUserId: this.injected.registrationMetadata.userId } : {}
433
+ };
434
+ }
411
435
  async buildInitScripts() {
412
436
  const scripts = [];
413
437
  const cfg = this.injectedConfig();