@quanta-intellect/vessel-browser 0.1.149 → 0.1.155
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 +475 -445
- package/out/preload/content-script.js +65 -65
- package/package.json +1 -1
|
@@ -2159,60 +2159,12 @@ function createLogger(scope) {
|
|
|
2159
2159
|
error: (...args) => writeLog("error", scope, args)
|
|
2160
2160
|
};
|
|
2161
2161
|
}
|
|
2162
|
-
const logger = createLogger("ContentScript");
|
|
2163
|
-
const MAX_VISIBLE_TEXT = 500;
|
|
2164
|
-
const MAX_HREF_LENGTH = 500;
|
|
2165
|
-
const MAX_ATTR_TEXT = 200;
|
|
2166
|
-
const MAX_DESCRIPTION_LENGTH = 160;
|
|
2167
|
-
const MAX_LABEL_LENGTH = 100;
|
|
2168
|
-
const MAX_SHORT_TEXT = 60;
|
|
2169
|
-
const MAX_RESULT_COUNT = 10;
|
|
2170
2162
|
const MAX_DIFF_HEADINGS = 8;
|
|
2171
|
-
const
|
|
2172
|
-
const
|
|
2173
|
-
function looksLikeCorrectOption(value) {
|
|
2174
|
-
const text = getTrimmedText(value);
|
|
2175
|
-
if (!text) return void 0;
|
|
2176
|
-
if (/\b(correct|right choice|this is correct|correct answer|pick this|select this|choose this|right answer)\b/i.test(
|
|
2177
|
-
text
|
|
2178
|
-
)) {
|
|
2179
|
-
return true;
|
|
2180
|
-
}
|
|
2181
|
-
if (/\b(wrong|incorrect|not this|don't pick|do not pick|bad option|decoy)\b/i.test(
|
|
2182
|
-
text
|
|
2183
|
-
)) {
|
|
2184
|
-
return false;
|
|
2185
|
-
}
|
|
2186
|
-
return void 0;
|
|
2187
|
-
}
|
|
2188
|
-
let elementIndex = 0;
|
|
2189
|
-
const elementSelectors = {};
|
|
2190
|
-
const indexedElements = /* @__PURE__ */ new WeakMap();
|
|
2191
|
-
const indexedElementRefs = {};
|
|
2192
|
-
let activeOverlays = [];
|
|
2163
|
+
const PAGE_DIFF_ACTIVITY_THROTTLE_MS = 350;
|
|
2164
|
+
const PAGE_DIFF_MUTATION_DEBOUNCE_MS = 1200;
|
|
2193
2165
|
let pageDiffMutationTimer = null;
|
|
2194
2166
|
let pageDiffActivityThrottleTimer = null;
|
|
2195
2167
|
let lastPageDiffSignature = "";
|
|
2196
|
-
const PAGE_DIFF_ACTIVITY_THROTTLE_MS = 350;
|
|
2197
|
-
const PAGE_DIFF_MUTATION_DEBOUNCE_MS = 1200;
|
|
2198
|
-
const CUSTOM_TEXT_FIELD_SELECTOR = '[contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="searchbox"], [role="combobox"]';
|
|
2199
|
-
const ACTION_CONTROL_SELECTOR = [
|
|
2200
|
-
"button",
|
|
2201
|
-
'[role="button"]',
|
|
2202
|
-
'[role="tab"]',
|
|
2203
|
-
'[role="menuitem"]',
|
|
2204
|
-
'[role="option"]',
|
|
2205
|
-
'[role="radio"]',
|
|
2206
|
-
'[role="checkbox"]',
|
|
2207
|
-
'[role="switch"]',
|
|
2208
|
-
'input[type="submit"]',
|
|
2209
|
-
'input[type="button"]',
|
|
2210
|
-
'a[href^="#"][aria-selected]',
|
|
2211
|
-
'a[href^="#"][data-date]',
|
|
2212
|
-
'a[href^="#"][data-day]',
|
|
2213
|
-
'a[href^="#"][role="tab"]',
|
|
2214
|
-
'a[href^="#"][role="button"]'
|
|
2215
|
-
].join(", ");
|
|
2216
2168
|
function normalizeSignatureText(value) {
|
|
2217
2169
|
return (value || "").replace(/\s+/g, " ").trim();
|
|
2218
2170
|
}
|
|
@@ -2277,6 +2229,23 @@ function notifyPageDiffActivity() {
|
|
|
2277
2229
|
pageDiffActivityThrottleTimer = null;
|
|
2278
2230
|
}, PAGE_DIFF_ACTIVITY_THROTTLE_MS);
|
|
2279
2231
|
}
|
|
2232
|
+
function isDocumentViewerPage() {
|
|
2233
|
+
const contentType = document.contentType?.toLowerCase() || "";
|
|
2234
|
+
if (contentType.includes("application/pdf")) return true;
|
|
2235
|
+
try {
|
|
2236
|
+
const url = new URL(window.location.href);
|
|
2237
|
+
const pathname = decodeURIComponent(url.pathname).toLowerCase();
|
|
2238
|
+
if (/\.(pdf|epub|mobi|cbz|cbr)$/.test(pathname)) return true;
|
|
2239
|
+
const host = url.hostname.toLowerCase().replace(/^www\./, "");
|
|
2240
|
+
if (host === "archive.org" && /^\/(details|stream|download)\//.test(pathname)) {
|
|
2241
|
+
return true;
|
|
2242
|
+
}
|
|
2243
|
+
} catch {
|
|
2244
|
+
}
|
|
2245
|
+
return !!document.querySelector(
|
|
2246
|
+
"#BookReader, ia-bookreader, bookreader, embed[type='application/pdf'], object[type='application/pdf']"
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2280
2249
|
function startPageDiffObserver() {
|
|
2281
2250
|
if (typeof MutationObserver === "undefined") return;
|
|
2282
2251
|
if (!document.documentElement) return;
|
|
@@ -2330,23 +2299,54 @@ function startPageDiffObserver() {
|
|
|
2330
2299
|
}
|
|
2331
2300
|
});
|
|
2332
2301
|
}
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2302
|
+
const logger = createLogger("ContentScript");
|
|
2303
|
+
const MAX_VISIBLE_TEXT = 500;
|
|
2304
|
+
const MAX_HREF_LENGTH = 500;
|
|
2305
|
+
const MAX_ATTR_TEXT = 200;
|
|
2306
|
+
const MAX_DESCRIPTION_LENGTH = 160;
|
|
2307
|
+
const MAX_LABEL_LENGTH = 100;
|
|
2308
|
+
const MAX_SHORT_TEXT = 60;
|
|
2309
|
+
const MAX_RESULT_COUNT = 10;
|
|
2310
|
+
const MAX_OPTIONS_PER_SELECT = 8;
|
|
2311
|
+
const MAX_OPTIONS_DISPLAY = 25;
|
|
2312
|
+
function looksLikeCorrectOption(value) {
|
|
2313
|
+
const text = getTrimmedText(value);
|
|
2314
|
+
if (!text) return void 0;
|
|
2315
|
+
if (/\b(correct|right choice|this is correct|correct answer|pick this|select this|choose this|right answer)\b/i.test(
|
|
2316
|
+
text
|
|
2317
|
+
)) {
|
|
2318
|
+
return true;
|
|
2345
2319
|
}
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
)
|
|
2320
|
+
if (/\b(wrong|incorrect|not this|don't pick|do not pick|bad option|decoy)\b/i.test(
|
|
2321
|
+
text
|
|
2322
|
+
)) {
|
|
2323
|
+
return false;
|
|
2324
|
+
}
|
|
2325
|
+
return void 0;
|
|
2349
2326
|
}
|
|
2327
|
+
let elementIndex = 0;
|
|
2328
|
+
const elementSelectors = {};
|
|
2329
|
+
const indexedElements = /* @__PURE__ */ new WeakMap();
|
|
2330
|
+
const indexedElementRefs = {};
|
|
2331
|
+
let activeOverlays = [];
|
|
2332
|
+
const CUSTOM_TEXT_FIELD_SELECTOR = '[contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="searchbox"], [role="combobox"]';
|
|
2333
|
+
const ACTION_CONTROL_SELECTOR = [
|
|
2334
|
+
"button",
|
|
2335
|
+
'[role="button"]',
|
|
2336
|
+
'[role="tab"]',
|
|
2337
|
+
'[role="menuitem"]',
|
|
2338
|
+
'[role="option"]',
|
|
2339
|
+
'[role="radio"]',
|
|
2340
|
+
'[role="checkbox"]',
|
|
2341
|
+
'[role="switch"]',
|
|
2342
|
+
'input[type="submit"]',
|
|
2343
|
+
'input[type="button"]',
|
|
2344
|
+
'a[href^="#"][aria-selected]',
|
|
2345
|
+
'a[href^="#"][data-date]',
|
|
2346
|
+
'a[href^="#"][data-day]',
|
|
2347
|
+
'a[href^="#"][role="tab"]',
|
|
2348
|
+
'a[href^="#"][role="button"]'
|
|
2349
|
+
].join(", ");
|
|
2350
2350
|
const MAX_SHADOW_HOSTS = 150;
|
|
2351
2351
|
const MAX_SHADOW_DEPTH = 5;
|
|
2352
2352
|
const MAX_WALK_ELEMENTS = 1e4;
|
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.155",
|
|
5
5
|
"description": "AI-native web browser runtime for autonomous agents with human supervision",
|
|
6
6
|
"main": "./out/main/index.js",
|
|
7
7
|
"bin": {
|