fix(heartbeat): inject shared current time context into phase 1
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Any, Callable, Coroutine
|
||||
|
||||
@@ -88,19 +87,13 @@ class HeartbeatService:
|
||||
|
||||
Returns (action, tasks) where action is 'skip' or 'run'.
|
||||
"""
|
||||
now_str = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC")
|
||||
from nanobot.utils.helpers import current_time_str
|
||||
|
||||
response = await self.provider.chat_with_retry(
|
||||
messages=[
|
||||
{"role": "system", "content": (
|
||||
"You are a heartbeat agent. Call the heartbeat tool to report your decision. "
|
||||
"The current date/time is provided so you can evaluate time-based conditions. "
|
||||
"Choose 'run' if there are active tasks to execute. "
|
||||
"Choose 'skip' if the file has no actionable tasks, if blocking conditions "
|
||||
"are not yet met, or if tasks are scheduled for a future time that has not arrived yet."
|
||||
)},
|
||||
{"role": "system", "content": "You are a heartbeat agent. Call the heartbeat tool to report your decision."},
|
||||
{"role": "user", "content": (
|
||||
f"Current date/time: {now_str}\n\n"
|
||||
f"Current Time: {current_time_str()}\n\n"
|
||||
"Review the following HEARTBEAT.md and decide whether there are active tasks.\n\n"
|
||||
f"{content}"
|
||||
)},
|
||||
|
||||
Reference in New Issue
Block a user