Expand description
Shared utilities used by both PTY runtime and SDK runtime.
Structs§
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