nx_vizsla_research_fetch.nx source
↩ module page · 107 lines · 8054 B
1// nx_vizsla_research_fetch.nx -- the Nishi RESEARCHER's sovereign web-fetch for THE PERSONAL-ASSISTANT branch
2// (operator 2026-06-22: "keep going on our hardware rung up nishi vizsla to get our personal assistant
3// capabilities for running our personal relationship management and calendar and to dos and all the other
4// things s class exceed work with the nishi team and nishi researcher"). Mirrors the proven
5// nx_food_research_fetch / nx_idam_research_fetch pattern: own TLS-1.3 (nx_https_fetch_follow) + Mozilla CA
6// store, saving each cited source to knowledge/fetched/pa_*.raw so the research COMPOUNDS and can be grepped
7// to GROUND (rule 4 -- verified facts, not assumptions) the S-class census + roadmap: the calendar interop
8// standards (iCalendar RFC5545 / CalDAV / vCard / CardDAV), the task-management canon (GTD / time-management /
9// prioritization), the PRM/contact lineage, the reminder+notification boundary, personal finance, and the
10// incumbents (Google Calendar / Todoist / Notion / Outlook) we measure the exceed against. This is the
11// researcher GROWING a new capability domain (personal-assistant), the team-growth the arc asks for. 100%
12// sovereign (own TLS, nx_cc->nxasm, no curl/wget/gcc). Idempotent have-skip = re-run fills gaps (also the
13// per-fetch mmap-leak workaround -- each pass is a fresh process so memory resets).
14// COVERAGE: 26 authoritative personal-assistant topics. expect_exit: 0 license_tier: ORIGINAL
15import "nx_syscalls.nx"
16import "nx_x509_trust_store.nx"
17import "nx_trust_store_load_from_certdata.nx"
18import "nx_https_fetch_follow.nx"
19const K_MAGIC_4194304: i64 = 4194304
20const K_MAGIC_8388608: i64 = 8388608
21
22func ff_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
23func ff_putn(v: i64) -> i64 {
24 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 }
25 var m: i64 = v
26 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
27 let d: *u8 = sys_mmap(24); var k: i64 = 0
28 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
29 var j: i64 = k - 1
30 while j >= 0 { sys_write(1, ((d as i64)+j) as *u8, 1); j = j - 1 }
31 return 0
32}
33func have_file(path: *u8) -> i64 {
34 let fd: i64 = sys_openat_rd(path)
35 if fd < 0 { return 0 }
36 sys_close(fd)
37 return 1
38}
39func fetch_save(url: *u8, opath: *u8, store: *TrustStore, out: *u8, cap: i64) -> i64 {
40 if have_file(opath) == 1 { ff_puts(opath); ff_puts(" [have-skip]\n" as *u8); return 1 }
41 let status: *i64 = sys_mmap(8) as *i64
42 let n: i64 = nx_https_fetch_follow(url, store, out, cap, 6, status)
43 ff_puts(url); ff_puts(" status=" as *u8); ff_putn(status[0]); ff_puts(" bytes=" as *u8); ff_putn(n)
44 if n <= 0 { ff_puts(" FETCH-FAIL\n" as *u8); return 0 }
45 var gz: i64 = 0
46 if n >= 2 { if out[0] == 0x1f as u8 { if out[1] == 0x8b as u8 { gz = 1 } } }
47 if gz == 1 { ff_puts(" [GZIP-skip]\n" as *u8); return 0 }
48 let fd: i64 = sys_openat_wr(opath, 0x1a4)
49 if fd < 0 { ff_puts(" SAVE-FAIL\n" as *u8); return 0 }
50 sys_write(fd, out, n)
51 sys_close(fd)
52 ff_puts(" SAVED\n" as *u8)
53 return 1
54}
55
56func main() -> i64 {
57 let r: i64 = nx_trust_store_load_from_certdata("data/mozilla_certdata.txt" as *u8, 512, K_MAGIC_4194304)
58 if r <= 0 { ff_puts("PA: certdata load failed\n" as *u8); return 1 }
59 let store: *TrustStore = r as *TrustStore
60 ff_puts("CA roots=" as *u8); ff_putn(trust_store_count(store)); ff_puts("\n" as *u8)
61 let cap: i64 = K_MAGIC_8388608
62 let out: *u8 = sys_mmap(cap)
63 var ok: i64 = 0
64
65 ff_puts("== THEORY: personal information management + the assistant ==\n" as *u8)
66 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Personal_information_management" as *u8, "knowledge/fetched/pa_t1_pim.raw" as *u8, store, out, cap)
67 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Virtual_assistant" as *u8, "knowledge/fetched/pa_t2_assistant.raw" as *u8, store, out, cap)
68 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Time_management" as *u8, "knowledge/fetched/pa_t3_timemgmt.raw" as *u8, store, out, cap)
69 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Getting_Things_Done" as *u8, "knowledge/fetched/pa_t4_gtd.raw" as *u8, store, out, cap)
70 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Personal_organizer" as *u8, "knowledge/fetched/pa_t5_organizer.raw" as *u8, store, out, cap)
71
72 ff_puts("== PRM / CONTACTS (the relationship lineage) ==\n" as *u8)
73 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Customer_relationship_management" as *u8, "knowledge/fetched/pa_r1_crm.raw" as *u8, store, out, cap)
74 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Contact_manager" as *u8, "knowledge/fetched/pa_r2_contact_mgr.raw" as *u8, store, out, cap)
75 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Address_book" as *u8, "knowledge/fetched/pa_r3_address_book.raw" as *u8, store, out, cap)
76
77 ff_puts("== CALENDAR / SCHEDULING / INTEROP STANDARDS (RFC5545 & friends -- the S-class bar) ==\n" as *u8)
78 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Calendaring_software" as *u8, "knowledge/fetched/pa_c1_calendaring.raw" as *u8, store, out, cap)
79 ok = ok + fetch_save("https://en.wikipedia.org/wiki/ICalendar" as *u8, "knowledge/fetched/pa_c2_icalendar.raw" as *u8, store, out, cap)
80 ok = ok + fetch_save("https://en.wikipedia.org/wiki/CalDAV" as *u8, "knowledge/fetched/pa_c3_caldav.raw" as *u8, store, out, cap)
81 ok = ok + fetch_save("https://en.wikipedia.org/wiki/VCard" as *u8, "knowledge/fetched/pa_c4_vcard.raw" as *u8, store, out, cap)
82 ok = ok + fetch_save("https://en.wikipedia.org/wiki/CardDAV" as *u8, "knowledge/fetched/pa_c5_carddav.raw" as *u8, store, out, cap)
83
84 ff_puts("== TASKS / TO-DOS (task management canon) ==\n" as *u8)
85 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Task_management" as *u8, "knowledge/fetched/pa_k1_task_mgmt.raw" as *u8, store, out, cap)
86 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Kanban_(development)" as *u8, "knowledge/fetched/pa_k2_kanban.raw" as *u8, store, out, cap)
87 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Prioritization" as *u8, "knowledge/fetched/pa_k3_prioritization.raw" as *u8, store, out, cap)
88 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Timeblocking" as *u8, "knowledge/fetched/pa_k4_timeblock.raw" as *u8, store, out, cap)
89
90 ff_puts("== REMINDERS / NOTIFICATION (the proactive PUSH boundary) ==\n" as *u8)
91 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Reminder_software" as *u8, "knowledge/fetched/pa_n1_reminder.raw" as *u8, store, out, cap)
92 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Notification_system" as *u8, "knowledge/fetched/pa_n2_notification.raw" as *u8, store, out, cap)
93 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Push_technology" as *u8, "knowledge/fetched/pa_n3_push.raw" as *u8, store, out, cap)
94
95 ff_puts("== FINANCE (budget + recurring payables lineage) ==\n" as *u8)
96 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Personal_budget" as *u8, "knowledge/fetched/pa_f1_budget.raw" as *u8, store, out, cap)
97 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Personal_finance" as *u8, "knowledge/fetched/pa_f2_finance.raw" as *u8, store, out, cap)
98
99 ff_puts("== INCUMBENTS (the yardsticks we measure the exceed against) ==\n" as *u8)
100 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Google_Calendar" as *u8, "knowledge/fetched/pa_i1_gcal.raw" as *u8, store, out, cap)
101 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Todoist" as *u8, "knowledge/fetched/pa_i2_todoist.raw" as *u8, store, out, cap)
102 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Notion_(productivity_software)" as *u8, "knowledge/fetched/pa_i3_notion.raw" as *u8, store, out, cap)
103 ok = ok + fetch_save("https://en.wikipedia.org/wiki/Microsoft_Outlook" as *u8, "knowledge/fetched/pa_i4_outlook.raw" as *u8, store, out, cap)
104
105 ff_puts("READABLE SOURCES SAVED THIS PASS+HAVE: " as *u8); ff_putn(ok); ff_puts(" / 26\n" as *u8)
106 return 0
107}