Jarvis-Brain 0.1.11.5__py3-none-any.whl → 0.1.11.6__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.11.5.dist-info → jarvis_brain-0.1.11.6.dist-info}/METADATA +1 -1
- {jarvis_brain-0.1.11.5.dist-info → jarvis_brain-0.1.11.6.dist-info}/RECORD +6 -6
- mcp_tools/dp_tools.py +5 -3
- tools/browser_proxy.py +6 -17
- {jarvis_brain-0.1.11.5.dist-info → jarvis_brain-0.1.11.6.dist-info}/WHEEL +0 -0
- {jarvis_brain-0.1.11.5.dist-info → jarvis_brain-0.1.11.6.dist-info}/entry_points.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
mcp_tools/__init__.py,sha256=_ZzedxbxmVkdRH00ONOjQR31pZW-B8WPn5P2qE6T-Iw,3012
|
|
2
|
-
mcp_tools/dp_tools.py,sha256=
|
|
2
|
+
mcp_tools/dp_tools.py,sha256=p38nI0t5-T_jMjtHE94jL3W1IACp9-WQEmoU32XB99k,18513
|
|
3
3
|
mcp_tools/main.py,sha256=Fgq2PPuc7XCCwXCSVsyoADB0z1vI_gZ07lnLChcrjjg,1167
|
|
4
4
|
tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
tools/browser_manager.py,sha256=zeYcWuzxoohMdnYUoZbRH7axFC_VtV8MsncfN8y0yw0,2023
|
|
6
|
-
tools/browser_proxy.py,sha256=
|
|
6
|
+
tools/browser_proxy.py,sha256=VAhuVrBIoXmKyXvCmJh4eRYCWpLIhbTYmFHK8l8eoTA,6590
|
|
7
7
|
tools/tools.py,sha256=KvBzefiQbgR-Qa1FsTOGMbVuwTzrK3iXXJgZuFU3UVg,10926
|
|
8
|
-
jarvis_brain-0.1.11.
|
|
9
|
-
jarvis_brain-0.1.11.
|
|
10
|
-
jarvis_brain-0.1.11.
|
|
11
|
-
jarvis_brain-0.1.11.
|
|
8
|
+
jarvis_brain-0.1.11.6.dist-info/METADATA,sha256=sQwWdI8iH6YC5YVcauXwvj2I7kq3B1gLJTDDfElHjNI,264
|
|
9
|
+
jarvis_brain-0.1.11.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
10
|
+
jarvis_brain-0.1.11.6.dist-info/entry_points.txt,sha256=YFQT4xpkUqt5dM5wlKPQQOqcjMuFrT9iuRAzIpAyH7U,51
|
|
11
|
+
jarvis_brain-0.1.11.6.dist-info/RECORD,,
|
mcp_tools/dp_tools.py
CHANGED
|
@@ -7,6 +7,7 @@ import os
|
|
|
7
7
|
import time
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
+
import DrissionPage
|
|
10
11
|
from fastmcp import FastMCP
|
|
11
12
|
|
|
12
13
|
from tools.browser_manager import BrowserManager
|
|
@@ -162,13 +163,13 @@ def register_check_selector(mcp: FastMCP, browser_manager):
|
|
|
162
163
|
attr_output = json.dumps(ele_attr_list, ensure_ascii=False)
|
|
163
164
|
# 对attr_output逐个截断,截断的长度为:一轮最大token除以元素个数+3个点+两个引号和逗号
|
|
164
165
|
return dp_mcp_message_pack(
|
|
165
|
-
f"已完成tab页:【{tab_id}】对:【{css_selector}
|
|
166
|
+
f"已完成tab页:【{tab_id}】对:【{css_selector}】的检查,当前选中了 {len(target_eles)} 个元素",
|
|
166
167
|
tab_id=tab_id,
|
|
167
168
|
selector=css_selector,
|
|
168
169
|
selector_ele_exist=exist_flag,
|
|
169
170
|
page_size=page_size,
|
|
170
171
|
offset=offset,
|
|
171
|
-
attr_output=attr_output
|
|
172
|
+
attr_output=attr_output,
|
|
172
173
|
)
|
|
173
174
|
|
|
174
175
|
|
|
@@ -313,10 +314,11 @@ def register_get_screenshot(mcp: FastMCP, browser_manager):
|
|
|
313
314
|
async def get_tab_screenshot(browser_port: int, tab_id: str) -> dict[str, Any]:
|
|
314
315
|
_browser = browser_manager.get_browser(browser_port)
|
|
315
316
|
target_tab = _browser.get_tab(tab_id)
|
|
317
|
+
target_tab.wait.doc_loaded()
|
|
316
318
|
if not os.path.exists(html_source_code_local_save_path):
|
|
317
319
|
os.makedirs(html_source_code_local_save_path)
|
|
318
320
|
timestamp = int(time.time() * 1000)
|
|
319
|
-
time.sleep(
|
|
321
|
+
# time.sleep(1)
|
|
320
322
|
origin_png = target_tab.get_screenshot(as_bytes="png")
|
|
321
323
|
compress_png = compress_image_bytes(origin_png)
|
|
322
324
|
image_path = os.path.join(html_source_code_local_save_path, f"{browser_port}_{tab_id}_{timestamp}.png")
|
tools/browser_proxy.py
CHANGED
|
@@ -140,7 +140,10 @@ def check_data_packet(packet: DataPacket, client: DPProxyClient):
|
|
|
140
140
|
data = packet.request.postData
|
|
141
141
|
domain = urlparse(url).netloc
|
|
142
142
|
body = packet.response.body
|
|
143
|
-
|
|
143
|
+
if isinstance(body, dict):
|
|
144
|
+
body_str = json.dumps(body, ensure_ascii=False, separators=(',', ':'))
|
|
145
|
+
else:
|
|
146
|
+
body_str = str(body)
|
|
144
147
|
body_str_list = [body_str[i:i + one_turn_max_token] for i in range(0, len(body_str), one_turn_max_token)]
|
|
145
148
|
body_completed = True
|
|
146
149
|
packet_filter = client.packet_filter
|
|
@@ -155,9 +158,9 @@ def check_data_packet(packet: DataPacket, client: DPProxyClient):
|
|
|
155
158
|
continue
|
|
156
159
|
if (index + 1) != len(body_str_list):
|
|
157
160
|
body_completed = False
|
|
158
|
-
|
|
161
|
+
try:
|
|
159
162
|
response_headers = packet.response.headers
|
|
160
|
-
|
|
163
|
+
except TypeError:
|
|
161
164
|
response_headers = {}
|
|
162
165
|
temp_dict = {
|
|
163
166
|
"url": url,
|
|
@@ -172,17 +175,3 @@ def check_data_packet(packet: DataPacket, client: DPProxyClient):
|
|
|
172
175
|
|
|
173
176
|
|
|
174
177
|
client_manager = DPProxyClientManager()
|
|
175
|
-
|
|
176
|
-
# if __name__ == '__main__':
|
|
177
|
-
# co = ChromiumOptions().set_user_agent(
|
|
178
|
-
# "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36")
|
|
179
|
-
# tab = ChromiumPage(co).latest_tab
|
|
180
|
-
# client = DPProxyClient(tab, self_kill=False)
|
|
181
|
-
# # client = CaptchaClient(tab, self_kill=True)
|
|
182
|
-
# tab = client.get_driver(True)
|
|
183
|
-
# url = "https://api.toutiaoapi.com/feoffline/hotspot_and_local/html/hot_list/index.html?client_extra_params=%7B%22custom_log_pb%22%3A%22%7B%5C%22style_id%5C%22%3A%5C%2240030%5C%22%2C%5C%22entrance_hotspot%5C%22%3A%5C%22search%5C%22%2C%5C%22location%5C%22%3A%5C%22hot_board%5C%22%2C%5C%22category_name%5C%22%3A%5C%22hotboard_light%5C%22%7D%22%7D&count=50&log_pb=%7B%22style_id%22%3A%2240030%22%2C%22entrance_hotspot%22%3A%22search%22%2C%22location%22%3A%22hot_board%22%2C%22category_name%22%3A%22hotboard_light%22%7D&only_hot_list=1&tab_name=stream&enter_keyword=%23%E7%BE%8E%E5%9B%BD%E9%80%80%E5%87%BA66%E4%B8%AA%E5%9B%BD%E9%99%85%E7%BB%84%E7%BB%87%23"
|
|
184
|
-
# tab.get(url)
|
|
185
|
-
# for _ in range(5056):
|
|
186
|
-
# new_packet = client.pop_first_packet()
|
|
187
|
-
# print(new_packet, "23")
|
|
188
|
-
# time.sleep(1)
|
|
File without changes
|
|
File without changes
|