@quanta-intellect/vessel-browser 0.1.65 → 0.1.67
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/out/main/index.js +29 -13
- package/package.json +1 -1
package/out/main/index.js
CHANGED
|
@@ -4419,6 +4419,13 @@ function inferPageSchema(page) {
|
|
|
4419
4419
|
confidence
|
|
4420
4420
|
};
|
|
4421
4421
|
}
|
|
4422
|
+
const DEFAULT_PAGE_SCRIPT_TIMEOUT_MS$1 = 1500;
|
|
4423
|
+
const EXTRACT_SCRIPT_TIMEOUT_MS = 3e3;
|
|
4424
|
+
const EXTRACT_TIMEOUT_BASE_MS = 12e3;
|
|
4425
|
+
const EXTRACT_TIMEOUT_MAX_MS = 2e4;
|
|
4426
|
+
const MUTATION_CAPTURE_INTERVAL_MS = 5e3;
|
|
4427
|
+
const MUTATION_SETTLE_AFTER_MS = 1500;
|
|
4428
|
+
const AGENT_STREAM_IDLE_TIMEOUT_MS = 3e4;
|
|
4422
4429
|
const logger$e = createLogger("Extractor");
|
|
4423
4430
|
const EMPTY_PAGE_CONTENT = {
|
|
4424
4431
|
title: "",
|
|
@@ -5136,8 +5143,7 @@ const DIRECT_EXTRACTION_SCRIPT = String.raw`
|
|
|
5136
5143
|
function delay(ms) {
|
|
5137
5144
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5138
5145
|
}
|
|
5139
|
-
|
|
5140
|
-
async function waitForDomReady(webContents, timeoutMs = 1500) {
|
|
5146
|
+
async function waitForDomReady(webContents, timeoutMs = DEFAULT_PAGE_SCRIPT_TIMEOUT_MS$1) {
|
|
5141
5147
|
const deadline = Date.now() + timeoutMs;
|
|
5142
5148
|
while (Date.now() < deadline) {
|
|
5143
5149
|
const readyState = await executeScript(
|
|
@@ -5163,7 +5169,10 @@ async function executeScript(webContents, script) {
|
|
|
5163
5169
|
return await Promise.race([
|
|
5164
5170
|
webContents.executeJavaScript(script),
|
|
5165
5171
|
new Promise((resolve) => {
|
|
5166
|
-
timer = setTimeout(
|
|
5172
|
+
timer = setTimeout(
|
|
5173
|
+
() => resolve(null),
|
|
5174
|
+
EXTRACT_SCRIPT_TIMEOUT_MS
|
|
5175
|
+
);
|
|
5167
5176
|
})
|
|
5168
5177
|
]);
|
|
5169
5178
|
} catch (err) {
|
|
@@ -5260,8 +5269,6 @@ function mergePageContent(candidates, webContents) {
|
|
|
5260
5269
|
url: mergedBase.url || webContents.getURL() || ""
|
|
5261
5270
|
};
|
|
5262
5271
|
}
|
|
5263
|
-
const EXTRACT_TIMEOUT_BASE_MS = 12e3;
|
|
5264
|
-
const EXTRACT_TIMEOUT_MAX_MS = 2e4;
|
|
5265
5272
|
async function estimateExtractionTimeout(webContents) {
|
|
5266
5273
|
try {
|
|
5267
5274
|
const elementCount = await executeScript(
|
|
@@ -5370,8 +5377,6 @@ function attachDestroyCleanup(wc) {
|
|
|
5370
5377
|
cleanupTimersForWcId(wc.id);
|
|
5371
5378
|
});
|
|
5372
5379
|
}
|
|
5373
|
-
const MIN_MUTATION_CAPTURE_INTERVAL_MS = 5e3;
|
|
5374
|
-
const SETTLE_AFTER_ACTIVITY_MS = 1500;
|
|
5375
5380
|
function getLatestPageDiff(rawUrl) {
|
|
5376
5381
|
if (!shouldTrackSnapshotUrl(rawUrl)) return null;
|
|
5377
5382
|
return latestPageDiffs.get(normalizeUrl(rawUrl)) ?? null;
|
|
@@ -5429,8 +5434,8 @@ async function capturePageSnapshot(url, wc, sendToRendererViews) {
|
|
|
5429
5434
|
function computeNextSnapshotDueAt(wcId, now, delayMs) {
|
|
5430
5435
|
const lastCaptureAt = lastMutationSnapshotAt.get(wcId) || 0;
|
|
5431
5436
|
const lastActivityAt = lastMutationActivityAt.get(wcId) || 0;
|
|
5432
|
-
const earliestAllowedAt = lastCaptureAt +
|
|
5433
|
-
const stableAfterActivityAt = lastActivityAt ? lastActivityAt +
|
|
5437
|
+
const earliestAllowedAt = lastCaptureAt + MUTATION_CAPTURE_INTERVAL_MS;
|
|
5438
|
+
const stableAfterActivityAt = lastActivityAt ? lastActivityAt + MUTATION_SETTLE_AFTER_MS : 0;
|
|
5434
5439
|
return Math.max(now + delayMs, earliestAllowedAt, stableAfterActivityAt);
|
|
5435
5440
|
}
|
|
5436
5441
|
function scheduleTimerAt(wc, sendToRendererViews, dueAt) {
|
|
@@ -6135,7 +6140,7 @@ class AnthropicProvider {
|
|
|
6135
6140
|
let textContent = "";
|
|
6136
6141
|
const toolUseBlocks = [];
|
|
6137
6142
|
let currentToolUse = null;
|
|
6138
|
-
const STREAM_IDLE_TIMEOUT_MS =
|
|
6143
|
+
const STREAM_IDLE_TIMEOUT_MS = AGENT_STREAM_IDLE_TIMEOUT_MS;
|
|
6139
6144
|
let idleTimer = null;
|
|
6140
6145
|
const resetIdleTimer = () => {
|
|
6141
6146
|
if (idleTimer) clearTimeout(idleTimer);
|
|
@@ -6991,9 +6996,16 @@ class OpenAICompatProvider {
|
|
|
6991
6996
|
constructor(config) {
|
|
6992
6997
|
const meta = PROVIDERS[config.id];
|
|
6993
6998
|
const baseURL = config.baseUrl || meta?.defaultBaseUrl || "https://api.openai.com/v1";
|
|
6999
|
+
const isOpenRouter = baseURL.includes("openrouter.ai");
|
|
6994
7000
|
this.client = new OpenAI({
|
|
6995
7001
|
apiKey: config.apiKey || "ollama",
|
|
6996
|
-
baseURL
|
|
7002
|
+
baseURL,
|
|
7003
|
+
...isOpenRouter && {
|
|
7004
|
+
defaultHeaders: {
|
|
7005
|
+
"HTTP-Referer": "https://github.com/unmodeled/vessel-browser",
|
|
7006
|
+
"X-Title": "Vessel"
|
|
7007
|
+
}
|
|
7008
|
+
}
|
|
6997
7009
|
});
|
|
6998
7010
|
this.providerId = config.id;
|
|
6999
7011
|
this.model = config.model || meta?.defaultModel || "gpt-4o";
|
|
@@ -11231,9 +11243,13 @@ function formatDeadLinkMessage(label, result) {
|
|
|
11231
11243
|
return `Skipped stale link "${label}" because ${destination} returned ${status}. Try a different link or URL instead.`;
|
|
11232
11244
|
}
|
|
11233
11245
|
const logger$b = createLogger("Screenshot");
|
|
11246
|
+
const SCREENSHOT_RETRY_COUNT = 3;
|
|
11247
|
+
const SCREENSHOT_RETRY_BASE_DELAY_MS = 120;
|
|
11234
11248
|
async function captureScreenshot(wc) {
|
|
11235
|
-
for (let attempt = 0; attempt <
|
|
11236
|
-
await new Promise(
|
|
11249
|
+
for (let attempt = 0; attempt < SCREENSHOT_RETRY_COUNT; attempt += 1) {
|
|
11250
|
+
await new Promise(
|
|
11251
|
+
(resolve) => setTimeout(resolve, SCREENSHOT_RETRY_BASE_DELAY_MS * (attempt + 1))
|
|
11252
|
+
);
|
|
11237
11253
|
try {
|
|
11238
11254
|
const image = await wc.capturePage();
|
|
11239
11255
|
if (!image.isEmpty()) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quanta-intellect/vessel-browser",
|
|
3
3
|
"mcpName": "io.github.unmodeled-tyler/vessel-browser",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.67",
|
|
5
5
|
"description": "AI-native web browser runtime for autonomous agents with human supervision",
|
|
6
6
|
"main": "./out/main/index.js",
|
|
7
7
|
"bin": {
|