code wiki / _hdl_build / nx_connect_lanes_lib.nx

nx_connect_lanes_lib.nx source

↩ module page · 47 lines · 2723 B

1// nx_connect_lanes_lib.nx -- the per-relationship INTENT-LANE consent state machine, extracted as a shared 2// library so the verifying gate (nx_connect_lanes) and the LIVE app (nx_connect_serve /lanes) bind ONE 3// implementation. Until this split the capability had NO user-facing surface at all. 4// 5// This is the honest, consented alternative to a banned-but-leaking dating lane (Tandem admits theirs 6// persists; HelloTalk's intent toggle is cosmetic). A relationship's ACTIVE lane is the level BOTH parties 7// have opted into -- MIN(a_request, b_request) -- so ESCALATION REQUIRES MUTUAL CONSENT and nobody can be 8// pulled toward romance unilaterally. DE-ESCALATION and BLOCK are UNILATERAL and immediate: the asymmetry 9// is the point, hard to escalate and easy to exit. Any relationship involving a MINOR is hard-capped below 10// the romance lane, so dating is structurally unreachable rather than discouraged. 11// 12// Lanes: LANGUAGE(0) < FRIEND(1) < COMMUNITY(2) < DATE(3). Integer state logic only. 13// license_tier: ORIGINAL 14 15const LN_LANE_LANG: i64 = 0 16const LN_LANE_FRIEND: i64 = 1 17const LN_LANE_COMMUNITY: i64 = 2 18const LN_LANE_DATE: i64 = 3 19const LN_EXCLUDED: i64 = 0-1 // blocked / severed (negative sentinel, never a lane) 20 21func ln_min(a: i64, b: i64) -> i64 { if a < b { return a } return b } 22 23// CONSENT-CORRECT active lane: mutual opt-in, minor hard-cap below romance, unilateral block severs. 24func ln_active_lane(a_req: i64, b_req: i64, a_adult: i64, b_adult: i64, blocked: i64) -> i64 { 25 if blocked == 1 { return LN_EXCLUDED } // either party may exit 26 var lane: i64 = ln_min(a_req, b_req) // BOTH must consent to a level 27 if a_adult == 0 { if lane > LN_LANE_COMMUNITY { lane = LN_LANE_COMMUNITY } } 28 if b_adult == 0 { if lane > LN_LANE_COMMUNITY { lane = LN_LANE_COMMUNITY } } 29 return lane 30} 31 32// NEG-CONTROL twin: incumbent-style leaky escalation where EITHER party's request wins (max) and there is 33// no minor cap. Kept in the library so the gate measures the real alternative, not a re-typed guess at it. 34func ln_naive_lane(a_req: i64, b_req: i64, a_adult: i64, b_adult: i64, blocked: i64) -> i64 { 35 var lane: i64 = a_req 36 if b_req > lane { lane = b_req } 37 return lane 38} 39 40// human-readable lane name (shared by the gate and the app so they can never disagree on wording) 41func ln_lane_name(lane: i64) -> *u8 { 42 if lane == LN_EXCLUDED { return "Blocked" as *u8 } 43 if lane == LN_LANE_LANG { return "Language exchange" as *u8 } 44 if lane == LN_LANE_FRIEND { return "Friendship" as *u8 } 45 if lane == LN_LANE_COMMUNITY { return "Community" as *u8 } 46 return "Dating" as *u8 47}