code wiki / (root) / nx_resource.nx

nx_resource.nx

buildroot/runtime/nx_resource.nx

2384 B41 linesdepth 6pulls 8 transitivereach 1 importersview sourcekind librarytopic resource
docsdependenciesstructsconstsfunctions

about

nx_resource.nx -- MCP Resources-primitive parity, sovereign: register read-only data resources (uri / description / kind / source) and DISCOVER + READ them. Composes the canonical nx_registry (register/list on seg_store) + file content. Record (tab-separated): uri <TAB> description <TAB> kind <TAB> source. kind "file" reads `source` as a path. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_registry.nx nx_tabrec.nx nx_resource.nx nx_resource_gate.nx

imports: nx_registry.nxnx_tabrec.nx

imported by: nx_resource_gate.nx

structs

none

consts

7const RES_MAGIC_2048: i64 = 2048
9const RES_KP: *u8 = "res:" as *u8
10const RES_IDX: *u8 = "__residx__" as *u8
11const RES_PREFIX: *u8 = "knowledge/resreg-" as *u8

functions

13func resource_register_pfx(prefix: *u8, uri: *u8, desc: *u8, kind: *u8, source: *u8) -> i64
18func resource_list_pfx(prefix: *u8, idxbuf: *u8, cap: i64) -> i64 { return reg_index(prefix, RES_IDX, idxbuf, cap) }
called by 2: resource_listmain calls 1: reg_index
21func resource_read_pfx(prefix: *u8, uri: *u8, outbuf: *u8, cap: i64) -> i64
39func resource_register(uri: *u8, desc: *u8, kind: *u8, source: *u8) -> i64 { return resource_register_pfx(RES_PREFIX, uri, desc, kind, source) }
40func resource_list(idxbuf: *u8, cap: i64) -> i64 { return resource_list_pfx(RES_PREFIX, idxbuf, cap) }
41func resource_read(uri: *u8, outbuf: *u8, cap: i64) -> i64 { return resource_read_pfx(RES_PREFIX, uri, outbuf, cap) }