This commit is contained in:
2026-07-22 23:55:46 +02:00
parent 34f76aad65
commit 77f043640e
23 changed files with 993 additions and 11 deletions
+11 -6
View File
@@ -520,8 +520,8 @@ class DeviiSession:
f"{self._system_prompt}\n\n"
f"{CA_IWP_SYSTEM_FRAGMENT}\n\n"
f"{channel_block}\n\n"
f"{self._clock_line()}\n\n"
f"{section}"
f"{section}\n\n"
f"{self._clock_line()}"
)
def _clock_line(self) -> str:
@@ -538,7 +538,7 @@ class DeviiSession:
offset = local_now.utcoffset()
offset_text = _format_offset(offset)
local = (
f" The user's local time is {local_now.strftime('%Y-%m-%d %H:%M:%S')} "
f" The user's local time is {local_now.strftime('%Y-%m-%d %Hh')} "
f"({tz_name}, UTC{offset_text})."
)
except Exception: # noqa: BLE001 - unknown tz name: fall back to UTC only
@@ -547,16 +547,21 @@ class DeviiSession:
offset = timedelta(minutes=self._tz_offset_minutes)
local = (
f" The user's local time is "
f"{(now + offset).strftime('%Y-%m-%d %H:%M:%S')} "
f"{(now + offset).strftime('%Y-%m-%d %Hh')} "
f"(UTC{_format_offset(offset)})."
)
return (
f"# CURRENT TIME\n"
f"The current UTC time is {now.strftime('%Y-%m-%dT%H:%M:%S')}Z.{local} "
f"The current UTC time is approximately {now.strftime('%Y-%m-%d %Hh')} UTC "
f"(rounded to the hour for situational awareness only).{local} "
"When the user gives a wall-clock time (for example '3pm' or 'tomorrow at 09:00'), "
"interpret it in the user's local timezone and convert it to UTC for the run_at field. "
"For a relative request (for example 'in 40 seconds' or 'in 2 hours'), use delay_seconds "
"instead and do not compute an absolute time."
"instead and do not compute an absolute time - it is applied against the exact time on "
"the server when the task is created, regardless of the rounding above. If you ever need "
"the exact current time to the second - for example to compute an absolute run_at from a "
"phrase you cannot express as delay_seconds - call the current_time tool first; never "
"derive an absolute run_at from the rounded line above."
)
def _stored_timezone(self) -> str: