Skip to main content

Module common

Module common 

Source
Expand description

Shared utilities used by both PTY runtime and SDK runtime.

Structs§

QueuedMessage
TestFailureFollowup

Constants§

MAX_QUEUE_DEPTH
Maximum number of messages that can be queued while the agent is working.
SESSION_STATS_INTERVAL_SECS
How often to report session stats (secs).
TEST_FAILURE_MAX_ITERATIONS
Maximum number of automatic fix-and-retest loops before escalation.

Functions§

detect_context_approaching_limit
Check if text contains signals that the context window is under pressure but not yet fully exhausted. Returns true for early-warning patterns (e.g. automatic compression notifications from Claude).
detect_context_exhausted
Check if text contains known context exhaustion phrases (hard failure).
detect_test_failure
Check if text looks like a real test runner failure instead of a prose mention.
detect_test_failure_followup
drain_queue_errors
Drain all queued messages, emitting an Error event for each one. Used when the agent enters a terminal state (Dead, ContextExhausted).
format_injected_message
reply_target_for