core / event_stream / event¶
core.event_stream.event
¶
core.event_stream.event
Lightweight, LLM-friendly event object in event stream.
Event = { message: str, kind: str, severity: str } - We also track ts and repeat_count internally, but we do not require callers to pass them; they're attached automatically.
Event types
Action lifecycle: start/end (duration, status, inputs/outputs summaries, not raw blobs)
Router decisions: chosen action and contenders (top-k) with scores (tiny)
Mode changes: GUI/CLI/BROWSER; window focus; viewport change
Task: plan created/updated, step advanced/failed, backtracking
Triggers: created/fired/cancelled (time, reason)
RAG: retrieved N docs, sources/types, tokens used (no full text)
Retries/backoff: reason, attempt count, policy used
Anomalies: duplicate actions back-to-back, rapid oscillation, long stalls
Resource/metrics: token usage per turn, workspace usage deltas, time spent
Security/policy: redactions, blocked actions
Notes: freeform observations the agent wants the LLM to “remember” in context
Event
dataclass
¶
Public event object with prompt context and display variants.
Source code in core\event_stream\event.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
iso_ts
property
¶
Convenience ISO-8601 string (UTC, seconds precision).
display_text()
¶
Provide a concise message for TUI display without altering the underlying event.
The display text mirrors display_message if one was supplied during
logging, allowing callers to present a friendlier or truncated value in
dashboards while keeping the original message intact for summaries
and debugging.
Returns:
| Type | Description |
|---|---|
str
|
The display-specific message set on the event, or |
str
|
event should fall back to the full |
Source code in core\event_stream\event.py
44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
EventRecord
dataclass
¶
Internal record with timing & dedupe info (not exposed externally).
Source code in core\event_stream\event.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |