~/bend-docscommunity

daemon/view.bend relies on unsafe/foreign

raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/view.bend as View

15 imports
import Base
import ../json.bend as Json
import ../store.bend as Store
import ../store/base.bend as SBase
import ../store/seq.bend as SSeq
import ../usage.bend as Usage
import ../usage/cred.bend as UCred
import ../policy/types.bend as T
import ../policy/usage.bend as PU
import ../policy/rank.bend as PR
import ./rows.bend as Rows
import ./events.bend as Ev
import ./config.bend as Cfg
import ./gather.bend as G
import ./state.bend as St

Definitions

def nat source · line 20 · raw

@+n:U32 -> Nat

def strategy2 source · line 23 · raw

@+cf:Bool -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Strategy

def strategy_of source · line 30 · raw

@+s:String -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Strategy

def pol_cfg source · line 34 · raw

@+c:0x0717344745a30ebad1f19045228e8f18/daemon/config.Cfg -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Config

serve TTL 180 s; the rest is the settings.

def sel_mt source · line 41 · raw

@+c:Bool -> @+x:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger> -> @+y:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger> -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger>

def trigger_of source · line 48 · raw

@+s:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Trigger>

def num_nat source · line 54 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Maybe<&2, Nat>

def centi_nat source · line 57 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Maybe<&2, Nat>

def slot_nat source · line 60 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Maybe<&2, Nat>

def snap2 source · line 63 · raw

@+tr:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+st:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Snap

def snap_of source · line 70 · raw

@+st:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Snap

def state_of source · line 73 · raw

@+st:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/policy/types.State

def accounts_of source · line 78 · raw

@+es:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account>

def oauth_of source · line 85 · raw

@+creds:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def sel_sn source · line 88 · raw

@+c:Bool -> @+x:0x0717344745a30ebad1f19045228e8f18/policy/types.Sentinel -> @+y:0x0717344745a30ebad1f19045228e8f18/policy/types.Sentinel -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Sentinel

def sent2 source · line 95 · raw

@+is_active:Bool -> @+has:Bool -> @+api:Bool -> @+creds:String -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Sentinel

def sentinel_of source · line 106 · raw

@+is_active:Bool -> @+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Sentinel

The overlay that hides a row: an expired token on the active account (idle Claude Code), or an account with no usable credential or no quota to read.

def row_guard source · line 111 · raw

@+row:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+email:String -> @+org:String -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def row_of source · line 114 · raw

@+rows:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def is_slot source · line 119 · raw

@+active:Maybe<&2, String> -> @+slot:String -> Bool

def usage_one source · line 126 · raw

@+rows:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> @+active:Maybe<&2, String> -> @+now:U32 -> 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage

def usages_of source · line 131 · raw

@+rows:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+es:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> @+active:Maybe<&2, String> -> @+now:U32 -> List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage>

def sel_mu source · line 138 · raw

@+c:Bool -> @+x:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+y:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage>

def usage_pick source · line 145 · raw

@+u:0x0717344745a30ebad1f19045228e8f18/policy/types.Usage -> @+slot:Nat -> @+rest:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage>

def usage_for source · line 150 · raw

@+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+slot:Nat -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage>

def sel_me source · line 157 · raw

@+c:Bool -> @+x:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> @+y:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent>

def ent_pick source · line 164 · raw

@+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> @+slot:String -> @+rest:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent>

def ent_for source · line 169 · raw

@+es:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> @+slot:String -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent>

def email2 source · line 176 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> String

def email_of source · line 185 · raw

@+es:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> @+slot:String -> String

def scoped_keep source · line 188 · raw

@+hit:Bool -> @+w:0x0717344745a30ebad1f19045228e8f18/daemon/events.Win -> @+rest:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win>

def scoped_wins source · line 195 · raw

@+ss:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Scoped> -> @+ms:List<&2, String> -> @+now:Nat -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win>

def opt_win source · line 202 · raw

@+name:String -> @+m:Maybe<&2, Nat> -> @+rest:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win>

def win_rows source · line 209 · raw

@+u:0x0717344745a30ebad1f19045228e8f18/policy/types.Usage -> @+ms:List<&2, String> -> @+now:Nat -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win>

def head_u32 source · line 214 · raw

@+m:Maybe<&2, Nat> -> Maybe<&2, U32>

def err_text source · line 221 · raw

@+row:0x0717344745a30ebad1f19045228e8f18/json.Json -> Maybe<&2, String>

def sel_wl source · line 224 · raw

@+c:Bool -> @+x:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win> -> @+y:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Win>

def poll_row2 source · line 231 · raw

@+slot:String -> @+trusted:Bool -> @+u:0x0717344745a30ebad1f19045228e8f18/policy/types.Usage -> @+err:Maybe<&2, String> -> @+ms:List<&2, String> -> @+now:Nat -> 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row

def poll_row source · line 236 · raw

@+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> @+u:0x0717344745a30ebad1f19045228e8f18/policy/types.Usage -> @+rows:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ms:List<&2, String> -> @+now:Nat -> 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row

One poll row: windows only for a trusted reading; the error only when the usage is unknown.

def row_opt source · line 241 · raw

@+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> @+u:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+rows:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ms:List<&2, String> -> @+now:Nat -> Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row>

def push_row source · line 248 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row> -> @+rest:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row> -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row>

def ent_slot source · line 255 · raw

@+e:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent -> String

def poll_rows source · line 260 · raw

@+es:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> @+us:List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Usage> -> @+rows:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ms:List<&2, String> -> @+now:Nat -> List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/events.Row>

def slot_nat_of source · line 267 · raw

@+s:String -> Nat

def ref_json source · line 271 · raw

@+slot:String -> @+es:List<&2, 0x0717344745a30ebad1f19045228e8f18/daemon/gather.Ent> -> 0x0717344745a30ebad1f19045228e8f18/json.Json

{"number": N, "email": ...} for a slot of the roster.

def opt_json source · line 274 · raw

@+m:Maybe<&2, String> -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def snap_accounts source · line 281 · raw

@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> List<&2, 0x0717344745a30ebad1f19045228e8f18/policy/types.Account>

def snap_state source · line 284 · raw

@+s:0x0717344745a30ebad1f19045228e8f18/daemon/gather.Snap -> 0x0717344745a30ebad1f19045228e8f18/policy/types.State