daemon/freshen.bend relies on unsafe/foreign
raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/freshen.bend as Freshen
9 imports
import Base import ../json.bend as Json import ../act.bend as Act import ../store/io.bend as SIo import ../store/base.bend as SBase import ../usage/cred.bend as UCred import ../usage/gate.bend as UGate import ./sess.bend as Sess import ./identity.bend as Id
Definitions
def ActM source · line 14 · raw
@-A:Type -> Type
def ActM.pure source · line 17 · raw
@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def ActM.bind source · line 20 · raw
@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)
def hex_of source · line 25 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> String
def sha256 source · line 33 · raw
@+text:String -> IO(String)
Hex sha256 of a text, through shasum(1) with the text on stdin (never argv).
def tagged source · line 36 · raw
@+tag:String -> @+h:String -> String
def hashed source · line 39 · raw
@+tag:String -> @+text:String -> IO(String)
def fp_pick source · line 42 · raw
@+rt:Maybe<&2, String> -> @+creds:String -> IO(String)
def fp_nonempty source · line 49 · raw
@+empty:Bool -> @+creds:String -> IO(String)
def fingerprint source · line 60 · raw
@+creds:String -> IO(String)
oauth.credential_fingerprint: the refresh token's hash, else the whole credential's. "" for an empty credential.
def has_oauth source · line 63 · raw
@+o:0x0717344745a30ebad1f19045228e8f18/json.Json -> Bool
def rank2 source · line 70 · raw
@+a:Bool -> @+b:Bool -> @+c:Bool -> @+d:Bool -> U32
def systemic_rank source · line 85 · raw
@+s:String -> U32
The deterministic refusals every candidate hits identically (autoswitch.py _SYSTEMIC_MESSAGES), most actionable first.
def transient_or_systemic source · line 88 · raw
@+plain:Bool -> @+e:String -> String
def kind_of source · line 95 · raw
@+dead:Bool -> @+e:String -> String
def refresh_status source · line 102 · raw
@+error:Maybe<&2, String> -> String
def judged_grant source · line 109 · raw
@+error:Maybe<&2, String> -> @+root:String -> @+slot:String -> @+acct:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def after_refresh source · line 117 · raw
@g:0x0717344745a30ebad1f19045228e8f18/usage/gate.Gated -> @+root:String -> @+slot:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
"ok", "invalid_grant" (a dead credential: quarantine it) or "transient".
def refresh_now source · line 122 · raw
@+root:String -> @+slot:String -> @+email:String -> @+creds:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def check2 source · line 127 · raw
@+oauth:Bool -> @+near:Bool -> @+root:String -> @+slot:String -> @+email:String -> @+creds:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def check source · line 136 · raw
@+root:String -> @+slot:String -> @+email:String -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def judge2 source · line 139 · raw
@+empty:Bool -> @+root:String -> @+slot:String -> @+email:String -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def judge source · line 146 · raw
@+root:String -> @+slot:String -> @+email:String -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def judge4 source · line 151 · raw
@+live:Bool -> @+root:String -> @+slot:String -> @+email:String -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
Ensure a candidate's stored token outlives Claude Code's next minutes: a credential within 10 minutes of expiry is refreshed under its consume lock.
def judge5 source · line 155 · raw
@+root:String -> @+slot:String -> @+email:String -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
A Claude session consuming this account owns its token: the daemon leaves it.
def judge3 source · line 160 · raw
@+api:Bool -> @+root:String -> @+slot:String -> @+email:String -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
def status source · line 166 · raw
@+root:String -> @+slot:String -> @+email:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)
Ensure a candidate's stored token outlives Claude Code's next minutes: a credential within 10 minutes of expiry is refreshed under its consume lock. An API key never expires.