agentscope-runtime 1.0.4__py3-none-any.whl → 1.0.4a1__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.
Files changed (46) hide show
  1. agentscope_runtime/adapters/agentscope/stream.py +7 -1
  2. agentscope_runtime/cli/commands/deploy.py +0 -371
  3. agentscope_runtime/engine/__init__.py +0 -4
  4. agentscope_runtime/engine/constant.py +0 -1
  5. agentscope_runtime/engine/deployers/__init__.py +0 -12
  6. agentscope_runtime/engine/deployers/adapter/a2a/__init__.py +51 -26
  7. agentscope_runtime/engine/deployers/adapter/a2a/a2a_protocol_adapter.py +10 -19
  8. agentscope_runtime/engine/deployers/adapter/a2a/a2a_registry.py +201 -4
  9. agentscope_runtime/engine/deployers/adapter/a2a/nacos_a2a_registry.py +25 -134
  10. agentscope_runtime/engine/deployers/agentrun_deployer.py +2 -2
  11. agentscope_runtime/engine/runner.py +0 -12
  12. agentscope_runtime/engine/tracing/wrapper.py +4 -18
  13. agentscope_runtime/sandbox/__init__.py +6 -14
  14. agentscope_runtime/sandbox/box/base/__init__.py +2 -2
  15. agentscope_runtime/sandbox/box/base/base_sandbox.py +1 -51
  16. agentscope_runtime/sandbox/box/browser/__init__.py +2 -2
  17. agentscope_runtime/sandbox/box/browser/browser_sandbox.py +2 -198
  18. agentscope_runtime/sandbox/box/filesystem/__init__.py +2 -2
  19. agentscope_runtime/sandbox/box/filesystem/filesystem_sandbox.py +2 -99
  20. agentscope_runtime/sandbox/box/gui/__init__.py +2 -2
  21. agentscope_runtime/sandbox/box/gui/gui_sandbox.py +1 -117
  22. agentscope_runtime/sandbox/box/mobile/__init__.py +2 -2
  23. agentscope_runtime/sandbox/box/mobile/mobile_sandbox.py +100 -247
  24. agentscope_runtime/sandbox/box/sandbox.py +65 -98
  25. agentscope_runtime/sandbox/box/shared/routers/generic.py +29 -36
  26. agentscope_runtime/sandbox/client/__init__.py +1 -6
  27. agentscope_runtime/sandbox/client/http_client.py +329 -108
  28. agentscope_runtime/sandbox/enums.py +0 -7
  29. agentscope_runtime/sandbox/manager/sandbox_manager.py +4 -264
  30. agentscope_runtime/sandbox/manager/server/app.py +1 -7
  31. agentscope_runtime/version.py +1 -1
  32. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.4a1.dist-info}/METADATA +28 -102
  33. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.4a1.dist-info}/RECORD +37 -46
  34. agentscope_runtime/adapters/ms_agent_framework/__init__.py +0 -0
  35. agentscope_runtime/adapters/ms_agent_framework/message.py +0 -205
  36. agentscope_runtime/adapters/ms_agent_framework/stream.py +0 -418
  37. agentscope_runtime/adapters/utils.py +0 -6
  38. agentscope_runtime/common/container_clients/knative_client.py +0 -466
  39. agentscope_runtime/engine/deployers/fc_deployer.py +0 -1506
  40. agentscope_runtime/engine/deployers/knative_deployer.py +0 -290
  41. agentscope_runtime/sandbox/client/async_http_client.py +0 -339
  42. agentscope_runtime/sandbox/client/base.py +0 -74
  43. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.4a1.dist-info}/WHEEL +0 -0
  44. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.4a1.dist-info}/entry_points.txt +0 -0
  45. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.4a1.dist-info}/licenses/LICENSE +0 -0
  46. {agentscope_runtime-1.0.4.dist-info → agentscope_runtime-1.0.4a1.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@
2
2
  import io
3
3
  import sys
4
4
  import logging
5
- import asyncio
5
+ import subprocess
6
6
  import traceback
7
7
  from contextlib import redirect_stderr, redirect_stdout
8
8
 
@@ -44,33 +44,26 @@ async def run_ipython_cell(
44
44
  stdout_buf = io.StringIO()
45
45
  stderr_buf = io.StringIO()
46
46
 
47
- def thread_target():
48
- with redirect_stdout(stdout_buf), redirect_stderr(stderr_buf):
49
- preprocessing_exc_tuple = None
50
- try:
51
- transformed_cell = ipy.transform_cell(code)
52
- except Exception:
53
- transformed_cell = code
54
- preprocessing_exc_tuple = sys.exc_info()
55
-
56
- if transformed_cell is None:
57
- raise HTTPException(
58
- status_code=500,
59
- detail=(
60
- "IPython cell transformation failed: "
61
- "transformed_cell is None."
62
- ),
63
- )
64
-
65
- asyncio.run(
66
- ipy.run_cell_async(
67
- code,
68
- transformed_cell=transformed_cell,
69
- preprocessing_exc_tuple=preprocessing_exc_tuple,
70
- ),
47
+ with redirect_stdout(stdout_buf), redirect_stderr(stderr_buf):
48
+ preprocessing_exc_tuple = None
49
+ try:
50
+ transformed_cell = ipy.transform_cell(code)
51
+ except Exception:
52
+ transformed_cell = code
53
+ preprocessing_exc_tuple = sys.exc_info()
54
+
55
+ if transformed_cell is None:
56
+ raise HTTPException(
57
+ status_code=500,
58
+ detail="IPython cell transformation failed: "
59
+ "transformed_cell is None.",
71
60
  )
72
61
 
73
- await asyncio.to_thread(thread_target)
62
+ await ipy.run_cell_async(
63
+ code,
64
+ transformed_cell=transformed_cell,
65
+ preprocessing_exc_tuple=preprocessing_exc_tuple,
66
+ )
74
67
 
75
68
  stdout_content = stdout_buf.getvalue()
76
69
  stderr_content = stderr_buf.getvalue()
@@ -135,16 +128,16 @@ async def run_shell_command(
135
128
  if not command:
136
129
  raise HTTPException(status_code=400, detail="Command is required.")
137
130
 
138
- proc = await asyncio.create_subprocess_shell(
131
+ result = subprocess.run(
139
132
  command,
140
- stdout=asyncio.subprocess.PIPE,
141
- stderr=asyncio.subprocess.PIPE,
133
+ shell=True,
134
+ stdout=subprocess.PIPE,
135
+ stderr=subprocess.PIPE,
136
+ text=True,
137
+ check=False,
142
138
  )
143
-
144
- stdout_bytes, stderr_bytes = await proc.communicate()
145
-
146
- stdout_content = stdout_bytes.decode()
147
- stderr_content = stderr_bytes.decode()
139
+ stdout_content = result.stdout
140
+ stderr_content = result.stderr
148
141
 
149
142
  content_list = []
150
143
 
@@ -168,7 +161,7 @@ async def run_shell_command(
168
161
  content_list.append(
169
162
  TextContent(
170
163
  type="text",
171
- text=str(proc.returncode),
164
+ text=str(result.returncode),
172
165
  description="returncode",
173
166
  ),
174
167
  )
@@ -180,7 +173,7 @@ async def run_shell_command(
180
173
  + "\n"
181
174
  + stderr_content
182
175
  + "\n"
183
- + str(proc.returncode),
176
+ + str(result.returncode),
184
177
  description="output",
185
178
  ),
186
179
  )
@@ -1,10 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  from .http_client import SandboxHttpClient
3
3
  from .training_client import TrainingSandboxClient
4
- from .async_http_client import SandboxHttpAsyncClient
5
4
 
6
- __all__ = [
7
- "SandboxHttpClient",
8
- "SandboxHttpAsyncClient",
9
- "TrainingSandboxClient",
10
- ]
5
+ __all__ = ["SandboxHttpClient", "TrainingSandboxClient"]