AstrBot 4.12.4__py3-none-any.whl → 4.13.1__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 (54) hide show
  1. astrbot/builtin_stars/astrbot/process_llm_request.py +42 -1
  2. astrbot/cli/__init__.py +1 -1
  3. astrbot/core/agent/runners/tool_loop_agent_runner.py +91 -1
  4. astrbot/core/agent/tool.py +61 -20
  5. astrbot/core/astr_agent_tool_exec.py +2 -2
  6. astrbot/core/{sandbox → computer}/booters/base.py +4 -4
  7. astrbot/core/{sandbox → computer}/booters/boxlite.py +2 -2
  8. astrbot/core/computer/booters/local.py +234 -0
  9. astrbot/core/{sandbox → computer}/booters/shipyard.py +2 -2
  10. astrbot/core/computer/computer_client.py +102 -0
  11. astrbot/core/{sandbox → computer}/tools/__init__.py +2 -1
  12. astrbot/core/{sandbox → computer}/tools/fs.py +1 -1
  13. astrbot/core/computer/tools/python.py +94 -0
  14. astrbot/core/{sandbox → computer}/tools/shell.py +13 -5
  15. astrbot/core/config/default.py +61 -9
  16. astrbot/core/db/__init__.py +3 -0
  17. astrbot/core/db/po.py +23 -61
  18. astrbot/core/db/sqlite.py +19 -1
  19. astrbot/core/message/components.py +2 -2
  20. astrbot/core/persona_mgr.py +8 -0
  21. astrbot/core/pipeline/context_utils.py +2 -2
  22. astrbot/core/pipeline/preprocess_stage/stage.py +1 -1
  23. astrbot/core/pipeline/process_stage/method/agent_sub_stages/internal.py +21 -6
  24. astrbot/core/pipeline/process_stage/utils.py +19 -4
  25. astrbot/core/pipeline/scheduler.py +1 -1
  26. astrbot/core/platform/sources/aiocqhttp/aiocqhttp_message_event.py +3 -3
  27. astrbot/core/platform/sources/qqofficial/qqofficial_message_event.py +5 -7
  28. astrbot/core/provider/manager.py +31 -0
  29. astrbot/core/provider/sources/gemini_source.py +12 -9
  30. astrbot/core/skills/__init__.py +3 -0
  31. astrbot/core/skills/skill_manager.py +238 -0
  32. astrbot/core/star/command_management.py +1 -1
  33. astrbot/core/star/config.py +1 -1
  34. astrbot/core/star/filter/command.py +1 -1
  35. astrbot/core/star/filter/custom_filter.py +2 -2
  36. astrbot/core/star/register/star_handler.py +1 -1
  37. astrbot/core/utils/astrbot_path.py +6 -0
  38. astrbot/dashboard/routes/__init__.py +2 -0
  39. astrbot/dashboard/routes/config.py +236 -2
  40. astrbot/dashboard/routes/persona.py +7 -0
  41. astrbot/dashboard/routes/skills.py +148 -0
  42. astrbot/dashboard/routes/util.py +102 -0
  43. astrbot/dashboard/server.py +19 -5
  44. {astrbot-4.12.4.dist-info → astrbot-4.13.1.dist-info}/METADATA +2 -2
  45. {astrbot-4.12.4.dist-info → astrbot-4.13.1.dist-info}/RECORD +52 -47
  46. astrbot/core/sandbox/sandbox_client.py +0 -52
  47. astrbot/core/sandbox/tools/python.py +0 -74
  48. /astrbot/core/{sandbox → computer}/olayer/__init__.py +0 -0
  49. /astrbot/core/{sandbox → computer}/olayer/filesystem.py +0 -0
  50. /astrbot/core/{sandbox → computer}/olayer/python.py +0 -0
  51. /astrbot/core/{sandbox → computer}/olayer/shell.py +0 -0
  52. {astrbot-4.12.4.dist-info → astrbot-4.13.1.dist-info}/WHEEL +0 -0
  53. {astrbot-4.12.4.dist-info → astrbot-4.13.1.dist-info}/entry_points.txt +0 -0
  54. {astrbot-4.12.4.dist-info → astrbot-4.13.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,74 +0,0 @@
1
- from dataclasses import dataclass, field
2
-
3
- import mcp
4
-
5
- from astrbot.api import FunctionTool
6
- from astrbot.core.agent.run_context import ContextWrapper
7
- from astrbot.core.agent.tool import ToolExecResult
8
- from astrbot.core.astr_agent_context import AstrAgentContext
9
- from astrbot.core.sandbox.sandbox_client import get_booter
10
-
11
-
12
- @dataclass
13
- class PythonTool(FunctionTool):
14
- name: str = "astrbot_execute_ipython"
15
- description: str = "Execute a command in an IPython shell."
16
- parameters: dict = field(
17
- default_factory=lambda: {
18
- "type": "object",
19
- "properties": {
20
- "code": {
21
- "type": "string",
22
- "description": "The Python code to execute.",
23
- },
24
- "silent": {
25
- "type": "boolean",
26
- "description": "Whether to suppress the output of the code execution.",
27
- "default": False,
28
- },
29
- },
30
- "required": ["code"],
31
- }
32
- )
33
-
34
- async def call(
35
- self, context: ContextWrapper[AstrAgentContext], code: str, silent: bool = False
36
- ) -> ToolExecResult:
37
- sb = await get_booter(
38
- context.context.context,
39
- context.context.event.unified_msg_origin,
40
- )
41
- try:
42
- result = await sb.python.exec(code, silent=silent)
43
- data = result.get("data", {})
44
- output = data.get("output", {})
45
- error = data.get("error", "")
46
- images: list[dict] = output.get("images", [])
47
- text: str = output.get("text", "")
48
-
49
- resp = mcp.types.CallToolResult(content=[])
50
-
51
- if error:
52
- resp.content.append(
53
- mcp.types.TextContent(type="text", text=f"error: {error}")
54
- )
55
-
56
- if images:
57
- for img in images:
58
- resp.content.append(
59
- mcp.types.ImageContent(
60
- type="image", data=img["image/png"], mimeType="image/png"
61
- )
62
- )
63
- if text:
64
- resp.content.append(mcp.types.TextContent(type="text", text=text))
65
-
66
- if not resp.content:
67
- resp.content.append(
68
- mcp.types.TextContent(type="text", text="No output.")
69
- )
70
-
71
- return resp
72
-
73
- except Exception as e:
74
- return f"Error executing code: {str(e)}"
File without changes
File without changes
File without changes
File without changes