mirror of
https://github.com/TencentCloud/Octop.git
synced 2026-10-16 05:39:20 +08:00
* refactor(agents): group thin modules into domain subpackages Move plugin helpers, memory, settings stores, persona/MBTI, and avatar bootstrap code under plugins/, memory/, settings/, persona/, and experts/ while keeping top-level import shims so existing call sites stay stable. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(agents): drop compatibility shims after subpackage move Call sites already import the new package paths; remove the top-level re-export stubs so the agents tree only shows real modules. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(agents): move thread helpers into threads/ Group artifact shaping, fork, and context breakdown under agents/threads so top-level only keeps lifecycle/config adapters. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(agents): fold profile/runtime/tool catalog into settings/ Move the remaining config-surface helpers under settings/ and drop the skill_package id-list aliases in favor of dump/parse_id_list. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(agents): group workspace_dir and execute_env under workspace/ Keep path resolution and harness execute-env injection together as one workspace package; leave only manager and conversation_mode at top level. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(infra): fix history/SkillHub ownership and drop thin providers/ Move history_projection under history/, share SkillHub host/limits and route expert skill downloads through skills.skillhub_market, and fold Codex OAuth helpers into agents.providers to remove the tiny providers/ package. Co-authored-by: Cursor <cursoragent@cursor.com> * docs: sync AGENTS.md and guides with infra/agents layout Reflect subpackages (settings/workspace/threads/persona, history/, skills/) and drop stale runtime.py / mbti_profiles paths after the agents reorg. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: jubaoliang <jubaoliang@tencent.com> Co-authored-by: Cursor <cursoragent@cursor.com>
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
"""Unit tests for plugin tool default-on / merge helpers."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from octop.infra.agents.plugins.plugin_tool_defaults import (
|
|
agent_plugin_enabled,
|
|
expand_plugin_tools_default_on,
|
|
merge_plugins_enabled_settings,
|
|
merge_plugins_tool_settings,
|
|
)
|
|
|
|
|
|
def test_merge_preserves_config_when_toggling_enabled() -> None:
|
|
existing = {
|
|
"echo-tool": {
|
|
"tools": {
|
|
"echo_message": {"enabled": False, "config": {"prefix": "hi"}},
|
|
}
|
|
}
|
|
}
|
|
merged = merge_plugins_tool_settings(
|
|
existing,
|
|
{"echo-tool": {"tools": {"echo_message": {"enabled": True}}}},
|
|
)
|
|
tool = merged["echo-tool"]["tools"]["echo_message"]
|
|
assert tool["enabled"] is True
|
|
assert tool["config"] == {"prefix": "hi"}
|
|
|
|
|
|
def test_expand_default_on_fills_missing_tools() -> None:
|
|
out = expand_plugin_tools_default_on(
|
|
{},
|
|
registered_tools=[("echo-tool", "echo_message")],
|
|
global_plugins={"echo-tool": True},
|
|
)
|
|
assert out["echo-tool"]["tools"]["echo_message"]["enabled"] is True
|
|
|
|
|
|
def test_agent_plugin_enabled_defaults_true_when_missing() -> None:
|
|
assert agent_plugin_enabled({}, "echo-tool") is True
|
|
assert agent_plugin_enabled({"echo-tool": {"tools": {}}}, "echo-tool") is True
|
|
assert agent_plugin_enabled({"echo-tool": {"enabled": False}}, "echo-tool") is False
|
|
|
|
|
|
def test_plugin_level_toggle_preserves_tool_config() -> None:
|
|
existing = {
|
|
"echo-tool": {
|
|
"tools": {
|
|
"echo_message": {
|
|
"enabled": False,
|
|
"config": {"prefix": "kept"},
|
|
}
|
|
}
|
|
}
|
|
}
|
|
disabled = merge_plugins_enabled_settings(existing, {"echo-tool": False})
|
|
assert disabled["echo-tool"]["enabled"] is False
|
|
assert disabled["echo-tool"]["tools"] == existing["echo-tool"]["tools"]
|
|
enabled = merge_plugins_enabled_settings(disabled, {"echo-tool": True})
|
|
assert enabled["echo-tool"]["tools"] == existing["echo-tool"]["tools"]
|