Jarvis-Brain 0.1.4.1__py3-none-any.whl → 0.1.4.2__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.
- {jarvis_brain-0.1.4.1.dist-info → jarvis_brain-0.1.4.2.dist-info}/METADATA +2 -4
- jarvis_brain-0.1.4.2.dist-info/RECORD +11 -0
- mcp_tools/dp_tools.py +7 -18
- tools/task_manager.py +42 -0
- tools/tools.py +0 -15
- jarvis_brain-0.1.4.1.dist-info/RECORD +0 -10
- {jarvis_brain-0.1.4.1.dist-info → jarvis_brain-0.1.4.2.dist-info}/WHEEL +0 -0
- {jarvis_brain-0.1.4.1.dist-info → jarvis_brain-0.1.4.2.dist-info}/entry_points.txt +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Jarvis_Brain
|
|
3
|
-
Version: 0.1.4.
|
|
4
|
-
Summary: Jarvis brain
|
|
3
|
+
Version: 0.1.4.2
|
|
4
|
+
Summary: Jarvis brain mcp
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: beautifulsoup4
|
|
7
7
|
Requires-Dist: curl-cffi
|
|
8
8
|
Requires-Dist: drissionpage
|
|
9
9
|
Requires-Dist: fastmcp
|
|
10
10
|
Requires-Dist: htmlmin
|
|
11
|
-
Requires-Dist: jieba
|
|
12
|
-
Requires-Dist: simhash
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
mcp_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
mcp_tools/dp_tools.py,sha256=W9DLblNn1hQUmjvsvVOpb_hXVWI1BKD6VvI_VeI_QBI,8024
|
|
3
|
+
mcp_tools/main.py,sha256=WO9kNpIORRrIOAWW8jiAd3gNW6rFMExln8y4CquKrM8,837
|
|
4
|
+
tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
tools/browser_manager.py,sha256=AM9hIQKtgMVxIZsEPxfHj9q41ZtzHrOS69wtgGBE3-Q,1458
|
|
6
|
+
tools/task_manager.py,sha256=jeJ8iG-EC2mbUgNlF-P7zf0C5gWjjPPhZS2R-vFQXss,1565
|
|
7
|
+
tools/tools.py,sha256=xw-aqUGEjeg32SfQJmlx0sXvxlvVSQb9BF5PrIVJLk0,4473
|
|
8
|
+
jarvis_brain-0.1.4.2.dist-info/METADATA,sha256=EBJkCHq9A7vyfgqgGJNJKo_VWamuwyE1tL4txPrvRdo,237
|
|
9
|
+
jarvis_brain-0.1.4.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
10
|
+
jarvis_brain-0.1.4.2.dist-info/entry_points.txt,sha256=YFQT4xpkUqt5dM5wlKPQQOqcjMuFrT9iuRAzIpAyH7U,51
|
|
11
|
+
jarvis_brain-0.1.4.2.dist-info/RECORD,,
|
mcp_tools/dp_tools.py
CHANGED
|
@@ -149,21 +149,10 @@ def register_assert_waf(mcp: FastMCP, browser_manager):
|
|
|
149
149
|
head_headless_rate_difference=h_hless_rate_diff
|
|
150
150
|
)
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
tab.ele
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
def register_test(mcp: FastMCP, cwd: str):
|
|
163
|
-
@mcp.tool(name="test", description="用户说要进行测试时调用这个函数")
|
|
164
|
-
async def test() -> dict[str, Any]:
|
|
165
|
-
test_project = "获取根目录"
|
|
166
|
-
return dp_mcp_message_pack(
|
|
167
|
-
f"当前测试项目是:{test_project}",
|
|
168
|
-
result=cwd
|
|
169
|
-
)
|
|
152
|
+
# def register_highlight_element_captcha(mcp: FastMCP, browser_manager):
|
|
153
|
+
# @mcp.tool(name="highlight_element_captcha",
|
|
154
|
+
# description="将传入的Selector在页面上高亮,并截屏")
|
|
155
|
+
# async def highlight_element_captcha(browser_port: int, tab_id: str, selector: str) -> dict[str, Any]:
|
|
156
|
+
# _browser = browser_manager.get_browser(browser_port)
|
|
157
|
+
# tab = _browser.get_tab(tab_id)
|
|
158
|
+
# tab.ele
|
tools/task_manager.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
|
|
3
|
+
from typing import Callable, List
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SimpleTaskManager:
|
|
7
|
+
def __init__(self, max_concurrent: int = 10):
|
|
8
|
+
self.semaphore = asyncio.Semaphore(max_concurrent)
|
|
9
|
+
self.results = []
|
|
10
|
+
|
|
11
|
+
async def execute_task(self, task_id: int, coro_func: Callable, *args, **kwargs):
|
|
12
|
+
"""执行单个任务"""
|
|
13
|
+
async with self.semaphore:
|
|
14
|
+
try:
|
|
15
|
+
result = await coro_func(*args, **kwargs)
|
|
16
|
+
self.results.append((task_id, result))
|
|
17
|
+
print(f"✅ 任务 {task_id} 完成")
|
|
18
|
+
distribution_after_hook(*result)
|
|
19
|
+
return result
|
|
20
|
+
except Exception as e:
|
|
21
|
+
error_msg = f"任务 {task_id} 失败: {e}"
|
|
22
|
+
self.results.append((task_id, error_msg))
|
|
23
|
+
print(f"❌ {error_msg}")
|
|
24
|
+
return None
|
|
25
|
+
|
|
26
|
+
async def process_all(self, tasks: List[tuple]):
|
|
27
|
+
"""
|
|
28
|
+
处理所有任务
|
|
29
|
+
tasks: 列表,每个元素是 (coro_func, args, kwargs) 元组
|
|
30
|
+
"""
|
|
31
|
+
print(f"🚀 开始处理 {len(tasks)} 个任务,最大并发数: {self.semaphore._value}")
|
|
32
|
+
|
|
33
|
+
# 创建所有任务
|
|
34
|
+
task_coroutines = []
|
|
35
|
+
for i, (coro_func, args, kwargs) in enumerate(tasks):
|
|
36
|
+
task_coroutines.append(self.execute_task(i, coro_func, *args, **kwargs))
|
|
37
|
+
|
|
38
|
+
# 并发执行所有任务
|
|
39
|
+
await asyncio.gather(*task_coroutines)
|
|
40
|
+
|
|
41
|
+
print(f"🎉 所有任务完成!成功: {len([r for r in self.results if '失败' not in str(r[1])])}")
|
|
42
|
+
return self.results
|
tools/tools.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import time
|
|
2
|
-
import json
|
|
3
2
|
|
|
4
3
|
import htmlmin
|
|
5
4
|
from curl_cffi import requests
|
|
@@ -8,26 +7,12 @@ from bs4 import BeautifulSoup
|
|
|
8
7
|
from DrissionPage import ChromiumPage, ChromiumOptions
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
# 传入requests的set-cookie的str,返回一个cookie dict
|
|
12
|
-
def cookie_str2dict(cookie_str: str):
|
|
13
|
-
if cookie_str == "":
|
|
14
|
-
return {}
|
|
15
|
-
cookie_dict = {}
|
|
16
|
-
cookie_list = [cookie.split(";")[0] for cookie in cookie_str.split("HttpOnly,")]
|
|
17
|
-
for cookie in cookie_list:
|
|
18
|
-
key, value = cookie.split("=")
|
|
19
|
-
cookie_dict[key] = value
|
|
20
|
-
return cookie_dict
|
|
21
|
-
|
|
22
|
-
|
|
23
10
|
# 使用requests获取html,用于测试是否使用了瑞数和jsl
|
|
24
11
|
def requests_html(url):
|
|
25
12
|
headers = {
|
|
26
13
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
|
|
27
14
|
}
|
|
28
15
|
response = requests.get(url, headers=headers, verify=False)
|
|
29
|
-
# print("response headers=> ", type(response.headers.get("Set-Cookie")),
|
|
30
|
-
# cookie_str2dict(response.headers.get("Set-Cookie", "")))
|
|
31
16
|
response.encoding = "utf-8"
|
|
32
17
|
return response.text, response.status_code
|
|
33
18
|
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
mcp_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
mcp_tools/dp_tools.py,sha256=PwLd1zTFIQ673-cZjdON4TfU854_h5BgLPOVRbt_kVw,8349
|
|
3
|
-
mcp_tools/main.py,sha256=WO9kNpIORRrIOAWW8jiAd3gNW6rFMExln8y4CquKrM8,837
|
|
4
|
-
tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
tools/browser_manager.py,sha256=AM9hIQKtgMVxIZsEPxfHj9q41ZtzHrOS69wtgGBE3-Q,1458
|
|
6
|
-
tools/tools.py,sha256=3vTMCT_h0eDPtOMHc2KnhNVpQBUs6jgIChutBZZFMK4,5008
|
|
7
|
-
jarvis_brain-0.1.4.1.dist-info/METADATA,sha256=jJjlYvPAjlzahJ9OtI6EuL1JOoAk5_OUku2XtqXeztE,277
|
|
8
|
-
jarvis_brain-0.1.4.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
9
|
-
jarvis_brain-0.1.4.1.dist-info/entry_points.txt,sha256=YFQT4xpkUqt5dM5wlKPQQOqcjMuFrT9iuRAzIpAyH7U,51
|
|
10
|
-
jarvis_brain-0.1.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|