code wiki / _hdl_build / nx_worklog_ingest_lib.nx

nx_worklog_ingest_lib.nx

buildroot/runtime/_hdl_build/nx_worklog_ingest_lib.nx

15518 B347 linesdepth 4pulls 5 transitivereach 4 importersview sourcekind librarytopic worklog
docsdependenciesstructsconstsfunctions

about

nx_worklog_ingest_lib.nx -- the PRESENT-axis workhorse: ingest the session transcript (.jsonl the harness writes out-of-band as work happens) into the append-only work-journal. A byte-offset CURSOR makes it idempotent: each run appends one framed line per NEW tool_use since the cursor, then advances the cursor to the last complete line. Idempotence is the key property -- the SAME organ can fire on PostToolUse (real-time / mid-turn crash durability), on Stop (turn end), and on a Cron timer (fully out-of-band redundancy) with ZERO duplicate lines, because the cursor gates them all. Reading the harness's OWN record means capture can never miss an action. REUSE: getdents64 + fstatat(mtime@88) directory walk is the proven nx_ws_index_lib/nx_sov_tree_audit idiom; line-boundary cursor is the standard JSONL tail-follow; atomic cursor write = tmp+renameat. Sovereign: nx_syscalls + nx_worklog_lib + nx_json_lib only. license_tier: ORIGINAL

dependencies 3 imports · 4 importers

nx_syscalls.nx nx_worklog_lib.nx nx_json_lib.nx nx_worklog_ingest_lib.nx nx_worklog_ingest.nx nx_worklog_ingest_gate.nx nx_worklog_stop.nx nx_worklog_sweep_gate.nx

imports: nx_syscalls.nxnx_worklog_lib.nxnx_json_lib.nx

imported by: nx_worklog_ingest.nxnx_worklog_ingest_gate.nxnx_worklog_stop.nxnx_worklog_sweep_gate.nx

structs

none

consts

15const WLI_MAGIC_1024: i64 = 1024
16const WLI_MAGIC_65536: i64 = 65536
17const WLI_MAGIC_2048: i64 = 2048
18const WLI_MAGIC_131072: i64 = 131072
20const WLI_READCAP: i64 = 8388608 // 8MB per ingest pass (process up to last newline within it)
21const WLI_TOOLCAP: i64 = 64
22const WLI_TGTCAP: i64 = 256
23const WLI_TGTWIN: i64 = 4096 // bound the first-string-value search inside an input object

functions

25func wli_cat(dst: *u8, off: i64, s: *u8) -> i64
31func wli_catn(dst: *u8, off: i64, v: i64) -> i64
called by 1: wli_write_cursor calls 1: sys_mmap
44func wli_read_cursor(cursor_path: *u8) -> i64
62func wli_write_cursor(cursor_path: *u8, v: i64) -> i64
81func wli_default_cursor(transcript: *u8, out: *u8, outcap: i64) -> i64
called by 1: wli_capture calls 2: jx_lenwli_cat
99func wli_ingest(transcript: *u8, cursor_path: *u8, worklog: *u8) -> i64
157func wli_winpath_to_wsl(src: *u8, out: *u8) -> i64
called by 1: wli_capture calls 2: jx_lenwli_cat
189func wli_is_jsonl(name: *u8) -> i64
called by 1: wli_newest_transcript calls 1: jx_len
200func wli_newest_transcript(dir: *u8, out: *u8, outcap: i64) -> i64
248func wli_capture(argpath: *u8, projdir: *u8, cursors_dir: *u8) -> i64
284func wli_is_cur(name: *u8) -> i64
called by 1: wli_sweep_behind_to calls 1: jx_len
301func wli_sweep_behind_to(projdir: *u8, cursors_dir: *u8, worklog: *u8) -> i64
345func wli_sweep_behind(projdir: *u8, cursors_dir: *u8) -> i64
called by 2: mainmain calls 1: wli_sweep_behind_to