Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

fix: The handling of paths for manually and conversation-created scheduled tasks is not unified.

wangxiaolong100589d3da565d0
diff --git a/jiuwenclaw/agentserver/tools/cron_tools.py b/jiuwenclaw/agentserver/tools/cron_tools.py
index 36b3c5a7da..2e0fd35ae3 100644
--- a/jiuwenclaw/agentserver/tools/cron_tools.py
+++ b/jiuwenclaw/agentserver/tools/cron_tools.py
@@ -20,7 +20,7 @@ from jiuwenclaw.agentserver.gateway_push import (
GatewayPushTransport,
WebSocketGatewayPushTransport,
)
-from jiuwenclaw.utils import get_user_workspace_dir
+from jiuwenclaw.utils import get_cron_jobs_path
logger = logging.getLogger(__name__)
@@ -58,7 +58,7 @@ class CronTools:
) -> None:
self._gateway_push: GatewayPushTransport = gateway_push or WebSocketGatewayPushTransport()
self._local_store = CronJobStore(
- path=get_user_workspace_dir() / "agent" / "home" / "cron_jobs.json"
+ path=get_cron_jobs_path()
)
# 内置调度器,用于在 Agent-side 执行定时任务
self._scheduler: CronSchedulerService | None = None
diff --git a/jiuwenclaw/app_gateway.py b/jiuwenclaw/app_gateway.py
index a20c896010..57c505020c 100644
--- a/jiuwenclaw/app_gateway.py
+++ b/jiuwenclaw/app_gateway.py
@@ -30,7 +30,7 @@ from openjiuwen.core.common.logging import LogManager
import jiuwenclaw.channel.acp_channel as acp_channel_module
from jiuwenclaw.channel.acp_channel import AcpGatewayBridge
from jiuwenclaw.gateway.route_binding import GatewayRouteBinding
-from jiuwenclaw.utils import get_user_workspace_dir, get_env_file, prepare_workspace
+from jiuwenclaw.utils import get_user_workspace_dir, get_env_file, prepare_workspace, get_cron_jobs_path
# Ensure workspace initialized
_workspace_dir = get_user_workspace_dir()
@@ -762,7 +762,7 @@ async def _run(
message_handler.set_inbound_pipeline(im_inbound)
message_handler.set_outbound_pipeline(im_outbound)
- cron_store = CronJobStore(path=get_user_workspace_dir() / "gateway" / "cron_jobs.json")
+ cron_store = CronJobStore(path=get_cron_jobs_path())
cron_scheduler = CronSchedulerService(
store=cron_store,
agent_client=client,
diff --git a/jiuwenclaw/gateway/cron/store.py b/jiuwenclaw/gateway/cron/store.py
index 4f25f880b2..8cccff34ba 100644
--- a/jiuwenclaw/gateway/cron/store.py
+++ b/jiuwenclaw/gateway/cron/store.py
@@ -9,14 +9,14 @@ from pathlib import Path
from typing import Any
from jiuwenclaw.gateway.cron.models import CronJob, CronTarget
-from jiuwenclaw.utils import get_agent_home_dir
+from jiuwenclaw.utils import get_cron_jobs_path
class CronJobStore:
"""Persist cron jobs to ~/.jiuwenclaw/agent/home/cron_jobs.json."""
def __init__(self, path: Path | None = None) -> None:
- self._path = path or (get_agent_home_dir() / "cron_jobs.json")
+ self._path = path or get_cron_jobs_path()
self._lock = asyncio.Lock()
@property
diff --git a/jiuwenclaw/utils.py b/jiuwenclaw/utils.py
index 4a77d3a1cf..0dfe72af65 100644
--- a/jiuwenclaw/utils.py
+++ b/jiuwenclaw/utils.py
@@ -965,6 +965,11 @@ def get_agent_skills_dir() -> Path:
return get_agent_workspace_dir() / "skills"
+def get_cron_jobs_path() -> Path:
+ """Canonical path for cron_jobs.json shared by gateway and agentserver."""
+ return get_user_workspace_dir() / "agent" / "home" / "cron_jobs.json"
+
+
def get_deepagent_todo_dir() -> Path:
"""Get the DeepAgent todo directory path.