Prepare tested main sync cleanup

This commit is contained in:
pewdiepie-archdaemon
2026-06-09 09:27:13 +09:00
parent db1bbfe588
commit 3b01760e95
6 changed files with 284 additions and 40 deletions
+8 -31
View File
@@ -28,34 +28,11 @@ except ImportError:
logger = logging.getLogger(__name__)
# Tools that are ALWAYS included regardless of retrieval results.
# These are the most commonly needed and should never be missing.
# Keep this deliberately tiny. Domain tools (web, documents, email,
# cookbook/model serving, files, settings, etc.) are injected by retrieval or
# keyword intent so a trivial agent prompt like "test" does not carry every
# domain's schemas and rules.
ALWAYS_AVAILABLE = frozenset({
"bash", "python", "web_search", "web_fetch",
# File tools: read AND write/edit. An agent with disk access should always
# be able to change files, not just read them — otherwise a bare "edit X"
# request can miss write_file/edit_file (RAG-only) and the model wrongly
# falls back to edit_document (editor panel). All admin-gated by tool_security.
"read_file", "write_file", "edit_file",
"grep", "glob", "ls", # code-navigation tools (admin-gated by tool_security)
"api_call", # For configured integrations (Miniflux, Gitea, Linkding, etc.)
# The two genuinely AMBIENT cookbook tools — "what's running" and
# "kill it" can be asked any time without prior cookbook context,
# and need to survive typos. The other cookbook tools (downloads,
# presets, serve, cached, servers) are CONTEXTUAL — they fire via
# keyword hints when the user is actually talking about cookbook.
# Keeping the always-on set small leaves room in the ~16-tool
# budget for manage_tasks / manage_calendar / etc.
"list_served_models", "stop_served_model", "tail_serve_output",
# Serving is a core agent capability — keep these always available so
# the router doesn't lose them on phrasings like "servic" / "fire up" / "boot".
"serve_model", "serve_preset", "list_serve_presets",
"list_cached_models", "list_cookbook_servers",
# Fallback when serve_model's allowlist rejects a cmd or when the
# model was launched out-of-band via bash+tmux — without this the
# session is invisible to the cookbook UI even though it's running.
"adopt_served_model",
# Generic API loopback — the catch-all when no named tool fits.
"app_api",
# Memory is ambient — "remember this" can follow any message regardless
# of topic. Without this, RAG drops it and the agent falls back to
# app_api /api/memory/add which fails with 422 on first attempt.
@@ -362,7 +339,7 @@ class ToolIndex:
# request (e.g. "visit <url> and tell me the title"), force-including the
# whole email toolset and crowding out the relevant tools — the model then
# believed it had only email tools and refused web/other tasks (#1707).
frozenset({"email", "mail", "gmail", "googlemail", "message", "send", "reply", "inbox", "unread"}):
frozenset({"email", "emails", "mail", "mails", "gmail", "googlemail", "message", "messages", "send", "reply", "replies", "inbox", "unread"}):
{"list_email_accounts", "list_emails", "read_email", "send_email", "reply_to_email", "bulk_email", "delete_email", "archive_email", "mark_email_read", "resolve_contact", "ui_control"},
frozenset({"calendar", "event", "meeting", "schedule", "appointment"}):
{"manage_calendar"},
@@ -426,14 +403,14 @@ class ToolIndex:
# Document edit/update intent
frozenset({"edit", "change", "fix", "rewrite", "update",
"replace", "add a", "tweak", "modify", "rename", "paragraph",
"section", "line", "the doc", "the document", "in the doc"}):
"section", "line", "the doc", "the docs", "the document", "the documents", "in the doc", "in the docs", "in document"}):
{"edit_document", "update_document", "create_document", "suggest_document"},
# Document deletion / management — include generic open/find/read/show
# verbs + file/doc synonyms so "open my <X>", "find the <X>", "delete
# <X>" reach manage_documents even without the literal word "document".
frozenset({"delete this doc", "delete the doc", "delete document",
"remove document", "remove the doc", "trash", "list documents",
"list docs", "all my docs", "my documents", "my docs", "my files",
"remove document", "remove the doc", "trash", "list document", "list documents",
"list doc", "list docs", "all my docs", "my document", "my documents", "my doc", "my docs", "my files",
"open the", "open my", "open document", "open doc", "find the",
"find my", "find document", "read the", "read my", "show me the",
"show my", "the file", "my file", "the report", "the write-up",