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
@@ -56,6 +56,23 @@ SCHEDULE_FIELDS: tuple[Param, ...] = (
)
TASK_ACTIONS: tuple[Action, ...] = (
Action(
name="current_time",
method="LOCAL",
path="",
summary="Get the exact current UTC time, to the second",
description=(
"The CURRENT TIME line in the system prompt is rounded to the hour to stay "
"cache-friendly. Call this tool first whenever you need the precise current time - "
"in particular before computing any absolute run_at for create_task/update_task from "
"a relative phrase you cannot express via delay_seconds. For an ordinary relative "
"delay ('in 40 seconds', 'in 2 hours'), you do not need this: delay_seconds is applied "
"against the server's own clock at creation time and is always exact regardless."
),
handler="task",
requires_auth=False,
params=(),
),
Action(
name="create_task",
method="LOCAL",
@@ -69,6 +69,7 @@ class TaskController:
async def dispatch(self, name: str, arguments: dict[str, Any]) -> str:
handlers = {
"current_time": self.current_time,
"create_task": self.create_task,
"list_tasks": self.list_tasks,
"get_task": self.get_task,
@@ -81,6 +82,9 @@ class TaskController:
raise ToolInputError(f"Unknown task tool: {name}")
return handler(arguments)
def current_time(self, arguments: dict[str, Any]) -> str:
return json.dumps({"utc": to_iso(now_utc())}, ensure_ascii=False)
def create_task(self, arguments: dict[str, Any]) -> str:
prompt = str(arguments.get("prompt", "")).strip()
if not prompt: