code wiki / _hdl_build / nx_skill_request.nx
nx_skill_request.nx
buildroot/runtime/_hdl_build/nx_skill_request.nx
about
nx_skill_request.nx -- LIB: "my chef hasn't covered this -- ask them." Requests as a DEMAND INSTRUMENT.
The estate already banked the rule this is built on: MEASURE demand, never predict desirability, and
DUPLICATE COUNT IS POPULARITY -- it is free and already computed. So a request is not a wish list entry, it
is a counted signal, and the count is what a chef is actually shown when deciding what to film next.
THREE THINGS IT REFUSES TO DO, because each one would corrupt the signal it exists to produce:
1. IT WILL NOT COUNT THE SAME PERSON TWICE. Demand is DISTINCT requesters, not clicks. One enthusiast
hitting the button ten times is one person who wants it; counting clicks would let a single loud user
outrank a genuinely popular gap, which is precisely the failure mode that makes vote counts worthless.
2. IT WILL NOT REQUEST WHAT ALREADY EXISTS. If the chef has already covered that skill, the request is
REFUSED and the existing video is handed back instead. Sending someone a request for work they have
already done wastes their goodwill and teaches them to ignore the channel.
3. IT WILL NOT TREAT "WE NEVER INDEXED THEM" AS "THEY HAVEN'T DONE IT." A request against a chef we do not
hold is accepted but TAGGED as un-indexed, so it routes to our own crawling backlog rather than to a
chef who may already have the video sitting on their channel.
Schema (prefix passed in, e.g. knowledge/store/skillreq-):
req:ids -> TAB list of request keys
req:<chef>:<skill> -> distinct-requester count <t> kind <t> chef-indexed(1|0)
reqby:<chef>:<skill> -> TAB list of unit ids that asked (the dedup set AND the audit trail)
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 5 imports · 1 importers
imports: nx_skill_video.nxnx_meal_plan.nxnx_food_science.nxnx_seg_store.nxnx_syscalls.nx
imported by: nx_skill_market_gate.nx
structs
| none |
consts
| 32 | const SR_TAB: i64 = 9 |
| 33 | const SR_KEYCAP: i64 = 240 |
| 34 | const SR_VALCAP: i64 = 1024 |
| 35 | const SR_MAXU: i64 = 512 |
| 38 | const SR_F_COUNT: i64 = 0 |
| 39 | const SR_F_KIND: i64 = 1 |
| 40 | const SR_F_INDEXED: i64 = 2 |
| 43 | const SR_ALREADY_COVERED: i64 = 0 - 2 // refused: the chef has already made this |
| 44 | const SR_DUPLICATE: i64 = 0 // this unit already asked; the count did NOT move |
| 45 | const SR_COUNTED: i64 = 1 // a new distinct requester |
functions
| 50 | func sr_keybuf() -> *u8 { if SR_KB == 0 { SR_KB = sys_mmap(SR_KEYCAP) as i64 } return SR_KB as *u8 } |
| 51 | func sr_pq() -> *i64 { if SR_PQ == 0 { SR_PQ = sys_mmap(16) as i64 } return SR_PQ as *i64 } |
| 52 | func sr_lq() -> *i64 { if SR_LQ == 0 { SR_LQ = sys_mmap(16) as i64 } return SR_LQ as *i64 } |
| 53 | func sr_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 56 | func sr_pair(chef: *u8, sid: *u8, out: *u8) -> i64 |
| 63 | func sr_req_key(chef: *u8, sid: *u8, out: *u8) -> i64 |
| 71 | func sr_by_key(chef: *u8, sid: *u8, out: *u8) -> i64 |
| 80 | func sr_field(prefix: *u8, chef: *u8, sid: *u8, f: i64, out: *u8) -> i64 |
| 90 | func sr_count(prefix: *u8, chef: *u8, sid: *u8) -> i64 |
| 97 | func sr_has_asked(prefix: *u8, chef: *u8, sid: *u8, unit: *u8) -> i64 |
| 111 | func sr_requesters(prefix: *u8, chef: *u8, sid: *u8, outtoks: *i64) -> i64 |
| 124 | func sr_request(prefix: *u8, vidprefix: *u8, unit: *u8, chef: *u8, sid: *u8, kind: *u8, out_vid: *i64) -> i64 |
| 156 | func sr_is_unindexed(prefix: *u8, chef: *u8, sid: *u8) -> i64 |
| 165 | func sr_rank(prefix: *u8, out_pairs: *i64, out_counts: *i64, max: i64) -> i64 |