bohr-agent-sdk 0.1.118__py3-none-any.whl → 0.1.120__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bohr-agent-sdk
3
- Version: 0.1.118
3
+ Version: 0.1.120
4
4
  Summary: SDK for scientific agents
5
5
  Home-page: https://github.com/dptech-corp/bohr-agent-sdk/
6
6
  Author: DP Technology
@@ -17,7 +17,7 @@ dp/agent/cli/templates/device/tescan_device.py.template,sha256=c7RIwWhfwp5WiPy1S
17
17
  dp/agent/cli/templates/ui/__init__.py,sha256=QgYZneX7gKyajZIEvbHIEMD3av3bKj64E_eeDPBeuvY,14
18
18
  dp/agent/cli/templates/ui/test_download.py,sha256=RzZ59pVd-4fYIbUbW6ZO1b1Twbycu5G6yb5yLFuT0oI,3002
19
19
  dp/agent/cli/templates/ui/ui_utils.py,sha256=OMgQxZ-UvIJB_a58YBMypQKTI7N9B3AQBOR7kOTudRE,9774
20
- dp/agent/cli/templates/ui/websocket-server.py,sha256=YLVnXyBelrZLo9EcU-17_qts4-UVscMM8-cX08X6XYY,2809
20
+ dp/agent/cli/templates/ui/websocket-server.py,sha256=vhLsDuhQFxqp9RL7lWq3M8CP196VDZuoI3y_5YPqXQA,2968
21
21
  dp/agent/cli/templates/ui/api/__init__.py,sha256=eq1djuBJYvWlGTgxXvT9A386Eu21FNCcB7gV2lU46dU,8
22
22
  dp/agent/cli/templates/ui/api/config.py,sha256=ZhHApcXDrmO1JjI-Ok09ETYB-BVis390ZrMRt140DhQ,1018
23
23
  dp/agent/cli/templates/ui/api/constants.py,sha256=mHY81zf4ksfKEOsSiVsWD_A_KcQ6wveLvAImCay_kVM,1391
@@ -47,7 +47,7 @@ dp/agent/cli/templates/ui/server/connection.py,sha256=DVlhx49gMjKVPxOpi7spAZiHZA
47
47
  dp/agent/cli/templates/ui/server/file_watcher.py,sha256=t0e7IMgf4E1y0CxeboCqsVeZPBo1CGSw_qoO8wG6Wy4,2923
48
48
  dp/agent/cli/templates/ui/server/middleware.py,sha256=bNR5aFqKjxv2einQ0e26aq6tiUW4SMses3IHkrmHDCk,1474
49
49
  dp/agent/cli/templates/ui/server/models.py,sha256=obfMkFFB9qZZXDdwoC25u3tBlUC6Rz7sjeyuh7a_UWk,1680
50
- dp/agent/cli/templates/ui/server/session_manager.py,sha256=ZbNHGCFvswa-LKWn6c6RMHWDdfeOvY5L6A8CfrsF0OE,46536
50
+ dp/agent/cli/templates/ui/server/session_manager.py,sha256=GviOjYZtdbd4Cpdxc0zfb1NV38uBvyJnzgd9uUusb9k,46528
51
51
  dp/agent/cli/templates/ui/server/user_files.py,sha256=khkiyY2UOOysHqO6JgCPUDqtrInp83G1M62i3Lj-0aY,2995
52
52
  dp/agent/cli/templates/ui/server/utils.py,sha256=f4NfwFBq_RdZyFn_KCW6ZThYW8TvQyVruK7PJZ-DA80,1530
53
53
  dp/agent/client/__init__.py,sha256=yu7HYZwAkD7g5dL9JttLkGmspBcyOf-6OoCjci4oPDA,59
@@ -62,7 +62,7 @@ dp/agent/device/device/__init__.py,sha256=w7_1S16S1vWUq0RGl0GFgjq2vFkc5oNvy8cQTn
62
62
  dp/agent/device/device/device.py,sha256=9ZRIJth-4qMO-i-u_b_cO3d6a4eTbTQjPaxFsV_zEkc,9643
63
63
  dp/agent/device/device/types.py,sha256=JuxB-hjf1CjjvfBxCLwRAXVFlYS-nPEdiJpBWLFVCzo,1924
64
64
  dp/agent/server/__init__.py,sha256=rckaYd8pbYyB4ENEhgjXKeGMXjdnrgcJpdM1gu5u1Wc,508
65
- dp/agent/server/calculation_mcp_server.py,sha256=D28eEwcaOGRHq3Vwgm-eJINRVU5vz46HDTvmWnouCKQ,19045
65
+ dp/agent/server/calculation_mcp_server.py,sha256=Ax3vZbJbU4o66tRRS4R_IGcSrMmXAj9fskl-V5tgrKA,19464
66
66
  dp/agent/server/preprocessor.py,sha256=XUWu7QOwo_sIDMYS2b1OTrM33EXEVH_73vk-ju1Ok8A,1264
67
67
  dp/agent/server/utils.py,sha256=cIKaAg8UaP5yMwvIVTgUVBjy-B3S16bEdnucUf4UDIM,2055
68
68
  dp/agent/server/executor/__init__.py,sha256=s95M5qKQk39Yi9qaVJZhk_nfj54quSf7EDghR3OCFUA,248
@@ -75,8 +75,8 @@ dp/agent/server/storage/bohrium_storage.py,sha256=EsKX4dWWvZTn2TEhZv4zsvihfDK0mm
75
75
  dp/agent/server/storage/http_storage.py,sha256=KiySq7g9-iJr12XQCKKyJLn8wJoDnSRpQAR5_qPJ1ZU,1471
76
76
  dp/agent/server/storage/local_storage.py,sha256=t1wfjByjXew9ws3PuUxWxmZQ0-Wt1a6t4wmj3fW62GI,1352
77
77
  dp/agent/server/storage/oss_storage.py,sha256=pgjmi7Gir3Y5wkMDCvU4fvSls15fXT7Ax-h9MYHFPK0,3359
78
- bohr_agent_sdk-0.1.118.dist-info/METADATA,sha256=vNyEqSDKjWct5yfQIMwFYFz45Ofw71ODoceNhmAk7Vw,11070
79
- bohr_agent_sdk-0.1.118.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
80
- bohr_agent_sdk-0.1.118.dist-info/entry_points.txt,sha256=5n5kneF5IbDQtoQ2WfF-QuBjDtsimJte9Rv9baSGgc0,86
81
- bohr_agent_sdk-0.1.118.dist-info/top_level.txt,sha256=87xLUDhu_1nQHoGLwlhJ6XlO7OsjILh6i1nX6ljFzDo,3
82
- bohr_agent_sdk-0.1.118.dist-info/RECORD,,
78
+ bohr_agent_sdk-0.1.120.dist-info/METADATA,sha256=GBYxEWv13ktFJwnVq8yXqNFTVeHRhlxZdC2nBlecdsw,11070
79
+ bohr_agent_sdk-0.1.120.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
80
+ bohr_agent_sdk-0.1.120.dist-info/entry_points.txt,sha256=5n5kneF5IbDQtoQ2WfF-QuBjDtsimJte9Rv9baSGgc0,86
81
+ bohr_agent_sdk-0.1.120.dist-info/top_level.txt,sha256=87xLUDhu_1nQHoGLwlhJ6XlO7OsjILh6i1nX6ljFzDo,3
82
+ bohr_agent_sdk-0.1.120.dist-info/RECORD,,
@@ -632,7 +632,7 @@ class SessionManager:
632
632
  ):
633
633
  """Process message stream - using ADK native event handling"""
634
634
  streaming_text = "" # Accumulate streaming text
635
-
635
+
636
636
  # Run Runner
637
637
  async for event in runner.run_async(
638
638
  new_message=content,
@@ -48,11 +48,13 @@ if __name__ == "__main__":
48
48
 
49
49
  # uvicorn 始终监听 0.0.0.0 以支持所有配置的主机
50
50
  uvicorn.run(
51
- app,
52
- host="0.0.0.0",
51
+ app,
52
+ host="0.0.0.0",
53
53
  port=port,
54
54
  log_level="info", # 使用 info 级别,过滤掉 warning
55
55
  access_log=False, # 禁用访问日志,减少噪音
56
+ ws_ping_interval=20, # Send WebSocket ping every 20s to keep connection alive
57
+ ws_ping_timeout=30, # Disconnect if no pong received within 30s
56
58
  # 添加自定义的日志配置
57
59
  log_config={
58
60
  "version": 1,
@@ -26,6 +26,7 @@ from .executor import executor_dict
26
26
  from .storage import storage_dict
27
27
  from .utils import get_logger, JobResult, Tool
28
28
  logger = get_logger(__name__)
29
+ CALCULATION_MCP_WORKDIR = os.getenv("CALCULATION_MCP_WORKDIR", os.getcwd())
29
30
 
30
31
 
31
32
  def parse_uri(uri):
@@ -58,6 +59,7 @@ def init_executor(executor_config: Optional[dict] = None):
58
59
  @contextmanager
59
60
  def set_directory(workdir: str):
60
61
  cwd = os.getcwd()
62
+ workdir = os.path.join(CALCULATION_MCP_WORKDIR, workdir)
61
63
  os.makedirs(workdir, exist_ok=True)
62
64
  try:
63
65
  os.chdir(workdir)
@@ -130,13 +132,15 @@ def handle_input_artifacts(fn, kwargs, storage):
130
132
  kwargs.get(name) is not None):
131
133
  uris = kwargs[name]
132
134
  new_paths = []
133
- for uri in uris:
135
+ for i, uri in enumerate(uris):
134
136
  scheme, key = parse_uri(uri)
135
137
  if scheme == storage_type:
136
138
  s = storage
137
139
  else:
138
140
  s = storage_dict[scheme]()
139
- path = s.download(key, "inputs/%s" % name)
141
+ dest_dir = Path("inputs") / name / f"item_{i:03d}"
142
+ dest_dir.mkdir(parents=True, exist_ok=True)
143
+ path = s.download(key, str(dest_dir))
140
144
  new_paths.append(Path(path))
141
145
  logger.info("Artifact %s downloaded to %s" % (
142
146
  uri, path))
@@ -172,13 +176,15 @@ def handle_input_artifacts(fn, kwargs, storage):
172
176
  new_paths_dict = {}
173
177
  for key_name, uris in uris_dict.items():
174
178
  new_paths = []
175
- for uri in uris:
179
+ for i, uri in enumerate(uris):
176
180
  scheme, key = parse_uri(uri)
177
181
  if scheme == storage_type:
178
182
  s = storage
179
183
  else:
180
184
  s = storage_dict[scheme]()
181
- path = s.download(key, f"inputs/{name}/{key_name}")
185
+ dest_dir = Path("inputs") / name / key_name / f"item_{i:03d}"
186
+ dest_dir.mkdir(parents=True, exist_ok=True)
187
+ path = s.download(key, str(dest_dir))
182
188
  new_paths.append(Path(path))
183
189
  logger.info("Artifact %s (key=%s) downloaded to %s" % (
184
190
  uri, key_name, path))