@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.
- package/CHANGELOG.md +8 -0
- package/dist/docs/api-reference.md +5 -5
- package/dist/docs/api-use.md +2 -2
- package/dist/docs/js-tool.md +11 -1
- package/dist/src/api/action-input.d.ts +25 -0
- package/dist/src/api/action-input.js +1 -1
- package/dist/src/api/action-input.js.map +1 -1
- package/dist/src/api/commands.d.ts +54 -0
- package/dist/src/api/commands.js +3 -3
- package/dist/src/api/commands.js.map +1 -1
- package/dist/src/api/errors.d.ts +2 -0
- package/dist/src/api/errors.js +46 -2
- package/dist/src/api/errors.js.map +1 -1
- package/dist/src/api/observation.js +5 -0
- package/dist/src/api/observation.js.map +1 -1
- package/dist/src/api/tab.d.ts +9 -2
- package/dist/src/api/tab.js +28 -3
- package/dist/src/api/tab.js.map +1 -1
- package/dist/src/mcp/js-session.js +22 -3
- package/dist/src/mcp/js-session.js.map +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/shared/aria-tree.d.ts +1 -1
- package/dist/src/shared/aria-tree.js +29 -12
- package/dist/src/shared/aria-tree.js.map +1 -1
- package/docs/api-reference.md +5 -5
- package/docs/api-use.md +2 -2
- package/docs/js-tool.md +11 -1
- package/extension/dist/background.js +42 -1
- package/package.json +1 -1
|
@@ -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
|
|