@jackwener/browsermcp 0.0.37-embedded.1 → 0.0.38-embedded.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.
@@ -21242,6 +21242,47 @@ function date4(params) {
21242
21242
  }
21243
21243
 
21244
21244
  // src/api/errors.ts
21245
+ function compactErrorData(data) {
21246
+ let budget = 4e3;
21247
+ let truncated = false;
21248
+ function compact(value, depth) {
21249
+ if (budget <= 0 || depth > 4) {
21250
+ truncated = true;
21251
+ return "[omitted]";
21252
+ }
21253
+ if (typeof value === "string") {
21254
+ const limit = Math.min(600, budget);
21255
+ budget -= Math.min(limit, value.length);
21256
+ if (value.length > limit) {
21257
+ truncated = true;
21258
+ return value.slice(0, limit) + "\u2026";
21259
+ }
21260
+ return value;
21261
+ }
21262
+ if (Array.isArray(value)) {
21263
+ if (value.length > 8) truncated = true;
21264
+ return value.slice(0, 8).map((item) => compact(item, depth + 1));
21265
+ }
21266
+ if (value && typeof value === "object") {
21267
+ const result2 = {};
21268
+ const entries = Object.entries(value);
21269
+ if (entries.length > 20) truncated = true;
21270
+ for (const [key3, item] of entries.slice(0, 20)) {
21271
+ budget -= key3.length;
21272
+ if (key3 === "tabs" && Array.isArray(item)) {
21273
+ result2.tabCount = item.length;
21274
+ result2.tabDiscovery = "Use tabs_list to inspect tabs.";
21275
+ continue;
21276
+ }
21277
+ result2[key3] = compact(item, depth + 1);
21278
+ }
21279
+ return result2;
21280
+ }
21281
+ return value;
21282
+ }
21283
+ const result = compact(data, 0);
21284
+ return { ...result, ...truncated ? { detailsTruncated: true } : {} };
21285
+ }
21245
21286
  var ActionError = class extends Error {
21246
21287
  constructor(code, message, hint, data) {
21247
21288
  super(message);
@@ -21254,7 +21295,7 @@ var ActionError = class extends Error {
21254
21295
  hint;
21255
21296
  data;
21256
21297
  toJSON() {
21257
- return { ...this.data, code: this.code, message: this.message, ...this.hint && { hint: this.hint } };
21298
+ return { ...compactErrorData(this.data ?? {}), code: this.code, message: this.message, ...this.hint && { hint: this.hint } };
21258
21299
  }
21259
21300
  };
21260
21301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackwener/browsermcp",
3
- "version": "0.0.37-embedded.1",
3
+ "version": "0.0.38-embedded.0",
4
4
  "description": "Chrome-backed MCP browser service with optional site adapters.",
5
5
  "repository": {
6
6
  "type": "git",