feat: add builtin tools module for _internal package

This commit is contained in:
LIghtJUNction
2026-03-23 21:44:14 +08:00
parent 9d49acdce7
commit e9e7c7ff07
2 changed files with 85 additions and 17 deletions

View File

@@ -0,0 +1,49 @@
"""
Builtin tools for AstrBot - re-exports from core.tools for backward compatibility.
This module re-exports the builtin tools (cron, send_message, kb_query) from
the deprecated core.tools module for backward compatibility.
TODO: These tools should be fully migrated to _internal and core.tools
should be removed once all consumers update their imports.
"""
from __future__ import annotations
# Re-export cron tools
from astrbot.core.tools.cron_tools import (
CREATE_CRON_JOB_TOOL,
DELETE_CRON_JOB_TOOL,
LIST_CRON_JOBS_TOOL,
CreateActiveCronTool,
DeleteCronJobTool,
ListCronJobsTool,
)
# Re-export send_message tool
from astrbot.core.tools.send_message import (
SEND_MESSAGE_TO_USER_TOOL,
SendMessageToUserTool,
)
# Re-export knowledge_base_query tool
from astrbot.core.tools.kb_query import (
KNOWLEDGE_BASE_QUERY_TOOL,
KnowledgeBaseQueryTool,
)
__all__ = [
# Cron tools
"CREATE_CRON_JOB_TOOL",
"DELETE_CRON_JOB_TOOL",
"LIST_CRON_JOBS_TOOL",
"CreateActiveCronTool",
"DeleteCronJobTool",
"ListCronJobsTool",
# Send message tool
"SEND_MESSAGE_TO_USER_TOOL",
"SendMessageToUserTool",
# Knowledge base tool
"KNOWLEDGE_BASE_QUERY_TOOL",
"KnowledgeBaseQueryTool",
]

View File

@@ -1,20 +1,39 @@
schema: spec-driven
# Project context (optional)
# This is shown to AI when creating artifacts.
# Add your tech stack, conventions, style guides, domain knowledge, etc.
# Example:
# context: |
# Tech stack: TypeScript, React, Node.js
# We use conventional commits
# Domain: e-commerce platform
# Project context
context: |
Tech stack: Python 3.12, anyio (async), FastAPI, pytest, ruff, uv
Domain: Multi-platform LLM chatbot framework (QQ, Telegram, Discord, etc.)
Architecture: Protocol-based system (LSP, MCP, ACP, ABP)
# Per-artifact rules (optional)
# Add custom rules for specific artifacts.
# Example:
# rules:
# proposal:
# - Keep proposals under 500 words
# - Always include a "Non-goals" section
# tasks:
# - Break tasks into chunks of max 2 hours
# Per-artifact rules
rules:
tasks:
- Break tasks into chunks of max 2 hours
- Always write tests for new functionality
- Run ruff and pytest before committing
code:
- Use absolute imports via `astrbot.` prefix
- Type hints required (no Any when possible)
- Comments in English
commits:
- Use conventional commits (feat:, fix:, docs:, refactor:, test:, chore:)
# Project directives (最高旨意)
directives:
architecture: |
New architecture goes in _internal package to avoid branch conflicts.
Protocol system: LSP (client), MCP (client+server), ACP (client+server), ABP (client+server).
Runtime coordinates protocols, Gateway provides FastAPI backend.
Stars are plugins - Galaxy is the collection of stars.
async_library: |
Use anyio as the async library (not asyncio).
coverage: |
Coverage testing must be improved.
type_checking: |
Code must pass `uvx ty check` (astral's pyright).
Avoid using Any and cast.
code_style: |
Code must pass `ruff check .` and `ruff format .`.
execution: |
Always use `uv run` for running Python scripts, not bare `python`.