daemon/sess.bend checks
raw source on the hub · import cswap-bend-cli@0.1.0.0/daemon/sess.bend as Sess
4 imports
import Base import ../json.bend as Json import ../fs.bend as Fs import ../act.bend as Act
Definitions
def ActM source · line 13 · raw
@-A:Type -> Type
def ActM.pure source · line 16 · raw
@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)
def ActM.bind source · line 19 · raw
@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)
def keep_char source · line 24 · raw
@+n:U32 -> Bool
def pick_char source · line 27 · raw
@+k:Bool -> @+c:Char -> Char
def slug_char source · line 34 · raw
@+c:Char -> Char
def slug_list source · line 37 · raw
@+cs:List<&2, Char> -> List<&2, Char>
def slugify source · line 45 · raw
@+email:String -> String
session.slugify_email (ASCII addresses; a non-ASCII character becomes _).
def dir_of source · line 48 · raw
@+root:String -> @+slot:String -> @+email:String -> String
def ps_some source · line 53 · raw
@+empty:Bool -> @+t:String -> Maybe<&2, String>
def ps_nonempty source · line 60 · raw
@+ok:Bool -> @+t:String -> Maybe<&2, String>
def ps_text source · line 67 · raw
@r:Result<&1, &1, Pair(U32, String), Pair(U32, Pair(String, String))> -> Maybe<&2, String>
def ps source · line 75 · raw
@+cols:String -> @+pid:U32 -> IO(Maybe<&2, String>)
ps -o COLS= -p PID under LC_ALL=C TZ=UTC; None when unknowable.
def month_hit source · line 80 · raw
@+hit:Bool -> @+i:U32 -> @+rest:Maybe<&2, U32> -> Maybe<&2, U32>
def month_from source · line 87 · raw
@+ms:List<&2, String> -> @+m:String -> @+i:U32 -> Maybe<&2, U32>
def month_idx source · line 94 · raw
@+m:String -> Maybe<&2, U32>
def word_keep source · line 97 · raw
@+empty:Bool -> @+h:String -> @+rest:List<&2, String> -> List<&2, String>
def words source · line 104 · raw
@+ws:List<&2, String> -> List<&2, String>
def sel_u source · line 111 · raw
@+c:Bool -> @+x:U32 -> @+y:U32 -> U32
def days5 source · line 118 · raw
@+a:U32 -> @+b:U32 -> @+doy:U32 -> U32
def days4 source · line 121 · raw
@+era:U32 -> @+yoe:U32 -> @+doy:U32 -> U32
def days3 source · line 124 · raw
@+era:U32 -> @+yoe:U32 -> @+dm1:U32 -> @+mp:U32 -> U32
def days2 source · line 127 · raw
@+yy:U32 -> @+m:U32 -> @+d:U32 -> U32
def days_civil source · line 131 · raw
@+y:U32 -> @+m:U32 -> @+d:U32 -> U32
days since 1970-01-01 of a civil date (years from 1970 on).
def num source · line 134 · raw
@+s:String -> U32
def clock_secs source · line 137 · raw
@+ps:List<&2, String> -> Maybe<&2, U32>
def lstart_ok source · line 144 · raw
@+ok:Bool -> @+y:U32 -> @+m:U32 -> @+d:U32 -> @+c:U32 -> Maybe<&2, U32>
def lstart_fields source · line 153 · raw
@+m:Maybe<&2, U32> -> @+d:Maybe<&2, U32> -> @+c:Maybe<&2, U32> -> @+y:Maybe<&2, U32> -> Maybe<&2, U32>
def lstart_dy source · line 160 · raw
@+m:Maybe<&2, U32> -> @+ws:List<&2, String> -> Maybe<&2, U32>
def lstart_dmy source · line 167 · raw
@+ws:List<&2, String> -> Maybe<&2, U32>
def lstart_of source · line 174 · raw
@+ws:List<&2, String> -> Maybe<&2, U32>
def lstart_secs source · line 181 · raw
@+text:String -> Maybe<&2, U32>
def all_digits source · line 184 · raw
@+cs:List<&2, Char> -> Bool
def is_ticks source · line 191 · raw
@+t:String -> Bool
def nth_hit source · line 194 · raw
@+hit:Bool -> @+h:String -> @+rest:Maybe<&2, String> -> Maybe<&2, String>
def nth_word source · line 202 · raw
@+ws:List<&2, String> -> @+n:U32 -> Maybe<&2, String>
Field 22 of /proc/<pid>/stat (counted from the last )), the Linux stamp.
def last_part source · line 209 · raw
@+ps:List<&2, String> -> @+d:String -> String
def stat_ticks source · line 216 · raw
@+text:String -> Maybe<&2, String>
def ticks_match source · line 219 · raw
@+want:String -> @+m:Maybe<&2, String> -> Bool
def stat_text source · line 226 · raw
@r:0x0717344745a30ebad1f19045228e8f18/fs.Res(String) -> Maybe<&2, String>
def matches_ticks source · line 233 · raw
@+pid:U32 -> @+want:String -> IO(Bool)
def looks_claude source · line 236 · raw
@+m:Maybe<&2, String> -> Bool
def stranger2 source · line 243 · raw
@+recent:Bool -> @+pid:U32 -> IO(Bool)
def stranger source · line 251 · raw
@+recorded:U32 -> @+started:Maybe<&2, U32> -> @+pid:U32 -> IO(Bool)
Only a stranger that started later than the record's claude disqualifies it.
def started_of source · line 258 · raw
@+m:Maybe<&2, String> -> Maybe<&2, U32>
def by_lstart source · line 265 · raw
@+pid:U32 -> @+rec:Maybe<&2, U32> -> IO(Bool)
def stamped2 source · line 272 · raw
@+ticks:Bool -> @+pid:U32 -> @+stamp:String -> IO(Bool)
def stamped source · line 279 · raw
@+pid:U32 -> @+stamp:String -> IO(Bool)
def with_stamp source · line 282 · raw
@+pid:U32 -> @+m:Maybe<&2, String> -> IO(Bool)
def alive_then source · line 289 · raw
@+up:Bool -> @+pid:U32 -> @+stamp:Maybe<&2, String> -> IO(Bool)
def pid_live source · line 296 · raw
@+pid:U32 -> @+stamp:Maybe<&2, String> -> IO(Bool)
def stamp_of source · line 301 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> Maybe<&2, String>
def pid_of source · line 304 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> Maybe<&2, U32>
def pid_live_gt1 source · line 307 · raw
@+ok:Bool -> @+p:U32 -> @+stamp:Maybe<&2, String> -> IO(Bool)
def record_live2 source · line 314 · raw
@+pid:Maybe<&2, U32> -> @+stamp:Maybe<&2, String> -> IO(Bool)
def record_live source · line 321 · raw
@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> IO(Bool)
def file_live source · line 328 · raw
@r:0x0717344745a30ebad1f19045228e8f18/fs.Res(String) -> IO(Bool)
def any_live source · line 337 · raw
@+dir:String -> @+names:List<&2, String> -> IO(Bool)
def rest_live source · line 344 · raw
@+hit:Bool -> @+dir:String -> @+t:List<&2, String> -> IO(Bool)
def json_keep source · line 351 · raw
@+ok:Bool -> @+h:String -> @+rest:List<&2, String> -> List<&2, String>
def json_names source · line 358 · raw
@+ns:List<&2, String> -> List<&2, String>
def scan source · line 365 · raw
@+dir:String -> @r:0x0717344745a30ebad1f19045228e8f18/fs.Res(List<&2, String>) -> IO(Bool)
def live source · line 373 · raw
@+root:String -> @+slot:String -> @+email:String -> IO(Bool)
Is a Claude session live against this slot's session profile?