granclaw 0.0.1-beta.94 → 0.0.1-beta.96
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/backend/agent/runner-pi.js +21 -0
- package/dist/frontend/assets/index-2w83F8pA.js +158 -0
- package/dist/frontend/assets/index-DExQ2dsz.css +1 -0
- package/dist/frontend/index.html +2 -2
- package/package.json +1 -1
- package/dist/frontend/assets/index-Hymtb-e4.css +0 -1
- package/dist/frontend/assets/index-ykKjU_0T.js +0 -158
|
@@ -9,6 +9,7 @@ exports.bootstrapWorkspace = bootstrapWorkspace;
|
|
|
9
9
|
exports.translateSessionEvent = translateSessionEvent;
|
|
10
10
|
exports.stopAgent = stopAgent;
|
|
11
11
|
exports.compactAgentSession = compactAgentSession;
|
|
12
|
+
exports.detectBrowserBlock = detectBrowserBlock;
|
|
12
13
|
exports.classifyBrowserError = classifyBrowserError;
|
|
13
14
|
exports.runAgent = runAgent;
|
|
14
15
|
const path_1 = __importDefault(require("path"));
|
|
@@ -268,6 +269,20 @@ function extractAgentName(workspaceDir) {
|
|
|
268
269
|
}
|
|
269
270
|
return null;
|
|
270
271
|
}
|
|
272
|
+
const BROWSER_BLOCK_PATTERNS = [
|
|
273
|
+
/blocked by network security/i,
|
|
274
|
+
/attention required!? \| cloudflare/i,
|
|
275
|
+
/please (?:verify|confirm) you are (?:a |)human/i,
|
|
276
|
+
/just a moment\.\.\./i,
|
|
277
|
+
/checking your browser before accessing/i,
|
|
278
|
+
/access denied\s*-?\s*you don't have permission/i,
|
|
279
|
+
];
|
|
280
|
+
function detectBrowserBlock(output) {
|
|
281
|
+
if (!output)
|
|
282
|
+
return false;
|
|
283
|
+
const head = output.slice(0, 8_000);
|
|
284
|
+
return BROWSER_BLOCK_PATTERNS.some((r) => r.test(head));
|
|
285
|
+
}
|
|
271
286
|
function classifyBrowserError(err, signal) {
|
|
272
287
|
const e = err;
|
|
273
288
|
if (signal?.aborted)
|
|
@@ -784,6 +799,12 @@ async function runAgent(agent, message, onChunk, options) {
|
|
|
784
799
|
});
|
|
785
800
|
(0, session_manager_js_1.appendCommand)(browserState.handle, `${command} ${args.join(' ')}`.trim());
|
|
786
801
|
const out = stdout.trim() || stderr.trim() || 'ok';
|
|
802
|
+
const READS_PAGE = new Set(['snapshot', 'html', 'text', 'content']);
|
|
803
|
+
if (READS_PAGE.has(command) && detectBrowserBlock(out)) {
|
|
804
|
+
return { content: [{ type: 'text', text: `browser ${command} reached the page but the site returned an anti-bot block (CATEGORY=BROWSER_BLOCKED). ` +
|
|
805
|
+
`The page shown is not real content. Try fetch_website with unblocker=true, request human takeover, or abandon this source.\n\n` +
|
|
806
|
+
`--- block page excerpt ---\n${out.slice(0, 400)}` }] };
|
|
807
|
+
}
|
|
787
808
|
return { content: [{ type: 'text', text: out }] };
|
|
788
809
|
}
|
|
789
810
|
catch (err) {
|