code wiki / _hdl_build / nx_connect_presence.nx
nx_connect_presence.nx
buildroot/runtime/_hdl_build/nx_connect_presence.nx
about
nx_connect_presence.nx -- CONNECT: typing indicator + online presence + scheduled/silent send.
Closes two MSG cells of nx_connect_func_census (typing+presence; scheduled/silent send).
BY CONSTRUCTION properties:
- the typing signal is a {conv,user,expiry} triple ONLY -- no draft-text field exists in the
schema, and it EXPIRES (ephemeral): presence never becomes a stale lie. NEG-CONTROL: a sticky
no-TTL incumbent model still claims "typing" an hour later; ours has expired.
- last-seen privacy is the USER's setting: a coarse-mode profile renders only a "recently"
bucket, never the exact timestamp (data minimization at render time).
- scheduled send delivers exactly AT/after the due tick, never early; SILENT send delivers with
ZERO notification events (Telegram-class silent send); the delivery tick is IDEMPOTENT
(rule 10: a re-run tick cannot double-send).
Times are passed in (deterministic, no clock). 100% sovereign. license_tier: ORIGINAL expect_exit: 0
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const PR_MAGIC_4600: i64 = 4600 |
| 15 | const PR_MAGIC_2000: i64 = 2000 |
| 16 | const PR_MAGIC_1999: i64 = 1999 |
| 17 | const PR_MAGIC_2100: i64 = 2100 |
| 19 | const PR_MAX: i64 = 16 |
| 20 | const TY_MAX: i64 = 32 |
| 21 | const SC_MAX: i64 = 16 |
| 22 | const TY_TTL: i64 = 5 |
| 24 | const CX_PRU: i64 = 0 |
| 25 | const CX_PRST: i64 = 1 |
| 26 | const CX_PRLAST: i64 = 2 |
| 27 | const CX_PRCOARSE: i64 = 3 |
| 28 | const CX_NPR: i64 = 4 |
| 29 | const CX_TYC: i64 = 5 |
| 30 | const CX_TYU: i64 = 6 |
| 31 | const CX_TYX: i64 = 7 |
| 32 | const CX_NTY: i64 = 8 |
| 33 | const CX_SCDUE: i64 = 9 |
| 34 | const CX_SCSIL: i64 = 10 |
| 35 | const CX_SCSENT: i64 = 11 |
| 36 | const CX_NSC: i64 = 12 |
| 37 | const CX_DELIV: i64 = 13 |
| 38 | const CX_NOTIF: i64 = 14 |
functions
| 40 | func sw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 41 | func sn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 42 | func tcheck(pass: i64, label: *u8, fails: *i64) -> i64 |
| 47 | func cxp(ctx: *i64, i: i64) -> *i64 { return ctx[i] as *i64 } |
| 49 | func pr_idx(ctx: *i64, user: i64) -> i64 |
| 56 | func pr_set(ctx: *i64, user: i64, state: i64, now: i64) -> i64 |
| 68 | func pr_view(ctx: *i64, target: i64, now: i64) -> i64 |
| 79 | func pr_last_seen(ctx: *i64, target: i64) -> i64 |
| 87 | func ty_set(ctx: *i64, conv: i64, user: i64, now: i64) -> i64 |
| 103 | func ty_active(ctx: *i64, conv: i64, user: i64, now: i64) -> i64 |
| 116 | func ty_sticky_active(set_at: i64, now: i64) -> i64 called by 1: main |
| 121 | func sc_add(ctx: *i64, due: i64, silent: i64) -> i64 |
| 132 | func sc_tick(ctx: *i64, now: i64) -> i64 |
| 155 | func main() -> i64 |