camel-ai 0.2.72a10__py3-none-any.whl → 0.2.73a1__py3-none-any.whl
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.
Potentially problematic release.
This version of camel-ai might be problematic. Click here for more details.
- camel/__init__.py +1 -1
- camel/agents/chat_agent.py +113 -338
- camel/memories/agent_memories.py +18 -17
- camel/societies/workforce/prompts.py +10 -4
- camel/societies/workforce/single_agent_worker.py +7 -5
- camel/toolkits/__init__.py +6 -1
- camel/toolkits/base.py +57 -1
- camel/toolkits/hybrid_browser_toolkit/config_loader.py +136 -413
- camel/toolkits/hybrid_browser_toolkit/hybrid_browser_toolkit.py +796 -1631
- camel/toolkits/hybrid_browser_toolkit/ts/package-lock.json +4356 -0
- camel/toolkits/hybrid_browser_toolkit/ts/package.json +33 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/browser-scripts.js +125 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/browser-session.ts +945 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/config-loader.ts +226 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/hybrid-browser-toolkit.ts +522 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/index.ts +7 -0
- camel/toolkits/hybrid_browser_toolkit/ts/src/types.ts +110 -0
- camel/toolkits/hybrid_browser_toolkit/ts/tsconfig.json +26 -0
- camel/toolkits/hybrid_browser_toolkit/ts/websocket-server.js +210 -0
- camel/toolkits/hybrid_browser_toolkit/ws_wrapper.py +533 -0
- camel/toolkits/message_integration.py +592 -0
- camel/toolkits/notion_mcp_toolkit.py +234 -0
- camel/toolkits/screenshot_toolkit.py +116 -31
- camel/toolkits/search_toolkit.py +20 -2
- camel/toolkits/terminal_toolkit.py +16 -2
- camel/toolkits/video_analysis_toolkit.py +13 -13
- camel/toolkits/video_download_toolkit.py +11 -11
- {camel_ai-0.2.72a10.dist-info → camel_ai-0.2.73a1.dist-info}/METADATA +12 -6
- {camel_ai-0.2.72a10.dist-info → camel_ai-0.2.73a1.dist-info}/RECORD +31 -24
- camel/toolkits/hybrid_browser_toolkit/actions.py +0 -417
- camel/toolkits/hybrid_browser_toolkit/agent.py +0 -311
- camel/toolkits/hybrid_browser_toolkit/browser_session.py +0 -740
- camel/toolkits/hybrid_browser_toolkit/snapshot.py +0 -227
- camel/toolkits/hybrid_browser_toolkit/stealth_script.js +0 -0
- camel/toolkits/hybrid_browser_toolkit/unified_analyzer.js +0 -1002
- {camel_ai-0.2.72a10.dist-info → camel_ai-0.2.73a1.dist-info}/WHEEL +0 -0
- {camel_ai-0.2.72a10.dist-info → camel_ai-0.2.73a1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hybrid-browser-toolkit-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript implementation of hybrid browser toolkit with Playwright _snapshotForAI integration",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npx tsc",
|
|
8
|
+
"dev": "npx tsc --watch",
|
|
9
|
+
"test": "jest",
|
|
10
|
+
"start": "node dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"playwright",
|
|
14
|
+
"browser",
|
|
15
|
+
"automation",
|
|
16
|
+
"ai",
|
|
17
|
+
"snapshot"
|
|
18
|
+
],
|
|
19
|
+
"author": "CAMEL-AI",
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"playwright": "^1.40.0",
|
|
23
|
+
"sharp": "^0.32.0",
|
|
24
|
+
"ws": "^8.14.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/jest": "^29.0.0",
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"@types/ws": "^8.5.0",
|
|
30
|
+
"jest": "^29.0.0",
|
|
31
|
+
"typescript": "^5.8.3"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-side JavaScript utilities for the hybrid browser toolkit
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get current scroll position and browser metrics
|
|
7
|
+
*/
|
|
8
|
+
function getCurrentScrollPosition() {
|
|
9
|
+
return {
|
|
10
|
+
x: window.pageXOffset || document.documentElement.scrollLeft || 0,
|
|
11
|
+
y: window.pageYOffset || document.documentElement.scrollTop || 0,
|
|
12
|
+
devicePixelRatio: window.devicePixelRatio || 1,
|
|
13
|
+
zoomLevel: window.outerWidth / window.innerWidth || 1
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Set target="_blank" attribute for anchor elements
|
|
19
|
+
*/
|
|
20
|
+
function setTargetBlank(element) {
|
|
21
|
+
if (element.tagName.toLowerCase() === 'a') {
|
|
22
|
+
element.setAttribute('target', '_blank');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Scroll the page by a specified amount
|
|
28
|
+
*/
|
|
29
|
+
function scrollPage(amount) {
|
|
30
|
+
window.scrollBy(0, amount);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Check if browser has specific capability
|
|
35
|
+
*/
|
|
36
|
+
function checkBrowserCapability(capability) {
|
|
37
|
+
switch (capability) {
|
|
38
|
+
case 'devicePixelRatio':
|
|
39
|
+
return window.devicePixelRatio || 1;
|
|
40
|
+
case 'viewport':
|
|
41
|
+
return {
|
|
42
|
+
width: window.innerWidth,
|
|
43
|
+
height: window.innerHeight
|
|
44
|
+
};
|
|
45
|
+
case 'scroll':
|
|
46
|
+
return {
|
|
47
|
+
x: window.pageXOffset || document.documentElement.scrollLeft || 0,
|
|
48
|
+
y: window.pageYOffset || document.documentElement.scrollTop || 0,
|
|
49
|
+
maxX: Math.max(0, document.documentElement.scrollWidth - window.innerWidth),
|
|
50
|
+
maxY: Math.max(0, document.documentElement.scrollHeight - window.innerHeight)
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get document dimensions
|
|
59
|
+
*/
|
|
60
|
+
function getDocumentDimensions() {
|
|
61
|
+
return {
|
|
62
|
+
scrollWidth: document.documentElement.scrollWidth,
|
|
63
|
+
scrollHeight: document.documentElement.scrollHeight,
|
|
64
|
+
clientWidth: document.documentElement.clientWidth,
|
|
65
|
+
clientHeight: document.documentElement.clientHeight,
|
|
66
|
+
offsetWidth: document.documentElement.offsetWidth,
|
|
67
|
+
offsetHeight: document.documentElement.offsetHeight
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Wait for element to be visible or interactable
|
|
73
|
+
*/
|
|
74
|
+
function waitForElement(selector, timeout = 5000) {
|
|
75
|
+
return new Promise((resolve, reject) => {
|
|
76
|
+
const startTime = Date.now();
|
|
77
|
+
|
|
78
|
+
function checkElement() {
|
|
79
|
+
const element = document.querySelector(selector);
|
|
80
|
+
if (element && element.offsetParent !== null) {
|
|
81
|
+
resolve(element);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (Date.now() - startTime > timeout) {
|
|
86
|
+
reject(new Error(`Element ${selector} not found within timeout`));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setTimeout(checkElement, 100);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
checkElement();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get element coordinates relative to viewport
|
|
99
|
+
*/
|
|
100
|
+
function getElementCoordinates(element) {
|
|
101
|
+
const rect = element.getBoundingClientRect();
|
|
102
|
+
const scroll = getCurrentScrollPosition();
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
x: rect.left + scroll.x,
|
|
106
|
+
y: rect.top + scroll.y,
|
|
107
|
+
width: rect.width,
|
|
108
|
+
height: rect.height,
|
|
109
|
+
viewportX: rect.left,
|
|
110
|
+
viewportY: rect.top
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Export for use in evaluate() calls
|
|
115
|
+
if (typeof module !== 'undefined' && module.exports) {
|
|
116
|
+
module.exports = {
|
|
117
|
+
getCurrentScrollPosition,
|
|
118
|
+
setTargetBlank,
|
|
119
|
+
scrollPage,
|
|
120
|
+
checkBrowserCapability,
|
|
121
|
+
getDocumentDimensions,
|
|
122
|
+
waitForElement,
|
|
123
|
+
getElementCoordinates
|
|
124
|
+
};
|
|
125
|
+
}
|