@ai-ecoverse/slicc-browsers 1.19.1 → 1.19.2

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/guard-driver.mjs CHANGED
@@ -459,11 +459,31 @@ export const idleDebuggerCleanup = (vector, step, phase, out) =>
459
459
  export const debuggerPaused = (events, session) =>
460
460
  events.some((event) => event.sessionId === session && event.method === 'Debugger.paused');
461
461
 
462
- export const trustedClientOnly = (step, out) =>
463
- trustedEmulationMethods.has(step.cdp) &&
464
- !out.ok &&
465
- Number(out.error?.code) === -32000 &&
466
- /only available to trusted clients/i.test(String(out.error?.message ?? ''));
462
+ const cdpError = (error) => {
463
+ const code = error?.code;
464
+ const message = error?.message;
465
+ if (code !== undefined && code !== null) return { code, message };
466
+ if (typeof message !== 'string') return { code, message };
467
+ try {
468
+ const parsed = JSON.parse(message);
469
+ if (
470
+ parsed &&
471
+ typeof parsed === 'object' &&
472
+ typeof parsed.code === 'number' &&
473
+ typeof parsed.message === 'string'
474
+ )
475
+ return { code: parsed.code, message: parsed.message };
476
+ } catch {}
477
+ return { code, message };
478
+ };
479
+
480
+ export const trustedClientOnly = (step, out) => {
481
+ if (!trustedEmulationMethods.has(step.cdp) || out.ok) return false;
482
+ const { code, message } = cdpError(out.error);
483
+ return (
484
+ Number(code) === -32000 && /only available to trusted clients/i.test(String(message ?? ''))
485
+ );
486
+ };
467
487
 
468
488
  export const refusalError = (step, out, refused, gone, phase, vector) =>
469
489
  step.refusable && !out.ok && !refused && !gone && !idleDebuggerCleanup(vector, step, phase, out);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.19.1",
3
+ "setVersion": "1.19.2",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.19.1",
3
+ "version": "1.19.2",
4
4
  "description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",