Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Always reference these instructions first and fallback to search or bash command
### Running the Application
- Run main application: `uv run main.py` -- starts in ~3 seconds
- Application creates WebUI on http://localhost:6185 (default credentials: `astrbot`/`astrbot`)
- Application loads plugins automatically from `packages/` and `data/plugins/` directories

### Dashboard Build (Vue.js/Node.js)
- **Prerequisites**: Node.js 20+ and npm 10+ required
Expand All @@ -35,7 +34,7 @@ Always reference these instructions first and fallback to search or bash command
- **ALWAYS** run `uv run ruff check .` and `uv run ruff format .` before committing changes

### Plugin Development
- Plugins load from `packages/` (built-in) and `data/plugins/` (user-installed)
- Plugins load from `astrbot/builtin_stars/` (built-in) and `data/plugins/` (user-installed)
- Plugin system supports function tools and message handlers
- Key plugins: python_interpreter, web_searcher, astrbot, reminder, session_controller

Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ configs/session
configs/config.yaml
cmd_config.json

# Plugins and packages
# Plugins
addons/plugins
packages/python_interpreter/workplace
astrbot/builtin_stars/python_interpreter/workplace
tests/astrbot_plugin_openai

# Dashboard
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion astrbot/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def is_plugin_path(pathname):
return False

norm_path = os.path.normpath(pathname)
return ("data/plugins" in norm_path) or ("packages/" in norm_path)
return ("data/plugins" in norm_path) or ("astrbot/builtin_stars/" in norm_path)


def get_short_level_name(level_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ async def process(
return

req.prompt = event.message_str[len(provider_wake_prefix) :]
# func_tool selection 现在已经转移到 packages/astrbot 插件中进行选择。
# func_tool selection 现在已经转移到 astrbot/builtin_stars/astrbot 插件中进行选择。
# req.func_tool = self.ctx.plugin_manager.context.get_llm_tool_manager()
for comp in event.message_obj.message:
if isinstance(comp, Image):
Expand Down
3 changes: 2 additions & 1 deletion astrbot/core/pipeline/waking_check/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ async def process(
):
if (
self.disable_builtin_commands
and handler.handler_module_path == "packages.builtin_commands.main"
and handler.handler_module_path
== "astrbot.builtin_stars.builtin_commands.main"
):
logger.debug("skipping builtin command")
continue
Expand Down
2 changes: 1 addition & 1 deletion astrbot/core/star/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def add_llm_tools(self, *tools: FunctionTool) -> None:
if not module_path:
_parts = []
module_part = tool.__module__.split(".")
flags = ["packages", "plugins"]
flags = ["builtin_stars", "plugins"]
for i, part in enumerate(module_part):
_parts.append(part)
if part in flags and i + 1 < len(module_part):
Expand Down
24 changes: 11 additions & 13 deletions astrbot/core/star/star_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from astrbot.core.provider.register import llm_tools
from astrbot.core.utils.astrbot_path import (
get_astrbot_config_path,
get_astrbot_path,
get_astrbot_plugin_path,
)
from astrbot.core.utils.io import remove_dir
Expand Down Expand Up @@ -49,13 +50,10 @@ def __init__(self, context: Context, config: AstrBotConfig):
"""存储插件的路径。即 data/plugins"""
self.plugin_config_path = get_astrbot_config_path()
"""存储插件配置的路径。data/config"""
self.reserved_plugin_path = os.path.abspath(
os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"../../../packages",
),
self.reserved_plugin_path = os.path.join(
get_astrbot_path(), "astrbot", "builtin_stars"
)
"""保留插件的路径。在 packages 目录下"""
"""保留插件的路径。在 astrbot/builtin_stars 目录下"""
self.conf_schema_fname = "_conf_schema.json"
self.logo_fname = "logo.png"
"""插件配置 Schema 文件名"""
Expand Down Expand Up @@ -252,7 +250,7 @@ def _get_plugin_related_modules(
list[str]: 与该插件相关的模块名列表

"""
prefix = "packages." if is_reserved else "data.plugins."
prefix = "astrbot.builtin_stars." if is_reserved else "data.plugins."
return [
key
for key in list(sys.modules.keys())
Expand All @@ -270,7 +268,7 @@ def _purge_modules(
可以基于模块名模式或插件目录名移除模块,用于清理插件相关的模块缓存

Args:
module_patterns: 要移除的模块名模式列表(例如 ["data.plugins", "packages"])
module_patterns: 要移除的模块名模式列表(例如 ["data.plugins", "astrbot.builtin_stars"])
root_dir_name: 插件根目录名,用于移除与该插件相关的所有模块
is_reserved: 插件是否为保留插件(影响模块路径前缀)

Expand Down Expand Up @@ -382,9 +380,9 @@ async def load(self, specified_module_path=None, specified_dir_name=None):
reserved = plugin_module.get(
"reserved",
False,
) # 是否是保留插件。目前在 packages/ 目录下的都是保留插件。保留插件不可以卸载。
) # 是否是保留插件。目前在 astrbot/builtin_stars 目录下的都是保留插件。保留插件不可以卸载。

path = "data.plugins." if not reserved else "packages."
path = "data.plugins." if not reserved else "astrbot.builtin_stars."
path += root_dir_name + "." + module_str

# 检查是否需要载入指定的插件
Expand Down Expand Up @@ -829,7 +827,7 @@ async def _unbind_plugin(self, plugin_name: str, plugin_module_path: str):
if (
mp
and mp.startswith(plugin_module_path)
and not mp.endswith(("packages", "data.plugins"))
and not mp.endswith(("astrbot.builtin_stars", "data.plugins"))
):
to_remove.append(func_tool)
for func_tool in to_remove:
Expand Down Expand Up @@ -884,7 +882,7 @@ async def turn_off_plugin(self, plugin_name: str):
plugin.module_path
and mp
and plugin.module_path.startswith(mp)
and not mp.endswith(("packages", "data.plugins"))
and not mp.endswith(("astrbot.builtin_stars", "data.plugins"))
):
func_tool.active = False
if func_tool.name not in inactivated_llm_tools:
Expand Down Expand Up @@ -933,7 +931,7 @@ async def turn_on_plugin(self, plugin_name: str):
plugin.module_path
and mp
and plugin.module_path.startswith(mp)
and not mp.endswith(("packages", "data.plugins"))
and not mp.endswith(("astrbot.builtin_stars", "data.plugins"))
and func_tool.name in inactivated_llm_tools
):
inactivated_llm_tools.remove(func_tool.name)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ typeCheckingMode = "basic"
pythonVersion = "3.10"
reportMissingTypeStubs = false
reportMissingImports = false
include = ["astrbot", "packages"]
include = ["astrbot"]
exclude = ["dashboard", "node_modules", "dist", "data", "tests"]

[build-system]
Expand Down