Skip to main content

Module usage_limit

Module usage_limit 

Source
Expand description

Usage-limit detection shared by every tool’s result metadata

Ported from Hive Mind src/usage-limit.lib.mjs and src/claude.usage-limit-sources.lib.mjs (hive-mind#1122, #1290, #1869, #1924, #1935, #2687, #3570). Reset times are normalized to the shapes Hive Mind’s parseResetTime accepts (MMM D, YYYY, h:mm A, MMM D, h:mm A, h:mm A) so the value can be handed straight back to it.

Structs§

DebugLines
ANTHROPIC_LOG=debug output: which lines are debug dumps, and the 429 verdict
UsageLimitVerdict
Usage-limit verdict for one run

Functions§

classify_debug_lines
Read ANTHROPIC_LOG=debug output lines (hive-mind#3570)
classify_rate_limit_event
Classify a Claude rate_limit_event.rate_limit_info (hive-mind#3570)
detect_usage_limit_sources
Detect a usage limit from every source a run leaves behind
extract_reset_time
Extract a reset time, normalized like Hive Mind’s extractResetTime
extract_timezone
Extract the reset timezone ("(Europe/Berlin)", "(UTC)", "18:30 UTC")
format_epoch_reset_time_utc
Format an epoch (seconds) as MMM D, YYYY, h:mm A in UTC
is_recoverable_tool_error
A failed tool call is a tool result the model recovers from (hive-mind#3213)
is_usage_limit_text
Whether text reports an account usage limit (not a transient throttle)
limit_scan_text
Text to scan for usage limits: plain lines stay raw, JSON records become their string values (one per line), and tool output is left out.
split_output
Split raw output into JSON records and the remaining text lines