daemon/cadence.bend checks
raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/cadence.bend as Cadence
1 import
import Base
Types
type Outcome source · line 9 · raw
Data
SwitchedOutcome
NoActionOutcome
BlockedOutcome
FailedOutcome
type Info source · line 18 · raw
Data
What the tick tells the sleeper: when the soonest reset is (all exhausted), whether waiting a long time is right (no candidates), whether the active token is expired on an idle Claude Code, and the active row's next poll.
Info@outcome:Outcome -> @sleep_until:Maybe<&2, U32> -> @blocked_long:Bool -> @idle_slow:Bool -> @next_poll_at:Maybe<&2, U32> -> Info
Definitions
def exit_code source · line 21 · raw
@o:Outcome -> U32
def no_reset_fallback source · line 32 · raw
U32
def max_sleep source · line 35 · raw
U32
def urgent source · line 38 · raw
U32
def sel source · line 41 · raw
@+c:Bool -> @+x:U32 -> @+y:U32 -> U32
def max_u source · line 48 · raw
@+a:U32 -> @+b:U32 -> U32
def min_u source · line 51 · raw
@+a:U32 -> @+b:U32 -> U32
def since source · line 55 · raw
@+a:U32 -> @+b:U32 -> U32
a - b, 0 when b is later.
def respect_plan source · line 59 · raw
@+next_poll:Maybe<&2, U32> -> @+now:U32 -> @+delay:U32 -> U32
Shorten a normal sleep to the active row's own next poll, never under 60 s.
def blocked_delay source · line 66 · raw
@+until:Maybe<&2, U32> -> @+long:Bool -> @+now:U32 -> @+interval:U32 -> @+normal:U32 -> U32
def next_delay2 source · line 73 · raw
@o:Outcome -> @info:Info -> @+now:U32 -> @+interval:U32 -> U32
def next_delay source · line 82 · raw
@info:Info -> @+now:U32 -> @+interval:U32 -> U32
def announce source · line 88 · raw
@+delay:U32 -> @+interval:U32 -> Bool
A sleep event is emitted only when the delay is over 1.5 intervals.