Spaces:
Sleeping
Sleeping
File size: 674 Bytes
44ad484 c338c4c 44ad484 c338c4c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | from __future__ import annotations
from typing import List, Optional
def todos(
action: str,
items: Optional[List[str]] = None,
index: Optional[int] = None,
) -> str:
"""Branching todo tool. Executor node consumes SET_TODOS / DONE_TODO sentinels."""
if action == "write":
if items is None:
return "ERROR: action='write' requires `items` (list of strings)."
return f"SET_TODOS: {items}"
if action == "done":
if index is None:
return "ERROR: action='done' requires `index` (0-based position)."
return f"DONE_TODO: {index}"
return f"ERROR: unknown action '{action}'. Use 'write' or 'done'."
|