unbrowse 3.7.1 → 3.8.0-preview.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/dist/cli.js +9 -2
- package/dist/mcp.js +4 -4
- package/dist/server.js +66 -21
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -31,7 +31,7 @@ var __promiseAll = (args) => Promise.all(args);
|
|
|
31
31
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
32
32
|
|
|
33
33
|
// ../../src/build-info.generated.ts
|
|
34
|
-
var BUILD_RELEASE_VERSION = "3.
|
|
34
|
+
var BUILD_RELEASE_VERSION = "3.8.0-preview.2", BUILD_GIT_SHA = "efefee1f85df", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy44LjAtcHJldmlldy4yIiwiZ2l0X3NoYSI6ImVmZWZlZTFmODVkZiIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAZWZlZmVlMWY4NWRmIiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQxNzowOTo0OS44NzNaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "nVliy0ydfucv7W56hI5CiuHzYJ92ve4oJqgzV1NFASg", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
|
|
35
35
|
|
|
36
36
|
// ../../src/version.ts
|
|
37
37
|
import { createHash } from "crypto";
|
|
@@ -1183,6 +1183,9 @@ async function getDefaultTabOn(state) {
|
|
|
1183
1183
|
async function start(port, state = defaultBrokerState) {
|
|
1184
1184
|
return startOn(state, port);
|
|
1185
1185
|
}
|
|
1186
|
+
async function stop(state = defaultBrokerState) {
|
|
1187
|
+
return stopOn(state);
|
|
1188
|
+
}
|
|
1186
1189
|
async function getDefaultTab(state = defaultBrokerState) {
|
|
1187
1190
|
return getDefaultTabOn(state);
|
|
1188
1191
|
}
|
|
@@ -3499,7 +3502,11 @@ async function bootstrapAgentMailKey() {
|
|
|
3499
3502
|
success: false,
|
|
3500
3503
|
error: "Reached dashboard but could not extract API key. Create one manually at https://console.agentmail.to/dashboard/api-keys"
|
|
3501
3504
|
};
|
|
3502
|
-
} finally {
|
|
3505
|
+
} finally {
|
|
3506
|
+
try {
|
|
3507
|
+
await stop();
|
|
3508
|
+
} catch {}
|
|
3509
|
+
}
|
|
3503
3510
|
}
|
|
3504
3511
|
function persistApiKeyToShell(apiKey) {
|
|
3505
3512
|
const shell = process.env.SHELL ?? "/bin/zsh";
|
package/dist/mcp.js
CHANGED
|
@@ -225,11 +225,11 @@ import { dirname, join, parse } from "path";
|
|
|
225
225
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
226
226
|
|
|
227
227
|
// ../../src/build-info.generated.ts
|
|
228
|
-
var BUILD_RELEASE_VERSION = "3.
|
|
229
|
-
var BUILD_GIT_SHA = "
|
|
228
|
+
var BUILD_RELEASE_VERSION = "3.8.0-preview.2";
|
|
229
|
+
var BUILD_GIT_SHA = "efefee1f85df";
|
|
230
230
|
var BUILD_CODE_HASH = "5d9ebf619c61";
|
|
231
|
-
var BUILD_RELEASE_MANIFEST_BASE64 = "
|
|
232
|
-
var BUILD_RELEASE_MANIFEST_SIGNATURE = "
|
|
231
|
+
var BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy44LjAtcHJldmlldy4yIiwiZ2l0X3NoYSI6ImVmZWZlZTFmODVkZiIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAZWZlZmVlMWY4NWRmIiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQxNzowOTo0OS44NzNaIn0";
|
|
232
|
+
var BUILD_RELEASE_MANIFEST_SIGNATURE = "nVliy0ydfucv7W56hI5CiuHzYJ92ve4oJqgzV1NFASg";
|
|
233
233
|
var BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
|
|
234
234
|
|
|
235
235
|
// ../../src/version.ts
|
package/dist/server.js
CHANGED
|
@@ -7120,7 +7120,7 @@ var init_capture = __esm(async () => {
|
|
|
7120
7120
|
});
|
|
7121
7121
|
|
|
7122
7122
|
// ../../src/build-info.generated.ts
|
|
7123
|
-
var BUILD_RELEASE_VERSION = "3.
|
|
7123
|
+
var BUILD_RELEASE_VERSION = "3.8.0-preview.2", BUILD_GIT_SHA = "efefee1f85df", BUILD_CODE_HASH = "5d9ebf619c61", BUILD_RELEASE_MANIFEST_BASE64 = "eyJzY2hlbWFfdmVyc2lvbiI6MSwicmVsZWFzZV92ZXJzaW9uIjoiMy44LjAtcHJldmlldy4yIiwiZ2l0X3NoYSI6ImVmZWZlZTFmODVkZiIsImNvZGVfaGFzaCI6IjVkOWViZjYxOWM2MSIsInRyYWNlX3ZlcnNpb24iOiI1ZDllYmY2MTljNjFAZWZlZmVlMWY4NWRmIiwiaXNzdWVkX2F0IjoiMjAyNi0wNC0xMFQxNzowOTo0OS44NzNaIn0", BUILD_RELEASE_MANIFEST_SIGNATURE = "nVliy0ydfucv7W56hI5CiuHzYJ92ve4oJqgzV1NFASg", BUILD_DEFAULT_BACKEND_URL = "https://beta-api.unbrowse.ai";
|
|
7124
7124
|
|
|
7125
7125
|
// ../../src/version.ts
|
|
7126
7126
|
import { createHash as createHash2 } from "crypto";
|
|
@@ -16839,6 +16839,30 @@ async function executeBrowserCapture(skill, params, options) {
|
|
|
16839
16839
|
}
|
|
16840
16840
|
};
|
|
16841
16841
|
}
|
|
16842
|
+
const capturedMeta = (() => {
|
|
16843
|
+
const html = captured.html ?? "";
|
|
16844
|
+
const titleMatch = html.toLowerCase().match(/<title[^>]*>([^<]{0,200})<\/title>/);
|
|
16845
|
+
const title = titleMatch ? titleMatch[1].trim() : "";
|
|
16846
|
+
const stripped = html.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, "").replace(/<style[^>]*>[\s\S]*?<\/style>/gi, "");
|
|
16847
|
+
const text = stripped.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
16848
|
+
let intentVerdict = "skip";
|
|
16849
|
+
let intentReason = "no_semantic_assessment";
|
|
16850
|
+
if (text && intent) {
|
|
16851
|
+
try {
|
|
16852
|
+
const assessment = assessIntentResult(text, intent);
|
|
16853
|
+
intentVerdict = assessment.verdict;
|
|
16854
|
+
intentReason = assessment.reason;
|
|
16855
|
+
} catch {}
|
|
16856
|
+
}
|
|
16857
|
+
return {
|
|
16858
|
+
html_bytes: html.length,
|
|
16859
|
+
title,
|
|
16860
|
+
text_bytes: text.length,
|
|
16861
|
+
observed_api_calls: captured.requests?.length ?? 0,
|
|
16862
|
+
intent_verdict: intentVerdict,
|
|
16863
|
+
intent_reason: intentReason
|
|
16864
|
+
};
|
|
16865
|
+
})();
|
|
16842
16866
|
const trace2 = stampTrace({
|
|
16843
16867
|
trace_id: traceId,
|
|
16844
16868
|
skill_id: skill.skill_id,
|
|
@@ -16852,7 +16876,8 @@ async function executeBrowserCapture(skill, params, options) {
|
|
|
16852
16876
|
trace: trace2,
|
|
16853
16877
|
result: {
|
|
16854
16878
|
error: "no_endpoints",
|
|
16855
|
-
message: `No API endpoints or structured DOM data found at ${url}. The site may require authentication or may not expose machine-readable data from this page
|
|
16879
|
+
message: `No API endpoints or structured DOM data found at ${url}. The site may require authentication or may not expose machine-readable data from this page.`,
|
|
16880
|
+
captured_meta: capturedMeta
|
|
16856
16881
|
}
|
|
16857
16882
|
};
|
|
16858
16883
|
}
|
|
@@ -22339,25 +22364,45 @@ async function resolveAndExecute(intent, params = {}, context, projection, optio
|
|
|
22339
22364
|
redirect: "follow"
|
|
22340
22365
|
});
|
|
22341
22366
|
const ct = directRes.headers.get("content-type") ?? "";
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
|
|
22345
|
-
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22350
|
-
|
|
22351
|
-
|
|
22352
|
-
|
|
22353
|
-
|
|
22354
|
-
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22367
|
+
const ctSaysJson = ct.includes("application/json") || ct.includes("+json") || ct.includes("text/json");
|
|
22368
|
+
if (directRes.ok) {
|
|
22369
|
+
let data = undefined;
|
|
22370
|
+
if (ctSaysJson) {
|
|
22371
|
+
data = await directRes.json();
|
|
22372
|
+
} else {
|
|
22373
|
+
const bodyText = await directRes.text();
|
|
22374
|
+
if (bodyText.length < 2000000) {
|
|
22375
|
+
const trimmed = bodyText.trimStart();
|
|
22376
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
22377
|
+
try {
|
|
22378
|
+
const parsed = JSON.parse(bodyText);
|
|
22379
|
+
if (parsed !== null && typeof parsed === "object") {
|
|
22380
|
+
data = parsed;
|
|
22381
|
+
console.log(`[direct-fetch] ${context.url} body-sniff hit: ct="${ct}" but body parses as JSON`);
|
|
22382
|
+
}
|
|
22383
|
+
} catch {}
|
|
22384
|
+
}
|
|
22385
|
+
}
|
|
22386
|
+
}
|
|
22387
|
+
if (data !== undefined) {
|
|
22388
|
+
const trace2 = {
|
|
22389
|
+
trace_id: nanoid9(),
|
|
22390
|
+
skill_id: "direct-fetch",
|
|
22391
|
+
endpoint_id: "direct-fetch",
|
|
22392
|
+
started_at: new Date().toISOString(),
|
|
22393
|
+
completed_at: new Date().toISOString(),
|
|
22394
|
+
success: true
|
|
22395
|
+
};
|
|
22396
|
+
const t = finalize("direct-fetch", data, "direct-fetch", undefined, trace2);
|
|
22397
|
+
console.log(`[direct-fetch] ${context.url} returned JSON directly — skipping browser`);
|
|
22398
|
+
return {
|
|
22399
|
+
result: data,
|
|
22400
|
+
trace: trace2,
|
|
22401
|
+
source: "direct-fetch",
|
|
22402
|
+
skill: undefined,
|
|
22403
|
+
timing: t
|
|
22404
|
+
};
|
|
22405
|
+
}
|
|
22361
22406
|
}
|
|
22362
22407
|
} catch (err) {
|
|
22363
22408
|
const msg = err instanceof Error ? err.message : String(err);
|