nx_companion_recon.nx source
↩ module page · 111 lines · 6432 B
1// nx_companion_recon.nx -- sovereign recon of the OLD Elder AI companion media-gen system: the ARC / EXPERIENCE
2// systems and the FAILURE evidence (operator: "really evaluate ... get us back to the old images we generated
3// but with REAL arcs and experiences instead of the FAILED systems we had"). Grounds the census in what actually
4// worked + what failed. Reuses the getdents walk; roots at the platform; for each readable/db file prints lines
5// matching the companion-system markers (arc/story/identity-drift/regression/wardrobe/video/experience). Baked
6// root+markers (nx_sov_build_run doesn't forward args). Zero egress, sovereign. license_tier: ORIGINAL expect_exit: 0
7import "nx_syscalls.nx"
8const RC_MAGIC_65536: i64 = 65536
9const RC_MAGIC_2048: i64 = 2048
10
11const RC_ROOT: *u8 = "/mnt/c/Users/elder/elder-ai-platform" as *u8
12const RC_FBUF: i64 = 3145728
13const RC_MAXDEPTH: i64 = 14
14const RC_MAXLINES: i64 = 5
15
16func rc_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
17func rc_puts(s: *u8) -> i64 { sys_write(1, s, rc_strlen(s)); return 0 }
18func rc_find(buf: *u8, lo: i64, hi: i64, pat: *u8) -> i64 { let pl: i64=rc_strlen(pat); if pl==0 {return 0} var i: i64=lo; while i+pl<=hi { var j: i64=0; while j<pl { if buf[i+j]!=pat[j]{j=pl+1} else {j=j+1} } if j==pl {return 1} i=i+1 } return 0 }
19func rc_is_dot(name: *u8) -> i64 { if name[0]==(46 as u8){ if name[1]==(0 as u8){return 1} if name[1]==(46 as u8){ if name[2]==(0 as u8){return 1} } } return 0 }
20func rc_join(dp: *u8, name: *u8, out: *u8) -> i64 { var p: i64=0; var a: i64=0; while dp[a]!=(0 as u8){out[p]=dp[a];p=p+1;a=a+1} out[p]=47 as u8; p=p+1; var b: i64=0; while name[b]!=(0 as u8){out[p]=name[b];p=p+1;b=b+1} out[p]=0 as u8; return 0 }
21func rc_ends(name: *u8, suf: *u8) -> i64 { let n: i64=rc_strlen(name); let s: i64=rc_strlen(suf); if n<s {return 0} var i: i64=0; while i<s { if name[n-s+i]!=suf[i]{return 0} i=i+1 } return 1 }
22func rc_skip(name: *u8) -> i64 {
23 if rc_ends(name,".png" as *u8)==1 {return 1} if rc_ends(name,".jpg" as *u8)==1 {return 1} if rc_ends(name,".jpeg" as *u8)==1 {return 1}
24 if rc_ends(name,".gguf" as *u8)==1 {return 1} if rc_ends(name,".safetensors" as *u8)==1 {return 1} if rc_ends(name,".bin" as *u8)==1 {return 1}
25 if rc_ends(name,".zip" as *u8)==1 {return 1} if rc_ends(name,".elf" as *u8)==1 {return 1} if rc_ends(name,".exe" as *u8)==1 {return 1}
26 if rc_ends(name,".dll" as *u8)==1 {return 1} if rc_ends(name,".so" as *u8)==1 {return 1} if rc_ends(name,".webp" as *u8)==1 {return 1}
27 if rc_ends(name,".mp4" as *u8)==1 {return 1} if rc_ends(name,".pack" as *u8)==1 {return 1} if rc_ends(name,".pyc" as *u8)==1 {return 1}
28 return 0
29}
30func rc_skip_dir(name: *u8) -> i64 { if rc_ends(name,"node_modules" as *u8)==1 {return 1} if rc_ends(name,".git" as *u8)==1 {return 1} if rc_ends(name,"__pycache__" as *u8)==1 {return 1} return 0 }
31
32// does line buf[ls,le) hit any companion-system marker?
33func rc_hit(buf: *u8, ls: i64, le: i64) -> i64 {
34 if rc_find(buf,ls,le,"ArcLoom" as *u8)==1 {return 1}
35 if rc_find(buf,ls,le,"arc_stability" as *u8)==1 {return 1}
36 if rc_find(buf,ls,le,"n_scenes" as *u8)==1 {return 1}
37 if rc_find(buf,ls,le,"continuity" as *u8)==1 {return 1}
38 if rc_find(buf,ls,le,"identity_persist" as *u8)==1 {return 1}
39 if rc_find(buf,ls,le,"identity_drift" as *u8)==1 {return 1}
40 if rc_find(buf,ls,le,"pose_progression" as *u8)==1 {return 1}
41 if rc_find(buf,ls,le,"scene_architect" as *u8)==1 {return 1}
42 if rc_find(buf,ls,le,"regression" as *u8)==1 {return 1}
43 if rc_find(buf,ls,le,"DEPRECATED" as *u8)==1 {return 1}
44 if rc_find(buf,ls,le,"ABANDONED" as *u8)==1 {return 1}
45 return 0
46}
47
48func rc_scan(path: *u8, fbuf: *u8) -> i64 {
49 let fd: i64 = sys_openat_rd(path)
50 if fd < 0 { return 0 }
51 let n: i64 = sys_read(fd, fbuf, RC_FBUF)
52 sys_close(fd)
53 if n <= 0 { return 0 }
54 var printed: i64 = 0
55 var ls: i64 = 0
56 var i: i64 = 0
57 var any: i64 = 0
58 while i <= n {
59 var eol: i64=0; if i==n {eol=1} else { if fbuf[i]==(10 as u8){eol=1} }
60 if eol==1 {
61 if rc_hit(fbuf,ls,i)==1 { if printed<RC_MAXLINES {
62 if any==0 { rc_puts("FILE: " as *u8); rc_puts(path); rc_puts("\n" as *u8); any=1 }
63 var a: i64=ls; var stop: i64=0; while stop==0 { if a>=i {stop=1} else { let c: i64=fbuf[a] as i64; if c==32{a=a+1} else { if c==9{a=a+1} else {stop=1} } } }
64 var len: i64=i-a; if len>220 {len=220}
65 rc_puts(" | " as *u8); sys_write(1,(fbuf as i64+a) as *u8,len); rc_puts("\n" as *u8)
66 printed=printed+1
67 } }
68 ls=i+1
69 }
70 i=i+1
71 }
72 return any
73}
74
75func rc_walk(dp: *u8, fbuf: *u8, depth: i64) -> i64 {
76 if depth > RC_MAXDEPTH { return 0 }
77 let dfd: i64 = sys_openat_rd(dp)
78 if dfd < 0 { return 0 }
79 let dbuf: *u8 = sys_mmap(RC_MAGIC_65536)
80 var files: i64 = 0
81 var go: i64 = 1
82 while go == 1 {
83 let nread: i64 = sys_getdents64(dfd, dbuf, RC_MAGIC_65536)
84 if nread <= 0 { go = 0 } else {
85 var off: i64 = 0
86 while off < nread {
87 let rec: *u8 = (dbuf as i64 + off) as *u8
88 let reclen: i64 = dirent_reclen(rec)
89 let dtype: i64 = dirent_type(rec)
90 let name: *u8 = dirent_name(rec)
91 if rc_is_dot(name) == 0 {
92 if dtype == DT_DIR { if rc_skip_dir(name)==0 { let cp: *u8=sys_mmap(RC_MAGIC_2048); rc_join(dp,name,cp); files=files+rc_walk(cp,fbuf,depth+1) } }
93 else { if dtype == DT_REG { if rc_skip(name)==0 { let cp: *u8=sys_mmap(RC_MAGIC_2048); rc_join(dp,name,cp); files=files+rc_scan(cp,fbuf) } } }
94 }
95 if reclen <= 0 { off = nread } else { off = off + reclen }
96 }
97 }
98 }
99 sys_close(dfd)
100 return files
101}
102
103func main() -> i64 {
104 rc_puts("=== nx_companion_recon: OLD Elder AI arc/experience/failure systems (sovereign) ===\n" as *u8)
105 let fbuf: *u8 = sys_mmap(RC_FBUF + 16)
106 let f: i64 = rc_walk(RC_ROOT, fbuf, 0)
107 rc_puts("=== files with companion-system evidence = " as *u8)
108 let d: *u8=sys_mmap(24); var m: i64=f; var k: i64=0; if m==0{d[0]=48 as u8;k=1} while m>0{d[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=k-1; while i>=0{let o: *u8=sys_mmap(1);o[0]=d[i];sys_write(1,o,1);i=i-1}
109 rc_puts(" ===\n" as *u8)
110 sys_exit(0); return 0
111}