refactor(workspace): simplify sidebar state management using cookies

This commit is contained in:
jiangfeng.11
2026-04-11 10:38:05 +08:00
parent 2540acd5f7
commit f7a6ca8364
2 changed files with 16 additions and 51 deletions
@@ -11,11 +11,7 @@ from weakref import WeakValueDictionary
from langchain.tools import ToolRuntime, tool
from langgraph.typing import ContextT
<<<<<<< HEAD
from deerflow.agents.lead_agent.prompt import clear_skills_system_prompt_cache
=======
from deerflow.agents.lead_agent.prompt import refresh_skills_system_prompt_cache_async
>>>>>>> main
from deerflow.agents.thread_state import ThreadState
from deerflow.mcp.tools import _make_sync_tool_wrapper
from deerflow.skills.manager import (
@@ -119,11 +115,7 @@ async def _skill_manage_impl(
name,
_history_record(action="create", file_path="SKILL.md", prev_content=None, new_content=content, thread_id=thread_id, scanner=scan),
)
<<<<<<< HEAD
clear_skills_system_prompt_cache()
=======
await refresh_skills_system_prompt_cache_async()
>>>>>>> main
return f"Created custom skill '{name}'."
if action == "edit":
@@ -140,11 +132,7 @@ async def _skill_manage_impl(
name,
_history_record(action="edit", file_path="SKILL.md", prev_content=prev_content, new_content=content, thread_id=thread_id, scanner=scan),
)
<<<<<<< HEAD
clear_skills_system_prompt_cache()
=======
await refresh_skills_system_prompt_cache_async()
>>>>>>> main
return f"Updated custom skill '{name}'."
if action == "patch":
@@ -168,11 +156,7 @@ async def _skill_manage_impl(
name,
_history_record(action="patch", file_path="SKILL.md", prev_content=prev_content, new_content=new_content, thread_id=thread_id, scanner=scan),
)
<<<<<<< HEAD
clear_skills_system_prompt_cache()
=======
await refresh_skills_system_prompt_cache_async()
>>>>>>> main
return f"Patched custom skill '{name}' ({replacement_count} replacement(s) applied, {occurrences} match(es) found)."
if action == "delete":
@@ -185,11 +169,7 @@ async def _skill_manage_impl(
_history_record(action="delete", file_path="SKILL.md", prev_content=prev_content, new_content=None, thread_id=thread_id, scanner={"decision": "allow", "reason": "Deletion requested."}),
)
await _to_thread(shutil.rmtree, skill_dir)
<<<<<<< HEAD
clear_skills_system_prompt_cache()
=======
await refresh_skills_system_prompt_cache_async()
>>>>>>> main
return f"Deleted custom skill '{name}'."
if action == "write_file":