Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

chore(i18n): translate committed German to English in jarvis/workflows core (batch 11_3_jarvis part 2)

Ruben Lütkedbae737037ce
diff --git a/jarvis/workflows/__init__.py b/jarvis/workflows/__init__.py
index fa087b847d..114a879c4c 100644
--- a/jarvis/workflows/__init__.py
+++ b/jarvis/workflows/__init__.py
@@ -1,16 +1,16 @@
-"""Workflow-System (Phase 6) — AI-Agent-Orchestration-Dashboard.
+"""Workflow system (Phase 6) — AI-agent orchestration dashboard.
-Ein **Workflow** ist eine benannte, wiederverwendbare Sequenz von Steps.
-Getrennt von ``jarvis.tasks`` (single-action, persistente Task-Queue)
-und ``jarvis.skills`` (voice/hotkey-triggered SKILL.md-Files):
+A **workflow** is a named, reusable sequence of steps.
+Separate from ``jarvis.tasks`` (single-action, persistent task queue)
+and ``jarvis.skills`` (voice/hotkey-triggered SKILL.md files):
-- Tasks = "einmal ausfuehren, dann weg" (Erinnerungen, Ad-hoc).
-- Skills = Natural-Language-Shortcuts (voice-triggered Macros).
-- **Workflows = gehostete Multi-Step-Pipelines** mit Cron- oder Manual-
- Trigger, die Brain-Prompts, Harness-Calls, Tool-Aufrufe und TTS-Ansagen
- zu einer Sequenz verketten. Das ist die AI-Agent-Antwort auf n8n.
+- Tasks = "run once, then gone" (reminders, ad hoc).
+- Skills = natural-language shortcuts (voice-triggered macros).
+- **Workflows = hosted multi-step pipelines** with a cron or manual
+ trigger that chain brain prompts, harness calls, tool calls, and TTS
+ announcements into a sequence. This is the AI-agent answer to n8n.
-Gehoert in Layer L6 (Orchestrator) laut Plan §3.
+Belongs in Layer L6 (Orchestrator) per Plan §3.
"""
from __future__ import annotations
diff --git a/jarvis/workflows/runner.py b/jarvis/workflows/runner.py
index 87a60ceda7..206b18adf8 100644
--- a/jarvis/workflows/runner.py
+++ b/jarvis/workflows/runner.py
@@ -1,19 +1,19 @@
-"""WorkflowRunner — fuehrt WorkflowDefs Step-fuer-Step aus.
-
-Design-Prinzipien:
-
-1. **Sequenziell**, nicht parallel. Die meisten User-Workflows sind
- "tu dies, dann das, dann sage das Ergebnis" — DAG-Parallelismus kommt
- erst in v2 wenn jemand es tatsaechlich braucht.
-2. **Alle Abhaengigkeiten sind optional.** Fehlt der BrainManager, wirft
- der ``brain_prompt``-Step einen sauberen Fehler, aber der Runner
- crasht nicht. So koennen Tests ohne volle Infrastruktur laufen.
-3. **Template-Variablen** werden vor der Execution per Substring-Replace
- expandiert. Scope: ``{{prev.output}}``, ``{{step_N.output}}``,
- ``{{input.<key>}}`` — alles andere bleibt literal stehen.
-4. **Events** gehen an den Bus (``WorkflowStarted``, ``WorkflowStepStarted``,
- ``WorkflowStepCompleted``, ``WorkflowCompleted``). Die UI hoert darauf
- und rendert Live-Updates.
+"""WorkflowRunner — executes WorkflowDefs step by step.
+
+Design principles:
+
+1. **Sequential**, not parallel. Most user workflows are
+ "do this, then that, then say the result" — DAG parallelism only
+ comes in v2, once someone actually needs it.
+2. **All dependencies are optional.** If the BrainManager is missing,
+ the ``brain_prompt`` step raises a clean error, but the runner
+ doesn't crash. This lets tests run without the full infrastructure.
+3. **Template variables** are expanded via substring replace before
+ execution. Scope: ``{{prev.output}}``, ``{{step_N.output}}``,
+ ``{{input.<key>}}`` — everything else stays literal.
+4. **Events** go to the bus (``WorkflowStarted``, ``WorkflowStepStarted``,
+ ``WorkflowStepCompleted``, ``WorkflowCompleted``). The UI listens for
+ these and renders live updates.
"""
from __future__ import annotations
@@ -50,7 +50,7 @@ _PREVIEW_MAX = 240
# ----------------------------------------------------------------------
-# Protokoll-Stubs fuer Dependency-Injection
+# Protocol stubs for dependency injection
# ----------------------------------------------------------------------
class _BrainLike(Protocol):
@@ -70,7 +70,7 @@ class _ToolExecutorLike(Protocol):
# ----------------------------------------------------------------------
class WorkflowRunner:
- """Executor fuer WorkflowDefs — eine Instanz pro App, viele parallele Runs."""
+ """Executor for WorkflowDefs — one instance per app, many parallel runs."""
def __init__(
self,
@@ -90,8 +90,8 @@ class WorkflowRunner:
self._executor = tool_executor
# ------------------------------------------------------------------
- # Dependency-Swap zur Laufzeit (der BrainManager wird erst nach dem
- # Workflow-Store gebaut; wir ueberschreiben ihn dann hot).
+ # Runtime dependency swap (the BrainManager is only built after the
+ # workflow store; we hot-swap it in afterward).
# ------------------------------------------------------------------
def attach_brain(self, brain: _BrainLike) -> None:
@@ -105,7 +105,7 @@ class WorkflowRunner:
self._executor = executor
# ------------------------------------------------------------------
- # Public-API
+ # Public API
# ------------------------------------------------------------------
async def trigger(
@@ -115,15 +115,15 @@ class WorkflowRunner:
trigger_reason: str = "manual",
input_data: dict[str, Any] | None = None,
) -> str:
- """Startet einen Workflow-Run fire-and-forget. Returnt die Run-ID.
+ """Starts a workflow run fire-and-forget. Returns the run ID.
- Der eigentliche Run laeuft als ``asyncio.create_task`` — Aufrufer
- (REST-Route, Cron-Scheduler) darf sofort weiterlaufen und den Run
- via ``run_id`` polled/Live-Event verfolgen.
+ The actual run runs as an ``asyncio.create_task`` — the caller
+ (REST route, cron scheduler) can continue immediately and track
+ the run via ``run_id`` polling/live events.
"""
wf = await self._store.get_def(workflow_id)
if wf is None:
- raise KeyError(f"Workflow {workflow_id} nicht gefunden")
+ raise KeyError(f"Workflow {workflow_id} not found")
run_id = await self._store.create_run(
workflow_id,
trigger=trigger_reason,
@@ -196,7 +196,7 @@ class WorkflowRunner:
)
success = False
error_msg = error_text
- log.warning("Workflow %s step %d fehlgeschlagen: %s",
+ log.warning("Workflow %s step %d failed: %s",
wf.name, idx, error_text)
break
@@ -233,7 +233,7 @@ class WorkflowRunner:
)
# ------------------------------------------------------------------
- # Step-Dispatch
+ # Step dispatch
# ------------------------------------------------------------------
async def _execute_step(
@@ -254,18 +254,18 @@ class WorkflowRunner:
return await self._run_shell_cmd(step, step_outputs, input_data)
if step.kind == "telegram_send":
return await self._run_telegram_send(step, step_outputs, input_data)
- raise RuntimeError(f"Unbekannter Step-Kind: {step.kind}")
+ raise RuntimeError(f"Unknown step kind: {step.kind}")
async def _run_brain_prompt(
self, step: Any, outputs: dict[str, str], input_data: dict[str, Any],
) -> str:
if self._brain is None:
raise RuntimeError(
- "Kein Brain verfuegbar — Workflow erfordert BrainManager"
+ "No brain available — workflow requires a BrainManager"
)
prompt = _expand_template(step.prompt, outputs, input_data)
reply = await _maybe_await_brain(self._brain, prompt)
- # Cap auf User-definiertes max_output_chars
+ # Cap at the user-defined max_output_chars
cap = getattr(step, "max_output_chars", 2000)
if len(reply) > cap:
reply = reply[:cap] + "…"
@@ -275,7 +275,7 @@ class WorkflowRunner:
self, step: Any, outputs: dict[str, str], input_data: dict[str, Any],
) -> str:
if self._harness is None:
- raise RuntimeError("Kein HarnessManager verfuegbar")
+ raise RuntimeError("No HarnessManager available")
from jarvis.core.protocols import HarnessTask
prompt = _expand_template(step.prompt, outputs, input_data)
@@ -320,7 +320,7 @@ class WorkflowRunner:
self, step: Any, outputs: dict[str, str], input_data: dict[str, Any],
) -> str:
if self._tools is None or self._executor is None:
- raise RuntimeError("Tool-Registry/Executor nicht verfuegbar")
+ raise RuntimeError("Tool registry/executor not available")
tool = None
try:
if step.tool_name in self._tools:
@@ -332,7 +332,7 @@ class WorkflowRunner:
if callable(getter):
tool = getter(step.tool_name)
if tool is None:
- raise KeyError(f"Tool '{step.tool_name}' nicht in Registry")
+ raise KeyError(f"Tool '{step.tool_name}' not in registry")
expanded_args: dict[str, Any] = {}
for k, v in (step.args or {}).items():
@@ -346,7 +346,7 @@ class WorkflowRunner:
)
success = bool(getattr(result, "success", False))
if not success:
- err = getattr(result, "error", None) or "tool call fehlgeschlagen"
+ err = getattr(result, "error", None) or "tool call failed"
raise RuntimeError(err)
payload = getattr(result, "output", None)
if payload is None:
@@ -358,30 +358,29 @@ class WorkflowRunner:
async def _run_shell_cmd(
self, step: Any, outputs: dict[str, str], input_data: dict[str, Any],
) -> str:
- """Startet einen Subprozess mit Timeout + Output-Cap.
+ """Starts a subprocess with a timeout + output cap.
- Design-Notiz: wir shell-splitten mit ``shlex.split`` und nutzen
- ``create_subprocess_exec`` (``shell=False``). Das heisst: Pipes/
- Redirects (``|``, ``>``) funktionieren nicht out-of-the-box — wer
- sie braucht, macht Cmd=``powershell -c "..."`` oder splittet in
- zwei shell_cmd-Steps mit Template-Variable.
+ Design note: we shell-split with ``shlex.split`` and use
+ ``create_subprocess_exec`` (``shell=False``). That means pipes/
+ redirects (``|``, ``>``) don't work out of the box — anyone who
+ needs them uses ``cmd=powershell -c "..."`` or splits into
+ two shell_cmd steps with a template variable.
"""
import shlex
cmd_expanded = _expand_template(step.command, outputs, input_data)
try:
- # posix=False damit Windows-Pfade mit Backslashes nicht als
- # Escape-Sequenz interpretiert werden. Nachteil: Quotes bleiben
- # als Token-Teil erhalten — wir stripen sie per Hand, damit
- # '"C:\\Program Files\\app.exe"' zu 'C:\\Program Files\\app.exe'
- # wird.
+ # posix=False so Windows paths with backslashes aren't
+ # interpreted as escape sequences. Downside: quotes stay
+ # part of the token — we strip them by hand, so
+ # '"C:\\Program Files\\app.exe"' becomes 'C:\\Program Files\\app.exe'.
argv = shlex.split(cmd_expanded, posix=False)
except ValueError as exc:
- raise RuntimeError(f"Shell-Command parsing failed: {exc}") from exc
+ raise RuntimeError(f"Shell command parsing failed: {exc}") from exc
argv = [a[1:-1] if len(a) >= 2 and a[0] == a[-1] and a[0] in ('"', "'")
else a for a in argv]
if not argv:
- raise RuntimeError("Leere Shell-Command")
+ raise RuntimeError("Empty shell command")
cwd = step.cwd or None
@@ -400,14 +399,14 @@ class WorkflowRunner:
with contextlib.suppress(ProcessLookupError):
proc.kill()
raise RuntimeError(
- f"Shell-Command Timeout nach {step.timeout_s}s: {cmd_expanded[:80]}"
+ f"Shell command timed out after {step.timeout_s}s: {cmd_expanded[:80]}"
) from exc
stdout = (stdout_b or b"").decode("utf-8", errors="replace")
stderr = (stderr_b or b"").decode("utf-8", errors="replace")
if proc.returncode != 0:
raise RuntimeError(
- f"Shell-Command exit_code={proc.returncode}: "
+ f"Shell command exit_code={proc.returncode}: "
f"{stderr[-400:] or stdout[-400:]}"
)
cap = step.max_output_chars
@@ -419,19 +418,19 @@ class WorkflowRunner:
async def _run_telegram_send(
self, step: Any, outputs: dict[str, str], input_data: dict[str, Any],
) -> str:
- """POST an Telegram-Bot-API. Token + Default-Chat-ID aus Config."""
+ """POST to the Telegram Bot API. Token + default chat ID come from config."""
from jarvis.core.config import get_secret, load_config
token = get_secret("telegram_bot_token", "TELEGRAM_BOT_TOKEN")
if not token:
raise RuntimeError(
- "Telegram-Bot-Token nicht gesetzt — "
- "ENV TELEGRAM_BOT_TOKEN oder Credential-Manager-Key "
- "'telegram_bot_token' konfigurieren. "
- "Bot via @BotFather erstellen."
+ "Telegram bot token not set — "
+ "configure ENV TELEGRAM_BOT_TOKEN or the credential manager "
+ "key 'telegram_bot_token'. "
+ "Create a bot via @BotFather."
)
- # Chat-ID: Step > Config > Fehler
+ # Chat ID: step > config > error
chat_id = step.chat_id.strip() if step.chat_id else ""
parse_mode = "Markdown"
if not chat_id:
@@ -443,13 +442,13 @@ class WorkflowRunner:
pass
if not chat_id:
raise RuntimeError(
- "Telegram-Chat-ID nicht gesetzt — entweder im Step als "
- "'chat_id' angeben oder '[integrations.telegram].chat_id' "
- "in jarvis.toml eintragen."
+ "Telegram chat ID not set — either specify 'chat_id' in "
+ "the step or set '[integrations.telegram].chat_id' "
+ "in jarvis.toml."
)
text = _expand_template(step.text, outputs, input_data)
- # Telegram-Max ist 4096 Zeichen — schneiden statt Fehler.
+ # Telegram max is 4096 characters — truncate instead of erroring.
if len(text) > 4096:
text = text[:4090] + "\n…"
@@ -467,10 +466,10 @@ class WorkflowRunner:
try:
r = await client.post(url, json=payload)
except Exception as exc: # noqa: BLE001
- raise RuntimeError(f"Telegram-Request fehlgeschlagen: {exc}") from exc
+ raise RuntimeError(f"Telegram request failed: {exc}") from exc
if r.status_code >= 400:
- # Telegram antwortet mit ``{"ok": false, "description": "..."}``
+ # Telegram responds with ``{"ok": false, "description": "..."}``
try:
detail = r.json().get("description") or r.text[:200]
except Exception: # noqa: BLE001
@@ -478,7 +477,7 @@ class WorkflowRunner:
raise RuntimeError(
f"Telegram HTTP {r.status_code}: {detail}"
)
- return f"gesendet an chat_id={chat_id} ({len(text)} Zeichen)"
+ return f"sent to chat_id={chat_id} ({len(text)} characters)"
# ----------------------------------------------------------------------
@@ -491,10 +490,10 @@ _TEMPLATE_RE = re.compile(r"\{\{\s*([^}]+?)\s*\}\}")
def _expand_template(
s: str, outputs: dict[str, str], input_data: dict[str, Any],
) -> str:
- """Expandiert ``{{prev.output}}`` / ``{{step_N.output}}`` / ``{{input.X}}``.
+ """Expands ``{{prev.output}}`` / ``{{step_N.output}}`` / ``{{input.X}}``.
- Unbekannte Platzhalter bleiben literal stehen — so merkt der User beim
- Debug schnell, wenn er einen Typo hat.
+ Unknown placeholders stay literal — so the user quickly notices
+ during debugging if they made a typo.
"""
def repl(m: re.Match[str]) -> str:
token = m.group(1).strip()
@@ -512,9 +511,9 @@ def _expand_template(
async def _maybe_await_brain(brain: Any, prompt: str) -> str:
- """Brain kann sein: callable(str) -> Awaitable[str], oder Objekt mit
- ``__call__``, oder respond(thread_id, text, store)-like. Wir probieren
- das Callable-Pattern (BrainManager) und faillen graceful.
+ """The brain can be: callable(str) -> Awaitable[str], or an object with
+ ``__call__``, or respond(thread_id, text, store)-like. We try the
+ callable pattern (BrainManager) and fail gracefully.
"""
if callable(brain):
try:
@@ -527,6 +526,6 @@ async def _maybe_await_brain(brain: Any, prompt: str) -> str:
except TypeError:
pass
raise RuntimeError(
- "Brain ist nicht direkt callable — nur BrainManager-kompatible "
- "Provider werden unterstuetzt"
+ "Brain is not directly callable — only BrainManager-compatible "
+ "providers are supported"
)
diff --git a/jarvis/workflows/scheduler.py b/jarvis/workflows/scheduler.py
index 3bf3296e7d..0d801f3fb9 100644
--- a/jarvis/workflows/scheduler.py
+++ b/jarvis/workflows/scheduler.py
@@ -1,14 +1,14 @@
-"""WorkflowScheduler — Cron-basierter Auto-Trigger.
+"""WorkflowScheduler — cron-based auto-trigger.
-Analog zu ``jarvis.tasks.scheduler``, aber mit echtem Cron via ``croniter``.
-Ein einziger ``asyncio``-Loop pollt die Workflow-Liste, berechnet das naechste
-``next_run_at_ns`` pro aktivem Cron-Workflow und schlaeft bis zum frueheste
-Termin. Beim Feuern: ``runner.trigger(workflow_id, trigger_reason="cron")``.
+Analogous to ``jarvis.tasks.scheduler``, but with real cron via ``croniter``.
+A single ``asyncio`` loop polls the workflow list, computes the next
+``next_run_at_ns`` for each active cron workflow, and sleeps until the
+earliest one. On firing: ``runner.trigger(workflow_id, trigger_reason="cron")``.
-Das ist bewusst nicht dieselbe Code-Pfad-Architektur wie Skills-Cron
-(``skills/trigger_matcher.run_cron_scheduler``) — Skills liefern einen
-``AsyncIterator`` den der Supervisor konsumiert; hier schiesst der Scheduler
-direkt auf den Runner.
+This is deliberately not the same code-path architecture as skills-cron
+(``skills/trigger_matcher.run_cron_scheduler``) — skills yield an
+``AsyncIterator`` that the supervisor consumes; here the scheduler fires
+directly at the runner.
"""
from __future__ import annotations
@@ -38,7 +38,7 @@ log = logging.getLogger(__name__)
class WorkflowScheduler:
- """Poll-Schleife — berechnet und feuert Cron-basierte Workflow-Runs."""
+ """Poll loop — computes and fires cron-based workflow runs."""
def __init__(
self,
@@ -55,7 +55,7 @@ class WorkflowScheduler:
# ------------------------------------------------------------------
def start(self) -> None:
- """Startet den Hintergrund-Loop. Idempotent."""
+ """Starts the background loop. Idempotent."""
if self._task is not None and not self._task.done():
return
self._stop.clear()
@@ -71,17 +71,17 @@ class WorkflowScheduler:
# ------------------------------------------------------------------
async def _loop(self) -> None:
- """Main-Loop — pollt, berechnet, schlaeft, triggert.
+ """Main loop — polls, computes, sleeps, triggers.
- Poll-Intervall: bei leerer Cron-Liste 60s, sonst bis zum naechsten
- faelligen Termin (mind. 1s, max 60s — damit neue Workflows via API
- binnen einer Minute aufgepickt werden).
+ Poll interval: 60s when the cron list is empty, otherwise until the
+ next due time (min 1s, max 60s — so new workflows added via the API
+ are picked up within a minute).
"""
while not self._stop.is_set():
try:
wait_s = await self._tick()
except Exception as exc: # noqa: BLE001
- log.exception("WorkflowScheduler-Tick crashed: %s", exc)
+ log.exception("WorkflowScheduler tick crashed: %s", exc)
wait_s = 30.0
try:
@@ -91,8 +91,8 @@ class WorkflowScheduler:
continue
async def _tick(self) -> float:
- """Ein Tick: naechstes Cron-Event berechnen, triggern wenn faellig,
- bis zum naechsten Termin schlafen (Rueckgabe in Sekunden).
+ """One tick: computes the next cron event, triggers when due,
+ sleeps until the next due time (returns in seconds).
"""
if not _HAVE_CRONITER:
return 60.0
@@ -134,11 +134,11 @@ class WorkflowScheduler:
if upcoming_min_ns is None or stored_next < upcoming_min_ns:
upcoming_min_ns = stored_next
- # Faellige Workflows triggern
+ # Trigger due workflows
for _due_ns, wid in due:
next_after = _compute_next_cron_ns(
_cron_expr_for(rows, wid),
- now_ns + 60_000_000_000, # mindestens 60s in Zukunft, um Drift
+ now_ns + 60_000_000_000, # at least 60s in the future, to avoid drift
)
await self._store.set_next_run(wid, next_after)
if next_after is not None:
@@ -155,7 +155,7 @@ class WorkflowScheduler:
try:
await self._runner.trigger(wid, trigger_reason="cron")
except Exception as exc: # noqa: BLE001
- log.warning("Cron-Trigger fuer %s fehlgeschlagen: %s", wid, exc)
+ log.warning("Cron trigger for %s failed: %s", wid, exc)
if upcoming_min_ns is None:
return 60.0
@@ -168,7 +168,7 @@ class WorkflowScheduler:
# ----------------------------------------------------------------------
def _compute_next_cron_ns(cron_expr: str, base_ns: int) -> int | None:
- """Naechste Fire-Time in ns oder None wenn Cron-Syntax kaputt."""
+ """Next fire time in ns, or None if the cron syntax is broken."""
if not _HAVE_CRONITER:
return None
try:
diff --git a/jarvis/workflows/schema.py b/jarvis/workflows/schema.py
index c977c269b0..88c8153c3a 100644
--- a/jarvis/workflows/schema.py
+++ b/jarvis/workflows/schema.py
@@ -1,25 +1,25 @@
-"""Pydantic-Schema fuer Workflows — Defs, Steps, Trigger, Runs.
-
-Sechs Step-Kinds — bewusst klein, damit Users klare Primitive komponieren
-koennen ohne Turing-complete Node-Editor:
-
-- ``brain_prompt`` → schickt ein Prompt an den aktiven BrainManager,
- schreibt die Antwort als ``output`` in den Run-Context.
-- ``harness_dispatch`` → dispatcht einen HarnessTask (OpenClaw, Codex,
- Computer-Use, MCP-Remote, Python-Script).
-- ``speak`` → emittiert ``AnnouncementRequested``-Event; die TTS-
- Pipeline hoert zu und spricht den Text. Ohne TTS: Event bleibt im Log.
-- ``tool_call`` → fuehrt ein Tool aus der ``tool_registry`` aus.
-- ``shell_cmd`` → fuehrt eine Shell-Command aus (``gws gmail +triage``,
- ``git status`` etc.). Captures stdout als Step-Output. Timeout + Output-Cap.
-- ``telegram_send`` → schickt eine Nachricht via Telegram-Bot-API.
- Bot-Token kommt aus dem Credential Manager (Key ``telegram_bot_token``),
- Chat-ID aus Step oder ``[integrations.telegram]``-Config.
-
-**Template-Variablen:** Jedes Step-Feld darf ``{{prev.output}}``,
-``{{step_N.output}}`` oder ``{{input.<key>}}`` enthalten — der Runner
-expandiert sie vor Execution. Kein Jinja (wuerde Risiko erhoehen),
-nur simpler Placeholder-Replace.
+"""Pydantic schema for workflows — defs, steps, trigger, runs.
+
+Six step kinds — deliberately small, so users can compose clear
+primitives without a Turing-complete node editor:
+
+- ``brain_prompt`` → sends a prompt to the active BrainManager,
+ writes the reply as ``output`` into the run context.
+- ``harness_dispatch`` → dispatches a HarnessTask (OpenClaw, Codex,
+ Computer-Use, MCP-Remote, Python script).
+- ``speak`` → emits an ``AnnouncementRequested`` event; the TTS
+ pipeline listens and speaks the text. Without TTS: the event stays in the log.
+- ``tool_call`` → executes a tool from the ``tool_registry``.
+- ``shell_cmd`` → runs a shell command (``gws gmail +triage``,
+ ``git status`` etc.). Captures stdout as the step output. Timeout + output cap.
+- ``telegram_send`` → sends a message via the Telegram Bot API.
+ The bot token comes from the credential manager (key ``telegram_bot_token``),
+ the chat ID from the step or the ``[integrations.telegram]`` config.
+
+**Template variables:** every step field may contain ``{{prev.output}}``,
+``{{step_N.output}}``, or ``{{input.<key>}}`` — the runner expands them
+before execution. No Jinja (would raise the risk), just a simple
+placeholder replace.
"""
from __future__ import annotations
@@ -34,25 +34,25 @@ from pydantic import BaseModel, ConfigDict, Field
# ---------------------------------------------------------------------
class ManualTrigger(BaseModel):
- """Workflow laeuft nur wenn User ``run`` klickt oder per API triggert."""
+ """Workflow only runs when the user clicks ``run`` or triggers it via the API."""
model_config = ConfigDict(frozen=True, extra="forbid")
type: Literal["manual"] = "manual"
class CronTrigger(BaseModel):
- """Cron-Expression (5 Felder, Standard-Syntax). Nutzt ``croniter``.
+ """Cron expression (5 fields, standard syntax). Uses ``croniter``.
- Beispiele:
- ``30 7 * * *`` — taeglich 07:30
- ``0 */2 * * *`` — alle 2 Stunden
- ``0 9 * * 1-5`` — Werktags 09:00
+ Examples:
+ ``30 7 * * *`` — daily at 07:30
+ ``0 */2 * * *`` — every 2 hours
+ ``0 9 * * 1-5`` — weekdays at 09:00
"""
model_config = ConfigDict(frozen=True, extra="forbid")
type: Literal["cron"] = "cron"
expression: str = Field(min_length=9, max_length=128,
- description="Cron-Ausdruck mit 5 Feldern.")
+ description="Cron expression with 5 fields.")
timezone: str = Field(default="local",
- description="'local' oder IANA-Zone (z.B. 'Europe/Berlin').")
+ description="'local' or an IANA zone (e.g. 'Europe/Berlin').")
WorkflowTrigger = Annotated[
@@ -66,11 +66,10 @@ WorkflowTrigger = Annotated[
# ---------------------------------------------------------------------
class BrainPromptStep(BaseModel):
- """Schickt ein Prompt an den aktiven BrainManager.
+ """Sends a prompt to the active BrainManager.
- Der Runner schreibt die Antwort in ``run.outputs[step_id]``. Nachfolgende
- Steps koennen darauf via ``{{prev.output}}`` oder ``{{step_1.output}}``
- zugreifen.
+ The runner writes the reply into ``run.outputs[step_id]``. Subsequent
+ steps can access it via ``{{prev.output}}`` or ``{{step_1.output}}``.
"""
model_config = ConfigDict(frozen=True, extra="forbid")
kind: Literal["brain_prompt"] = "brain_prompt"
@@ -80,10 +79,10 @@ class BrainPromptStep(BaseModel):
class HarnessDispatchStep(BaseModel):
- """Dispatcht an einen Harness (openclaw, codex, computer-use, ...).
+ """Dispatches to a harness (openclaw, codex, computer-use, ...).
- Ergebnis ist ``stdout`` der finalen Runde; wird als ``output`` im
- Run-Context gespeichert.
+ The result is the ``stdout`` of the final round; stored as ``output``
+ in the run context.
"""
model_config = ConfigDict(frozen=True, extra="forbid")
kind: Literal["harness_dispatch"] = "harness_dispatch"
@@ -94,10 +93,10 @@ class HarnessDispatchStep(BaseModel):
class SpeakStep(BaseModel):
- """Emittiert einen ``AnnouncementRequested``-Event.
+ """Emits an ``AnnouncementRequested`` event.
- Wenn die TTS-Pipeline laeuft, wird der Text gesprochen. Sonst
- bleibt das Event im Flight-Recorder und der Step gilt als erfolgreich.
+ If the TTS pipeline is running, the text is spoken. Otherwise
+ the event stays in the flight recorder and the step counts as successful.
"""
model_config = ConfigDict(frozen=True, extra="forbid")
kind: Literal["speak"] = "speak"
@@ -108,7 +107,7 @@ class SpeakStep(BaseModel):
class ToolCallStep(BaseModel):
- """Fuehrt einen Tool-Aufruf auf der Tool-Registry aus (Risk-Tier-konform)."""
+ """Executes a tool call against the tool registry (risk-tier compliant)."""
model_config = ConfigDict(frozen=True, extra="forbid")
kind: Literal["tool_call"] = "tool_call"
label: str = Field(default="", max_length=128)
@@ -117,39 +116,39 @@ class ToolCallStep(BaseModel):
class ShellCmdStep(BaseModel):
- """Fuehrt eine Shell-Command-Line aus. stdout wird als Step-Output
- persistiert, stderr in ``error`` wenn exit_code != 0.
+ """Executes a shell command line. stdout is persisted as the step
+ output, stderr in ``error`` when exit_code != 0.
- **Sicherheits-Hinweis:** Dieser Step-Typ ist maechtig — User, die fremde
- Workflows importieren, sollten ``command`` vor Aktivierung pruefen. Wir
- fuehren ``shell=False``, d.h. keine Pipe/Redirect-Unterstuetzung; fuer
- komplexere Pipelines mehrere shell_cmd-Steps hintereinander nutzen.
+ **Security note:** this step type is powerful — users who import
+ third-party workflows should review ``command`` before activation. We
+ run with ``shell=False``, i.e. no pipe/redirect support; for more
+ complex pipelines, chain multiple shell_cmd steps.
"""
model_config = ConfigDict(frozen=True, extra="forbid")
kind: Literal["shell_cmd"] = "shell_cmd"
label: str = Field(default="", max_length=128)
command: str = Field(min_length=1, max_length=4096,
- description="Kommando-Zeile; whitespace-split zu argv.")
+ description="Command line; whitespace-split into argv.")
cwd: str = Field(default="", max_length=512,
- description="Working-Directory, leer = App-Verzeichnis.")
+ description="Working directory, empty = app directory.")
timeout_s: float = Field(default=60.0, ge=1.0, le=900.0)
max_output_chars: int = Field(default=8000, ge=200, le=200_000)
class TelegramSendStep(BaseModel):
- """Sendet eine Telegram-Nachricht via Bot-API.
+ """Sends a Telegram message via the Bot API.
- Bot-Token kommt aus dem Credential Manager; Chat-ID aus diesem Step
- (hat Vorrang) oder ``[integrations.telegram].chat_id`` in der Config.
+ The bot token comes from the credential manager; the chat ID from this
+ step (takes precedence) or ``[integrations.telegram].chat_id`` in the config.
"""
model_config = ConfigDict(frozen=True, extra="forbid")
kind: Literal["telegram_send"] = "telegram_send"
label: str = Field(default="", max_length=128)
text: str = Field(min_length=1, max_length=4096,
- description="Nachrichten-Text; supports Markdown/HTML "
- "je nach parse_mode der Config.")
+ description="Message text; supports Markdown/HTML "
+ "depending on the config's parse_mode.")
chat_id: str = Field(default="", max_length=64,
- description="Leer = Default-Chat aus Config.")
+ description="Empty = default chat from config.")
WorkflowStep = Annotated[
@@ -164,7 +163,7 @@ WorkflowStep = Annotated[
# ---------------------------------------------------------------------
class WorkflowDef(BaseModel):
- """Die Blaupause eines Workflows. Persistiert in Tabelle ``workflows``."""
+ """The blueprint of a workflow. Persisted in the ``workflows`` table."""
model_config = ConfigDict(frozen=True, extra="forbid")
id: UUID = Field(default_factory=uuid4)
@@ -179,18 +178,18 @@ class WorkflowDef(BaseModel):
WorkflowRunState = Literal[
- "pending", # gerade angelegt, noch nicht gestartet
- "running", # Steps werden abgearbeitet
- "completed", # alle Steps erfolgreich
- "failed", # ein Step hat ge-raised
- "cancelled", # manuell abgebrochen
+ "pending", # just created, not started yet
+ "running", # steps are being processed
+ "completed", # all steps succeeded
+ "failed", # a step raised
+ "cancelled", # manually cancelled
]
class WorkflowRun(BaseModel):
- """Ein konkreter Lauf eines WorkflowDef. Persistiert in ``workflow_runs``.
+ """A concrete run of a WorkflowDef. Persisted in ``workflow_runs``.
- Steps-Fortschritt steht in ``workflow_run_steps``; hier nur Aggregat.
+ Step progress lives in ``workflow_run_steps``; this holds only the aggregate.
"""
model_config = ConfigDict(frozen=True, extra="forbid")
@@ -201,16 +200,16 @@ class WorkflowRun(BaseModel):
started_at_ns: int = 0
finished_at_ns: int = 0
error: str | None = None
- input_json: str = "{}" # User-Input beim Trigger (fuer {{input.X}}-Expansion)
+ input_json: str = "{}" # user input at trigger time (for {{input.X}} expansion)
# ---------------------------------------------------------------------
-# Utility — Step-Preview-Label
+# Utility — step preview label
# ---------------------------------------------------------------------
def step_display_label(step: WorkflowStep) -> str:
- """Gibt einen Display-Label fuer UI-Timelines zurueck — expliziter Label
- schlaegt generischer Kind-Beschreibung.
+ """Returns a display label for UI timelines — an explicit label
+ beats a generic kind description.
"""
if step.label:
return step.label
@@ -219,7 +218,7 @@ def step_display_label(step: WorkflowStep) -> str:
if step.kind == "harness_dispatch":
return f"{step.harness}: {step.prompt[:60]}..."
if step.kind == "speak":
- return f"Sprich: {step.text[:60]}..."
+ return f"Speak: {step.text[:60]}..."
if step.kind == "tool_call":
return f"Tool: {step.tool_name}"
if step.kind == "shell_cmd":