bohr-agent-sdk 0.1.101__tar.gz → 0.1.102__tar.gz
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.
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/PKG-INFO +6 -2
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/README.md +1 -1
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/pyproject.toml +38 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/setup.py +8 -1
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/PKG-INFO +6 -2
- bohr_agent_sdk-0.1.102/src/bohr_agent_sdk.egg-info/SOURCES.txt +85 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/requires.txt +4 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/cli/cli.py +126 -25
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/__init__.py +1 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/calculation/simple.py.template +15 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/device/tescan_device.py.template +158 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/main.py.template +67 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/__init__.py +1 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/__init__.py +1 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/config.py +32 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/constants.py +61 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/debug.py +257 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/files.py +469 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/files_upload.py +115 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/files_user.py +50 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/messages.py +161 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/projects.py +146 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/sessions.py +93 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/utils.py +161 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/api/websocket.py +184 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/config/__init__.py +1 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/config/agent_config.py +257 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/index.html +13 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/package.json +46 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/tsconfig.json +26 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/tsconfig.node.json +10 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DdAmKhul.js +105 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DfN2raU9.css +1 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/ui-static/index.html +14 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/frontend/vite.config.ts +37 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/scripts/build_ui.py +56 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/__init__.py +0 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/app.py +98 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/connection.py +210 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/file_watcher.py +85 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/middleware.py +43 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/models.py +53 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/session_manager.py +1158 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/user_files.py +85 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/server/utils.py +50 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/test_download.py +98 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/ui_utils.py +260 -0
- bohr_agent_sdk-0.1.102/src/dp/agent/cli/templates/ui/websocket-server.py +87 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/http_storage.py +1 -1
- bohr_agent_sdk-0.1.101/src/bohr_agent_sdk.egg-info/SOURCES.txt +0 -45
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/setup.cfg +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/dependency_links.txt +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/entry_points.txt +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/bohr_agent_sdk.egg-info/top_level.txt +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/client/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/client/calculation_mcp_tool.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/storage_artifact_service.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/adk/utils.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/camel/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/camel/client/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/adapter/camel/client/calculation_mcp_client.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/cli/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/main.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/mcp.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/cloud/mqtt.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/device/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/device/device.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/device/types.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/device/mqtt_device_twin.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/calculation_mcp_server.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/base_executor.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/dispatcher_executor.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/executor/local_executor.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/preprocessor.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/__init__.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/base_storage.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/bohrium_storage.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/local_storage.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/storage/oss_storage.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/src/dp/agent/server/utils.py +0 -0
- {bohr_agent_sdk-0.1.101 → bohr_agent_sdk-0.1.102}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bohr-agent-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.102
|
|
4
4
|
Summary: SDK for scientific agents
|
|
5
5
|
Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
|
|
6
6
|
Author: DP Technology
|
|
@@ -30,6 +30,9 @@ Requires-Dist: paho-mqtt>=2.1.0
|
|
|
30
30
|
Requires-Dist: redis>=6.2.0
|
|
31
31
|
Requires-Dist: twine>=6.1.0
|
|
32
32
|
Requires-Dist: build>=1.2.2.post1
|
|
33
|
+
Requires-Dist: watchdog>=6.0.0
|
|
34
|
+
Requires-Dist: fastapi>=0.116.0
|
|
35
|
+
Requires-Dist: bohrium-open-sdk==0.1.5
|
|
33
36
|
Provides-Extra: device
|
|
34
37
|
Requires-Dist: pywinauto-recorder>=0.1.0; extra == "device"
|
|
35
38
|
Provides-Extra: cloud
|
|
@@ -44,6 +47,7 @@ Requires-Dist: black>=23.11.0; extra == "dev"
|
|
|
44
47
|
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
45
48
|
Requires-Dist: mypy>=1.7.0; extra == "dev"
|
|
46
49
|
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: google-adk; extra == "dev"
|
|
47
51
|
Provides-Extra: docs
|
|
48
52
|
Requires-Dist: sphinx>=7.2.0; extra == "docs"
|
|
49
53
|
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
|
|
@@ -92,7 +96,7 @@ dp-agent run tool cloud
|
|
|
92
96
|
dp-agent run tool calculation
|
|
93
97
|
|
|
94
98
|
# 运行代理
|
|
95
|
-
dp-agent run agent
|
|
99
|
+
dp-agent run agent --config config.json
|
|
96
100
|
|
|
97
101
|
# 调试模式
|
|
98
102
|
dp-agent run debug
|
|
@@ -33,6 +33,9 @@ dependencies = [
|
|
|
33
33
|
"redis>=6.2.0",
|
|
34
34
|
"twine>=6.1.0",
|
|
35
35
|
"build>=1.2.2.post1",
|
|
36
|
+
"watchdog>=6.0.0",
|
|
37
|
+
"fastapi>=0.116.0",
|
|
38
|
+
"bohrium-open-sdk==0.1.5"
|
|
36
39
|
]
|
|
37
40
|
|
|
38
41
|
# 可选依赖
|
|
@@ -58,6 +61,7 @@ dev = [
|
|
|
58
61
|
"isort>=5.12.0",
|
|
59
62
|
"mypy>=1.7.0",
|
|
60
63
|
"pylint>=3.0.0",
|
|
64
|
+
"google-adk"
|
|
61
65
|
]
|
|
62
66
|
|
|
63
67
|
# 文档工具依赖
|
|
@@ -86,6 +90,40 @@ where = ["src"]
|
|
|
86
90
|
|
|
87
91
|
[tool.setuptools]
|
|
88
92
|
package-dir = {"" = "src"}
|
|
93
|
+
include-package-data = false # 关闭自动包含,使用显式配置
|
|
94
|
+
|
|
95
|
+
[tool.setuptools.package-data]
|
|
96
|
+
"dp.agent.cli.templates" = [
|
|
97
|
+
"**/*.template",
|
|
98
|
+
"**/*.json",
|
|
99
|
+
"**/*.md",
|
|
100
|
+
"**/*.txt",
|
|
101
|
+
"**/*.py"
|
|
102
|
+
]
|
|
103
|
+
"dp.agent.cli.templates.ui" = [
|
|
104
|
+
"**/*.py",
|
|
105
|
+
"config/*.json",
|
|
106
|
+
"*.txt"
|
|
107
|
+
]
|
|
108
|
+
# 包含前端静态文件和必要的配置文件(用于开发模式)
|
|
109
|
+
"dp.agent.cli.templates.ui.frontend" = [
|
|
110
|
+
"ui-static/**/*",
|
|
111
|
+
"package.json", # 开发模式需要
|
|
112
|
+
"vite.config.ts", # Vite 配置
|
|
113
|
+
"tsconfig.json", # TypeScript 配置
|
|
114
|
+
"index.html" # 开发模式入口
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
# 使用 exclude-package-data 排除不需要的文件
|
|
118
|
+
[tool.setuptools.exclude-package-data]
|
|
119
|
+
"dp.agent.cli.templates.ui.frontend" = [
|
|
120
|
+
"*.sh",
|
|
121
|
+
".eslintrc.cjs",
|
|
122
|
+
"tsconfig.node.json", # 排除这个,但保留 tsconfig.json
|
|
123
|
+
"src/**/*", # 排除源码
|
|
124
|
+
"public/**/*", # 排除 public 目录
|
|
125
|
+
"node_modules/**/*" # 排除 node_modules
|
|
126
|
+
]
|
|
89
127
|
|
|
90
128
|
[build-system]
|
|
91
129
|
requires = [
|
|
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="bohr-agent-sdk",
|
|
12
|
-
version="0.1.
|
|
12
|
+
version="0.1.102",
|
|
13
13
|
description="SDK for science agent and mcp tools",
|
|
14
14
|
long_description=long_description,
|
|
15
15
|
long_description_content_type="text/markdown",
|
|
@@ -28,6 +28,13 @@ setup(
|
|
|
28
28
|
"python-dotenv>=1.0.0", # 环境变量管理
|
|
29
29
|
"typing-extensions>=4.8.0", # 额外的类型提示功能
|
|
30
30
|
"aiohttp>=3.9.1", # 异步HTTP客户端
|
|
31
|
+
"fastapi>=0.116",
|
|
32
|
+
"uvicorn>=0.24.0", # ASGI服务器
|
|
33
|
+
"websockets>=12.0", # WebSocket支持
|
|
34
|
+
"watchdog>=3.0.0", # 文件监视
|
|
35
|
+
"google-genai", # Google AI SDK
|
|
36
|
+
"google-generativeai", # Google Generative AI
|
|
37
|
+
"aiofiles",
|
|
31
38
|
],
|
|
32
39
|
# extras_require={
|
|
33
40
|
# "dev": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bohr-agent-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.102
|
|
4
4
|
Summary: SDK for scientific agents
|
|
5
5
|
Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
|
|
6
6
|
Author: DP Technology
|
|
@@ -30,6 +30,9 @@ Requires-Dist: paho-mqtt>=2.1.0
|
|
|
30
30
|
Requires-Dist: redis>=6.2.0
|
|
31
31
|
Requires-Dist: twine>=6.1.0
|
|
32
32
|
Requires-Dist: build>=1.2.2.post1
|
|
33
|
+
Requires-Dist: watchdog>=6.0.0
|
|
34
|
+
Requires-Dist: fastapi>=0.116.0
|
|
35
|
+
Requires-Dist: bohrium-open-sdk==0.1.5
|
|
33
36
|
Provides-Extra: device
|
|
34
37
|
Requires-Dist: pywinauto-recorder>=0.1.0; extra == "device"
|
|
35
38
|
Provides-Extra: cloud
|
|
@@ -44,6 +47,7 @@ Requires-Dist: black>=23.11.0; extra == "dev"
|
|
|
44
47
|
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
45
48
|
Requires-Dist: mypy>=1.7.0; extra == "dev"
|
|
46
49
|
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
50
|
+
Requires-Dist: google-adk; extra == "dev"
|
|
47
51
|
Provides-Extra: docs
|
|
48
52
|
Requires-Dist: sphinx>=7.2.0; extra == "docs"
|
|
49
53
|
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
|
|
@@ -92,7 +96,7 @@ dp-agent run tool cloud
|
|
|
92
96
|
dp-agent run tool calculation
|
|
93
97
|
|
|
94
98
|
# 运行代理
|
|
95
|
-
dp-agent run agent
|
|
99
|
+
dp-agent run agent --config config.json
|
|
96
100
|
|
|
97
101
|
# 调试模式
|
|
98
102
|
dp-agent run debug
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
setup.py
|
|
4
|
+
src/bohr_agent_sdk.egg-info/PKG-INFO
|
|
5
|
+
src/bohr_agent_sdk.egg-info/SOURCES.txt
|
|
6
|
+
src/bohr_agent_sdk.egg-info/dependency_links.txt
|
|
7
|
+
src/bohr_agent_sdk.egg-info/entry_points.txt
|
|
8
|
+
src/bohr_agent_sdk.egg-info/requires.txt
|
|
9
|
+
src/bohr_agent_sdk.egg-info/top_level.txt
|
|
10
|
+
src/dp/__init__.py
|
|
11
|
+
src/dp/agent/__init__.py
|
|
12
|
+
src/dp/agent/adapter/adk/__init__.py
|
|
13
|
+
src/dp/agent/adapter/adk/storage_artifact_service.py
|
|
14
|
+
src/dp/agent/adapter/adk/utils.py
|
|
15
|
+
src/dp/agent/adapter/adk/client/__init__.py
|
|
16
|
+
src/dp/agent/adapter/adk/client/calculation_mcp_tool.py
|
|
17
|
+
src/dp/agent/adapter/camel/__init__.py
|
|
18
|
+
src/dp/agent/adapter/camel/client/__init__.py
|
|
19
|
+
src/dp/agent/adapter/camel/client/calculation_mcp_client.py
|
|
20
|
+
src/dp/agent/cli/__init__.py
|
|
21
|
+
src/dp/agent/cli/cli.py
|
|
22
|
+
src/dp/agent/cli/templates/__init__.py
|
|
23
|
+
src/dp/agent/cli/templates/main.py.template
|
|
24
|
+
src/dp/agent/cli/templates/calculation/simple.py.template
|
|
25
|
+
src/dp/agent/cli/templates/device/tescan_device.py.template
|
|
26
|
+
src/dp/agent/cli/templates/ui/__init__.py
|
|
27
|
+
src/dp/agent/cli/templates/ui/test_download.py
|
|
28
|
+
src/dp/agent/cli/templates/ui/ui_utils.py
|
|
29
|
+
src/dp/agent/cli/templates/ui/websocket-server.py
|
|
30
|
+
src/dp/agent/cli/templates/ui/api/__init__.py
|
|
31
|
+
src/dp/agent/cli/templates/ui/api/config.py
|
|
32
|
+
src/dp/agent/cli/templates/ui/api/constants.py
|
|
33
|
+
src/dp/agent/cli/templates/ui/api/debug.py
|
|
34
|
+
src/dp/agent/cli/templates/ui/api/files.py
|
|
35
|
+
src/dp/agent/cli/templates/ui/api/files_upload.py
|
|
36
|
+
src/dp/agent/cli/templates/ui/api/files_user.py
|
|
37
|
+
src/dp/agent/cli/templates/ui/api/messages.py
|
|
38
|
+
src/dp/agent/cli/templates/ui/api/projects.py
|
|
39
|
+
src/dp/agent/cli/templates/ui/api/sessions.py
|
|
40
|
+
src/dp/agent/cli/templates/ui/api/utils.py
|
|
41
|
+
src/dp/agent/cli/templates/ui/api/websocket.py
|
|
42
|
+
src/dp/agent/cli/templates/ui/config/__init__.py
|
|
43
|
+
src/dp/agent/cli/templates/ui/config/agent_config.py
|
|
44
|
+
src/dp/agent/cli/templates/ui/frontend/index.html
|
|
45
|
+
src/dp/agent/cli/templates/ui/frontend/package.json
|
|
46
|
+
src/dp/agent/cli/templates/ui/frontend/tsconfig.json
|
|
47
|
+
src/dp/agent/cli/templates/ui/frontend/tsconfig.node.json
|
|
48
|
+
src/dp/agent/cli/templates/ui/frontend/vite.config.ts
|
|
49
|
+
src/dp/agent/cli/templates/ui/frontend/ui-static/index.html
|
|
50
|
+
src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DdAmKhul.js
|
|
51
|
+
src/dp/agent/cli/templates/ui/frontend/ui-static/assets/index-DfN2raU9.css
|
|
52
|
+
src/dp/agent/cli/templates/ui/scripts/build_ui.py
|
|
53
|
+
src/dp/agent/cli/templates/ui/server/__init__.py
|
|
54
|
+
src/dp/agent/cli/templates/ui/server/app.py
|
|
55
|
+
src/dp/agent/cli/templates/ui/server/connection.py
|
|
56
|
+
src/dp/agent/cli/templates/ui/server/file_watcher.py
|
|
57
|
+
src/dp/agent/cli/templates/ui/server/middleware.py
|
|
58
|
+
src/dp/agent/cli/templates/ui/server/models.py
|
|
59
|
+
src/dp/agent/cli/templates/ui/server/session_manager.py
|
|
60
|
+
src/dp/agent/cli/templates/ui/server/user_files.py
|
|
61
|
+
src/dp/agent/cli/templates/ui/server/utils.py
|
|
62
|
+
src/dp/agent/cloud/__init__.py
|
|
63
|
+
src/dp/agent/cloud/main.py
|
|
64
|
+
src/dp/agent/cloud/mcp.py
|
|
65
|
+
src/dp/agent/cloud/mqtt.py
|
|
66
|
+
src/dp/agent/device/__init__.py
|
|
67
|
+
src/dp/agent/device/mqtt_device_twin.py
|
|
68
|
+
src/dp/agent/device/device/__init__.py
|
|
69
|
+
src/dp/agent/device/device/device.py
|
|
70
|
+
src/dp/agent/device/device/types.py
|
|
71
|
+
src/dp/agent/server/__init__.py
|
|
72
|
+
src/dp/agent/server/calculation_mcp_server.py
|
|
73
|
+
src/dp/agent/server/preprocessor.py
|
|
74
|
+
src/dp/agent/server/utils.py
|
|
75
|
+
src/dp/agent/server/executor/__init__.py
|
|
76
|
+
src/dp/agent/server/executor/base_executor.py
|
|
77
|
+
src/dp/agent/server/executor/dispatcher_executor.py
|
|
78
|
+
src/dp/agent/server/executor/local_executor.py
|
|
79
|
+
src/dp/agent/server/storage/__init__.py
|
|
80
|
+
src/dp/agent/server/storage/base_storage.py
|
|
81
|
+
src/dp/agent/server/storage/bohrium_storage.py
|
|
82
|
+
src/dp/agent/server/storage/http_storage.py
|
|
83
|
+
src/dp/agent/server/storage/local_storage.py
|
|
84
|
+
src/dp/agent/server/storage/oss_storage.py
|
|
85
|
+
tests/test_cli.py
|
|
@@ -10,6 +10,9 @@ paho-mqtt>=2.1.0
|
|
|
10
10
|
redis>=6.2.0
|
|
11
11
|
twine>=6.1.0
|
|
12
12
|
build>=1.2.2.post1
|
|
13
|
+
watchdog>=6.0.0
|
|
14
|
+
fastapi>=0.116.0
|
|
15
|
+
bohrium-open-sdk==0.1.5
|
|
13
16
|
|
|
14
17
|
[all]
|
|
15
18
|
bohr-agent-sdk[bohrium,cloud,dev,device,dispatcher,docs]
|
|
@@ -27,6 +30,7 @@ black>=23.11.0
|
|
|
27
30
|
isort>=5.12.0
|
|
28
31
|
mypy>=1.7.0
|
|
29
32
|
pylint>=3.0.0
|
|
33
|
+
google-adk
|
|
30
34
|
|
|
31
35
|
[device]
|
|
32
36
|
pywinauto-recorder>=0.1.0
|
|
@@ -8,7 +8,18 @@ import signal
|
|
|
8
8
|
import uuid
|
|
9
9
|
import requests
|
|
10
10
|
|
|
11
|
+
try:
|
|
12
|
+
from dotenv import load_dotenv
|
|
13
|
+
env_file = Path('.env')
|
|
14
|
+
if not env_file.exists():
|
|
15
|
+
env_file = Path(__file__).parent.parent.parent.parent.parent / '.env'
|
|
16
|
+
if env_file.exists():
|
|
17
|
+
load_dotenv(env_file)
|
|
18
|
+
except ImportError:
|
|
19
|
+
pass
|
|
20
|
+
|
|
11
21
|
from ..server.storage import storage_dict
|
|
22
|
+
from .templates.ui.ui_utils import UIConfigManager, UIProcessManager
|
|
12
23
|
|
|
13
24
|
@click.group()
|
|
14
25
|
def cli():
|
|
@@ -29,37 +40,34 @@ def scaffolding(type):
|
|
|
29
40
|
"""Fetch scaffolding for the science agent."""
|
|
30
41
|
click.echo(f"Generating {type} project scaffold...")
|
|
31
42
|
|
|
32
|
-
# 获取模板目录路径
|
|
33
43
|
templates_dir = Path(__file__).parent / 'templates'
|
|
34
|
-
|
|
35
|
-
# 获取用户当前工作目录
|
|
36
44
|
current_dir = Path.cwd()
|
|
37
45
|
|
|
38
46
|
|
|
39
|
-
#
|
|
47
|
+
# Create necessary directory structure
|
|
40
48
|
if type == 'device':
|
|
41
|
-
project_dirs =
|
|
49
|
+
project_dirs = ['cloud', 'device']
|
|
42
50
|
elif type == 'calculation':
|
|
43
|
-
project_dirs =
|
|
51
|
+
project_dirs = ['calculation']
|
|
44
52
|
|
|
45
53
|
for dir_name in project_dirs:
|
|
46
54
|
dst_dir = current_dir / dir_name
|
|
47
55
|
|
|
48
56
|
if dst_dir.exists():
|
|
49
|
-
click.echo(f"Warning: {dir_name} already exists
|
|
50
|
-
click.echo(f"
|
|
57
|
+
click.echo(f"Warning: {dir_name} already exists, skipping...")
|
|
58
|
+
click.echo(f"To create a new scaffold, please delete the existing folder first.")
|
|
51
59
|
continue
|
|
52
60
|
|
|
53
|
-
#
|
|
61
|
+
# Create directory only
|
|
54
62
|
dst_dir.mkdir(parents=True, exist_ok=True)
|
|
55
63
|
|
|
56
|
-
#
|
|
64
|
+
# Create __init__.py files to make directories Python packages
|
|
57
65
|
for dir_name in project_dirs:
|
|
58
66
|
init_file = current_dir / dir_name / '__init__.py'
|
|
59
67
|
if not init_file.exists():
|
|
60
68
|
init_file.write_text('')
|
|
61
69
|
|
|
62
|
-
#
|
|
70
|
+
# Create main.py from template
|
|
63
71
|
main_template = templates_dir / 'main.py.template'
|
|
64
72
|
main_file = current_dir / 'main.py'
|
|
65
73
|
if not main_file.exists():
|
|
@@ -78,11 +86,11 @@ def scaffolding(type):
|
|
|
78
86
|
calculation_file = current_dir / 'calculation' / 'simple.py'
|
|
79
87
|
if not calculation_file.exists():
|
|
80
88
|
shutil.copy2(calculation_template, calculation_file)
|
|
81
|
-
click.echo("\nCreated calculation example implementation in calculation/
|
|
82
|
-
click.echo("Please modify this file according to your actual calculation
|
|
89
|
+
click.echo("\nCreated calculation example implementation in calculation/simple.py")
|
|
90
|
+
click.echo("Please modify this file according to your actual calculation requirements.")
|
|
83
91
|
|
|
84
|
-
click.echo("\
|
|
85
|
-
click.echo("Now you can use dp-agent run
|
|
92
|
+
click.echo("\nSuccessfully created scaffold!")
|
|
93
|
+
click.echo("Now you can use dp-agent run tool cloud/device/calculation to run this project!")
|
|
86
94
|
|
|
87
95
|
@fetch.command()
|
|
88
96
|
def config():
|
|
@@ -104,7 +112,6 @@ def config():
|
|
|
104
112
|
response = requests.get(remote_env_url)
|
|
105
113
|
with open(env_file, 'w') as f:
|
|
106
114
|
f.write(response.text)
|
|
107
|
-
#shutil.copy2(env_template, env_file)
|
|
108
115
|
click.echo("Configuration file .env has been created.")
|
|
109
116
|
click.echo("\nIMPORTANT: Please update the following configurations in your .env file:")
|
|
110
117
|
click.echo("1. MQTT_INSTANCE_ID - Your Aliyun MQTT instance ID")
|
|
@@ -172,16 +179,109 @@ def calculation():
|
|
|
172
179
|
sys.exit(1)
|
|
173
180
|
|
|
174
181
|
@run.command()
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
@click.option('--ui/--no-ui', default=True, help='Enable/disable Web UI interface')
|
|
183
|
+
@click.option('--config', help='Configuration file path (default: agent-config.json)')
|
|
184
|
+
@click.option('--port', type=int, help='Server port (default from config)')
|
|
185
|
+
@click.option('--module', help='Agent module path (default: agent)')
|
|
186
|
+
@click.option('--agent-name', help='Agent variable name (default: root_agent)')
|
|
187
|
+
@click.option('--dev/--prod', default=False, help='Development mode (default: production)')
|
|
188
|
+
def agent(ui, config, port, module, agent_name, dev):
|
|
189
|
+
"""Run the science agent with optional UI interface."""
|
|
190
|
+
if not ui:
|
|
191
|
+
click.echo("Starting agent in console mode...")
|
|
192
|
+
click.echo("Console mode not yet implemented.")
|
|
193
|
+
return
|
|
194
|
+
|
|
195
|
+
current_dir = Path.cwd()
|
|
196
|
+
config_path = Path(config) if config else current_dir / "agent-config.json"
|
|
197
|
+
config_manager = UIConfigManager(config_path if config_path.exists() else None)
|
|
198
|
+
|
|
199
|
+
if module:
|
|
200
|
+
config_manager.config['agent']['module'] = module
|
|
201
|
+
|
|
202
|
+
agent_module = config_manager.config['agent']['module']
|
|
203
|
+
|
|
204
|
+
if '/' in agent_module or '\\' in agent_module or agent_module.endswith('.py'):
|
|
205
|
+
file_path = Path(agent_module)
|
|
206
|
+
|
|
207
|
+
if not file_path.is_absolute():
|
|
208
|
+
file_path = current_dir / file_path
|
|
209
|
+
|
|
210
|
+
if not file_path.exists():
|
|
211
|
+
click.echo(f"Error: Agent file not found: {file_path}")
|
|
212
|
+
click.echo("\nPlease ensure:")
|
|
213
|
+
click.echo("1. File path is correct")
|
|
214
|
+
click.echo("2. File exists and is accessible")
|
|
215
|
+
sys.exit(1)
|
|
216
|
+
else:
|
|
217
|
+
module_parts = agent_module.split('.')
|
|
218
|
+
module_dir = current_dir / Path(*module_parts[:-1])
|
|
219
|
+
module_file = current_dir / Path(*module_parts[:-1]) / f"{module_parts[-1]}.py"
|
|
220
|
+
module_init = module_dir / "__init__.py"
|
|
221
|
+
|
|
222
|
+
if not (module_dir.exists() or module_file.exists()):
|
|
223
|
+
click.echo(f"Error: Module {agent_module} not found.")
|
|
224
|
+
click.echo(f"Tried to find: {module_dir} or {module_file}")
|
|
225
|
+
click.echo("\nPlease ensure:")
|
|
226
|
+
click.echo("1. You have created the agent module")
|
|
227
|
+
click.echo("2. The 'agent.module' path is correctly configured in config.json")
|
|
228
|
+
click.echo("3. Or use --module parameter to specify the correct module path")
|
|
229
|
+
sys.exit(1)
|
|
230
|
+
|
|
231
|
+
if os.environ.get('UI_TEMPLATE_DIR'):
|
|
232
|
+
ui_dir = Path(os.environ.get('UI_TEMPLATE_DIR'))
|
|
233
|
+
else:
|
|
234
|
+
try:
|
|
235
|
+
current_file = Path(__file__).resolve()
|
|
236
|
+
|
|
237
|
+
if 'site-packages' in str(current_file):
|
|
238
|
+
ui_dir = Path(__file__).parent / "templates" / "ui"
|
|
239
|
+
else:
|
|
240
|
+
ui_dir = current_file.parent / "templates" / "ui"
|
|
241
|
+
click.echo(f"🔧 Development mode detected, using source path: {ui_dir}")
|
|
242
|
+
|
|
243
|
+
except Exception:
|
|
244
|
+
ui_dir = Path(__file__).parent / "templates" / "ui"
|
|
245
|
+
|
|
246
|
+
if not ui_dir.exists():
|
|
247
|
+
click.echo(f"Error: UI template directory not found: {ui_dir}")
|
|
248
|
+
click.echo("Tip: You can specify template path via UI_TEMPLATE_DIR environment variable")
|
|
249
|
+
sys.exit(1)
|
|
250
|
+
|
|
251
|
+
if agent_name:
|
|
252
|
+
config_manager.config['agent']['rootAgent'] = agent_name
|
|
253
|
+
if port:
|
|
254
|
+
config_manager.config['server']['port'] = port
|
|
255
|
+
|
|
256
|
+
temp_config = ui_dir / "config" / "agent-config.temp.json"
|
|
257
|
+
config_manager.save_config(temp_config)
|
|
258
|
+
|
|
259
|
+
os.environ['AGENT_CONFIG_PATH'] = str(temp_config)
|
|
260
|
+
os.environ['PYTHONPATH'] = f"{current_dir}:{os.environ.get('PYTHONPATH', '')}"
|
|
261
|
+
|
|
262
|
+
try:
|
|
263
|
+
process_manager = UIProcessManager(ui_dir, config_manager.config)
|
|
264
|
+
|
|
265
|
+
process_manager.start_websocket_server()
|
|
266
|
+
process_manager.start_frontend_server(dev_mode=dev)
|
|
267
|
+
|
|
268
|
+
click.echo("\nPress Ctrl+C to stop the service...")
|
|
269
|
+
process_manager.wait_for_processes()
|
|
270
|
+
|
|
271
|
+
except KeyboardInterrupt:
|
|
272
|
+
click.echo("\nShutting down services...")
|
|
273
|
+
if 'process_manager' in locals():
|
|
274
|
+
process_manager.cleanup()
|
|
275
|
+
sys.exit(0)
|
|
276
|
+
except Exception as e:
|
|
277
|
+
click.echo(f"Error: {e}")
|
|
278
|
+
if 'process_manager' in locals():
|
|
279
|
+
process_manager.cleanup()
|
|
280
|
+
sys.exit(1)
|
|
281
|
+
finally:
|
|
282
|
+
if 'temp_config' in locals() and temp_config.exists():
|
|
283
|
+
temp_config.unlink()
|
|
179
284
|
|
|
180
|
-
@run.command()
|
|
181
|
-
def debug():
|
|
182
|
-
"""Debug the science agent in cloud environment."""
|
|
183
|
-
click.echo("Starting cloud environment in debug mode...")
|
|
184
|
-
click.echo("Cloud environment debug mode started.")
|
|
185
285
|
|
|
186
286
|
@cli.group()
|
|
187
287
|
def artifact():
|
|
@@ -229,6 +329,7 @@ def download(**kwargs):
|
|
|
229
329
|
path = storage.download(key, path)
|
|
230
330
|
click.echo("%s has been downloaded to %s" % (uri, path))
|
|
231
331
|
|
|
332
|
+
|
|
232
333
|
def main():
|
|
233
334
|
cli()
|
|
234
335
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# CLI 模板包
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from dp.agent.server import CalculationMCPServer
|
|
2
|
+
|
|
3
|
+
# 创建 MCP Server 实例
|
|
4
|
+
mcp = CalculationMCPServer("Demo", host="0.0.0.0", port=5001)
|
|
5
|
+
|
|
6
|
+
# 用装饰器注册远程调用函数
|
|
7
|
+
@mcp.tool()
|
|
8
|
+
def add_numbers(a: int, b: int) -> int:
|
|
9
|
+
"""Add two numbers."""
|
|
10
|
+
return a + b
|
|
11
|
+
|
|
12
|
+
def run():
|
|
13
|
+
print("Starting MCP server on http://127.0.0.1:5001 ...")
|
|
14
|
+
mcp.run(transport="streamable-http")
|
|
15
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tescan device implementation.
|
|
3
|
+
|
|
4
|
+
This module contains the implementation of a Tescan device with
|
|
5
|
+
specific parameter and result types.
|
|
6
|
+
"""
|
|
7
|
+
import time
|
|
8
|
+
from typing import Dict, TypedDict
|
|
9
|
+
from dp.agent.device.device.types import SuccessResult, BaseParams, ErrorResult
|
|
10
|
+
from dp.agent.device.device.device import Device, action
|
|
11
|
+
|
|
12
|
+
class TakePictureParams(BaseParams):
|
|
13
|
+
"""Parameters for take_picture action."""
|
|
14
|
+
horizontal_width: str
|
|
15
|
+
|
|
16
|
+
class GetStagePositionParams(BaseParams):
|
|
17
|
+
"""Parameters for get_stage_position action."""
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
class MoveStageParams(BaseParams):
|
|
21
|
+
"""Parameters for move_stage action."""
|
|
22
|
+
x: float
|
|
23
|
+
y: float
|
|
24
|
+
z: float
|
|
25
|
+
|
|
26
|
+
class StagePosition(TypedDict):
|
|
27
|
+
"""Stage position data."""
|
|
28
|
+
x: float
|
|
29
|
+
y: float
|
|
30
|
+
z: float
|
|
31
|
+
|
|
32
|
+
class PictureData(TypedDict):
|
|
33
|
+
"""Picture data."""
|
|
34
|
+
image_id: str
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class SleepParams(BaseParams):
|
|
38
|
+
"""Parameters for sleep action."""
|
|
39
|
+
seconds: int
|
|
40
|
+
|
|
41
|
+
class StagePositionResult(SuccessResult):
|
|
42
|
+
"""Result for get_stage_position action."""
|
|
43
|
+
data: StagePosition
|
|
44
|
+
|
|
45
|
+
class PictureResult(SuccessResult):
|
|
46
|
+
"""Result for take_picture action."""
|
|
47
|
+
data: PictureData
|
|
48
|
+
|
|
49
|
+
class MoveStageResult(SuccessResult):
|
|
50
|
+
"""Result for move_stage action."""
|
|
51
|
+
data: Dict[str, float]
|
|
52
|
+
|
|
53
|
+
class TescanDevice(Device):
|
|
54
|
+
"""Tescan device implementation."""
|
|
55
|
+
device_name = "tescan"
|
|
56
|
+
|
|
57
|
+
@action("start_electron_beam")
|
|
58
|
+
def start_electron_beam(self, params: BaseParams):
|
|
59
|
+
print("start electron beam")
|
|
60
|
+
|
|
61
|
+
@action("start_ion_beam")
|
|
62
|
+
def start_ion_beam(self, params: BaseParams):
|
|
63
|
+
print("start ion beam")
|
|
64
|
+
|
|
65
|
+
@action("toggle_electron_scanning")
|
|
66
|
+
def toggle_electron_scanning(self, params: BaseParams):
|
|
67
|
+
"""start scanning, this will cost 5 seconds to finish. call sleep(5) after toggle this.
|
|
68
|
+
"""
|
|
69
|
+
print("toggle electron scanning")
|
|
70
|
+
|
|
71
|
+
@action("toggle_ion_scanning")
|
|
72
|
+
def toggle_ion_scanning(self, params: BaseParams):
|
|
73
|
+
print("toggle ion scanning")
|
|
74
|
+
|
|
75
|
+
@action("sleep")
|
|
76
|
+
def sleep(self, params: SleepParams):
|
|
77
|
+
time.sleep(params.get("seconds", 0))
|
|
78
|
+
|
|
79
|
+
@action("take_picture")
|
|
80
|
+
def take_picture(self, params: TakePictureParams) -> PictureResult:
|
|
81
|
+
"""Take a picture with the microscope.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
params: Parameters for the action
|
|
85
|
+
- horizontal_width: Horizontal width of the image
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Result of the action
|
|
89
|
+
"""
|
|
90
|
+
time.sleep(1)
|
|
91
|
+
|
|
92
|
+
hw = params.get("horizontal_width", "default")
|
|
93
|
+
|
|
94
|
+
return PictureResult(
|
|
95
|
+
message=f"Picture taken with {self.device_name} (width: {hw})",
|
|
96
|
+
data={"image_id": "mock_image_123"}
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
@action("get_stage_position")
|
|
100
|
+
def get_stage_position(self, params: GetStagePositionParams) -> StagePositionResult:
|
|
101
|
+
"""Get the stage position.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
params: Parameters for the action (none required)
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
Result of the action with x, y, z coordinates
|
|
108
|
+
"""
|
|
109
|
+
time.sleep(0.5)
|
|
110
|
+
|
|
111
|
+
return StagePositionResult(
|
|
112
|
+
message=f"Stage position retrieved for {self.device_name}",
|
|
113
|
+
data=StagePosition(
|
|
114
|
+
x=10.5,
|
|
115
|
+
y=20.3,
|
|
116
|
+
z=5.1
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
@action("move_stage")
|
|
121
|
+
def move_stage(self, params: MoveStageParams) -> MoveStageResult:
|
|
122
|
+
"""Move the stage to a new position.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
params: Parameters for the action
|
|
126
|
+
- x: X coordinate
|
|
127
|
+
- y: Y coordinate
|
|
128
|
+
- z: Z coordinate
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
Result of the action
|
|
132
|
+
"""
|
|
133
|
+
time.sleep(2)
|
|
134
|
+
|
|
135
|
+
if not all(k in params for k in ["x", "y", "z"]):
|
|
136
|
+
# Use a proper MoveStageResult with error status instead of ErrorResult
|
|
137
|
+
return MoveStageResult(
|
|
138
|
+
message=f"Missing required parameters: x, y, z",
|
|
139
|
+
data={}
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
new_position = {
|
|
144
|
+
"x": float(params["x"]),
|
|
145
|
+
"y": float(params["y"]),
|
|
146
|
+
"z": float(params["z"])
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return MoveStageResult(
|
|
150
|
+
message=f"Stage moved for {self.device_name}",
|
|
151
|
+
data=new_position
|
|
152
|
+
)
|
|
153
|
+
except (KeyError, TypeError, ValueError):
|
|
154
|
+
# Use a proper MoveStageResult with error status instead of ErrorResult
|
|
155
|
+
return MoveStageResult(
|
|
156
|
+
message=f"Invalid parameters: x, y, z must be numeric values",
|
|
157
|
+
data={}
|
|
158
|
+
)
|