Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienos.com/blob/main/om/alpha-page/main.html # aienos.com Source of www.aienos.com, served from my own hardware Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienos.com / om / alpha-page / main.html` 4932 lines · 100280 bytes Raw Blame History 1

SOVEREIGN INTELLIGENCE / BUILT ON AienOS

Sovereign
Intelligence.

Alpha testing is open for the DGX Spark GB10. Read the release scope and receipts below.

git clone --branch alpha-`20261026`.2 https://interplane.io/drakestapleton/sovereign-intelligence && cd sovereign-intelligence && sh installer/install.sh

Linux arm64 + NVIDIA GB10 only. Experimental software, installed beside your existing stack. Everything comes from the public GitHub repo aien-dev/sovereign-intelligence, so you can read it before you run it: read installer/install.sh first. It downloads only this tag's signed release from GitHub and checks the signature and SHA-256 before it unpacks anything. Nothing is downloaded from this website.

Meet Aien on your own Spark.

Coming in the next update: Aien's black hole, glass panes, science tools and Omega, running locally. This release installs the engine and Omega wizard, not the Aien experience yet.

See what happens next ↓
2
The event horizon is a metaphor. This animation represents the inference path I am building for the DGX Spark GB10. The installation keeps the existing system packages and GPU driver.
3

01 / THE ARRIVAL

One download. Then a walkthrough.

  1. DOWNLOAD

    Clone it from GitHub.

    git fetches the installer's readable source from the public repo. install.sh checks your machine, downloads the signed bundle from GitHub Releases, verifies it, then adds a launcher at user level.

  2. DOUBLE-CLICK

    Open the launcher.

    Open Sovereign Intelligence from your applications menu. The terminal wizard shows what it will change before asking for consent.

  3. WIZARD

    Make the first run yours.

    Doctor, plan, consent, install, model download, first chat. The wizard names the download and its size before you agree.

SOVEREIGN INTELLIGENCE / OMEGA TERMINAL WIZARD

Captured Omega wizard plan screen: a black hole and its accretion disk above the plan, which lists the release and model paths and leaves NVIDIA packages untouched.
Read the captured terminal text
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

4 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

5 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

6 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

7 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

8 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

9 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

10 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

11 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

12 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

13 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

14 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀CUDA toolkit▀▀▀▀▀▀▀cuBLAS▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

15 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

16 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

17 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

18 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

19 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

20 ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀

21 Sovereign Intelligence alpha step 3 of 8 plan written in Omega (.om)

22 Here is exactly what changes, all inside your home folder:

23

24 ~/.local/share/aienos/releases/alpha-`20261026`.2 this release, already unpacked and checked

25 ~/.local/share/aienos/models/qwen3.6-35b-a3b-fp8-`95a723d0`

26 the model: 37.5 GB in 56 files.

27 ~/.local/share/aienos/engine.log the engine's log, when it runs

28 ~/.local/bin/aienos, the menu entry and the desktop icon (already there)

29

30 Not touched: NVIDIA's driver, the CUDA toolkit, libcuda, cuBLAS, /usr, /etc. No sudo.

31 Undo everything at any time: aienos uninstall

32

33

34

35

36 > Press Enter for the last question

37 

Captured from the real Omega wizard in a fake-root host run, built from sovereign-intelligence `38071e3` with the redrawn black hole. That drawing ships in the next alpha; alpha-`20261026`.2 still draws the older one. This is not a GPU installation receipt.

02 / KNOW THE BOUNDARY

One machine family first.

NVIDIA DGX Spark / GB10

The install target is Linux arm64 with an NVIDIA GB10 (PCI 10de:2e12) and NVIDIA kernel driver 580.173.02. The doctor refuses machines with less than 64 GiB of memory and warns when the GB10 has less than 61,309 MiB free. I am not offering a Windows, macOS, x86 Linux or other-GPU installer yet. Unsupported machines receive a friendly “not yet” without an installation.

The model is Qwen3.6-35B-A3B-FP8, pinned to revision `95a723d0`: 37,493,015,668 bytes in 56 files, each hash-checked. The plan asks for that size plus 1 GB of free disk. No other model is offered in this release. I retired this outside model on 2026-11-06, and my Spark no longer serves it, so alpha-`20261026`.2 is now a historical pre-release. The model is meant to be the Omega LLM, my own, and no release carries it yet: its server, ollm serve, has run on my Spark's CPU only and is not deployed (receipts aien-train `0518c915dea370b3bffbb90d579b1daa5ba8b8f5`).

What is coming for other machines?

PROPOSED: more hardware and operating systems, after a working port and device-specific evidence. I will not label a machine supported because the code compiles. Tell me which machine you want to test (omega-projects issues).

Sovereign Intelligence is the front door. AienOS is its OS layer; Aien, Omega, aien-math and CUDA++ keep their own identities. Read my project audit (sovereign-intelligence main docs/WHAT-I-AM-BUILDING.md).

38

03 / NOTHING BEHIND THE CURTAIN

Built entirely in Omega.

The walkthrough wizard is a seeded .om program. This page's structure and small motion client are generated by Omega too. Read the source, keep a copy, change it.

I mean the wizard, not every dependency in the delivery chain: the download bootstrap is POSIX sh, the website builder is Rust, and the host still supplies Linux, a terminal, signature verification and the NVIDIA kernel driver. Those boundaries are explicit.

The wizard source below targets seeded Omega compiler revision `3364a1dfd`. This page generator uses its separately pinned compiler; they are not interchangeable.

aienos.om is the wizard as one plain-text file, SHA-256 `d7459752ee454aab116b60c7e5fa7ad7e7a591c2fc52342ea0483590ea91b120`, listed in the release's signed SHA256SUMS.

Read the wizard's .om source
note SPDX-License-Identifier: Apache-2.0

39 note sha256.om: vendored from aien-dev/omega-mv `3364a1dfd0ca50c1b82bf19ba34932d8bc10a7a9` om/sha256/sha256-om2.om

40 note (source sha256 `dbf002dd6aa36585632b9d01d98ac3f0bd2fa0f0475082940de53638847994bb`). Derived mechanically: every "export fn" became "fn", because a

41 note program-mode unit (one with fn main) refuses export (OMEGESE 9.13, error 9). build.sh re-derives

42 note this file from the pinned source and refuses any other difference.

43 note SPDX-License-Identifier: Apache-2.0

44 note sha256-om2.om: FIPS 180-4 SHA-256 in OM-2 (spec/omegese-om2.md, #747/#748, ledger L838).

45 note The four entries are the API of src/sha256.h, exported through omega-bridge ABI v2 as

46 note omega2_sha256_init/update/final/hash; the bridge's generated omega_api.h maps the C names.

47 note

48 note Invariants:

49 note - All hashing state is the caller's 104-byte context (layout shactx below, equal to sha256_ctx

50 note on LP64 AArch64). Nothing else persists between calls, so a byte copy of a live context is an

51 note equivalent context (erratum E3).

52 note - count is the number of bytes absorbed since init, modulo 2^64. buf[0 .. count mod 64) holds the

53 note pending bytes of the current block; the rest of buf is unspecified. state is the chaining value

54 note after the count div 64 whole blocks.

55 note - final reads the context and writes only the digest, so the context is unchanged by it. The

56 note contract promises less (after final the context is unspecified, memory safety only).

57 note - Every branch and every loop count depends only on lengths, never on message bytes (section 8).

58 note - Indices into the unsized input view are checked at run time (trap 3); indices into sized

59 note arrays inside unrolled bodies are constants and checked when compiled.

60 note bridge c-type shactx sha256_ctx

61 note bridge c-define SHA256_DIGEST_SIZE 32

62 note bridge c-define SHA256_BLOCK_SIZE 64

63 om2

64

65 layout shactx 104

66 field state uint 8 at 0 little

67 field count ulong at 32 little

68 field buf uchar 64 at 40 little

69 end

70

71 note K[0..63]: the first 32 bits of the fractional parts of the cube roots of the first 64 primes.

72 note Copied mechanically from seed/qualification/om2/fixtures/sha256-k.dec (tool-computed, never typed).

73 fn kinit k edit uint 64 to void

74 put k 0 0x428a2f98

75 put k 1 0x71374491

76 put k 2 0xb5c0fbcf

77 put k 3 0xe9b5dba5

78 put k 4 0x3956c25b

79 put k 5 0x59f111f1

80 put k 6 0x923f82a4

81 put k 7 0xab1c5ed5

82 put k 8 0xd807aa98

83 put k 9 0x12835b01

84 put k 10 0x243185be

85 put k 11 0x550c7dc3

86 put k 12 0x72be5d74

87 put k 13 0x80deb1fe

88 put k 14 0x9bdc06a7

89 put k 15 0xc19bf174

90 put k 16 0xe49b69c1

91 put k 17 0xefbe4786

92 put k 18 0x0fc19dc6

93 put k 19 0x240ca1cc

94 put k 20 0x2de92c6f

95 put k 21 0x4a7484aa

96 put k 22 0x5cb0a9dc

97 put k 23 0x76f988da

98 put k 24 0x983e5152

99 put k 25 0xa831c66d

100 put k 26 0xb00327c8

101 put k 27 0xbf597fc7

102 put k 28 0xc6e00bf3

103 put k 29 0xd5a79147

104 put k 30 0x06ca6351

105 put k 31 0x14292967

106 put k 32 0x27b70a85

107 put k 33 0x2e1b2138

108 put k 34 0x4d2c6dfc

109 put k 35 0x53380d13

110 put k 36 0x650a7354

111 put k 37 0x766a0abb

112 put k 38 0x81c2c92e

113 put k 39 0x92722c85

114 put k 40 0xa2bfe8a1

115 put k 41 0xa81a664b

116 put k 42 0xc24b8b70

117 put k 43 0xc76c51a3

118 put k 44 0xd192e819

119 put k 45 0xd6990624

120 put k 46 0xf40e3585

121 put k 47 0x106aa070

122 put k 48 0x19a4c116

123 put k 49 0x1e376c08

124 put k 50 0x2748774c

125 put k 51 0x34b0bcb5

126 put k 52 0x391c0cb3

127 put k 53 0x4ed8aa4a

128 put k 54 0x5b9cca4f

129 put k 55 0x682e6ff3

130 put k 56 0x748f82ee

131 put k 57 0x78a5636f

132 put k 58 0x84c87814

133 put k 59 0x8cc70208

134 put k 60 0x90befffa

135 put k 61 0xa4506ceb

136 put k 62 0xbef9a3f7

137 put k 63 0xc67178f2

138 end

139

140 note H(0): the first 32 bits of the fractional parts of the square roots of the first 8 primes

141 note (fixtures/sha256-iv.dec).

142 fn iv s edit uint 8 to void

143 put s 0 0x6a09e667

144 put s 1 0xbb67ae85

145 put s 2 0x3c6ef372

146 put s 3 0xa54ff53a

147 put s 4 0x510e527f

148 put s 5 0x9b05688c

149 put s 6 0x1f83d9ab

150 put s 7 0x5be0cd19

151 end

152

153 note Message schedule of the block m[o .. o+64). w is fresh: its incoming contents are never read.

154 note The compiler proves that every get of w reads an element written earlier in this function

155 note (error 27 otherwise): w[0..16) are the block's big-endian words, w[16..64) the FIPS recurrence.

156 fn sched w edit uint 64 fresh m view uchar * o ulong to void

157 q = ulong 0

158 x = uint 0

159 y = uint 0

160 for i ulong 16 unroll

161 q = add o mul i 4

162 x = uint get m q

163 x = or shl x 8 uint get m add q 1

164 x = or shl x 8 uint get m add q 2

165 put w i or shl x 8 uint get m add q 3

166 end

167 for i ulong 48 unroll

168 x = get w add i 1

169 y = get w add i 14

170 x = add add get w i get w add i 9 xor xor rotr x 7 rotr x 18 shr x 3

171 put w add i 16 add x xor xor rotr y 17 rotr y 19 shr y 10

172 end

173 end

174

175 note The 64 rounds on the chaining value s. One round body, emitted 64 times by unroll; i is a constant

176 note in each copy, so get kt i and get w i need no run-time check. uint arithmetic wraps mod 2^32.

177 note Ch(e,f,g) = (e and f) xor (not e and g) is written g xor (e and (f xor g)); Maj(a,b,c) =

178 note (a and b) xor (a and c) xor (b and c) is written (a and b) or (c and (a or b)). Both are bitwise

179 note identities. h first becomes T1, then T1 + T2, which is the next a; the names then shift by one.

180 note The sums are built a term per line and each Sigma in two lines through t: 12 names are live, and

181 note omc hands out 16 registers with no spilling (error 12 under compiler-s1/s2 for longer lines).

182 fn rounds s edit uint 8 w view uint 64 kt view uint 64 to void

183 a = get s 0

184 b = get s 1

185 c = get s 2

186 d = get s 3

187 e = get s 4

188 f = get s 5

189 g = get s 6

190 h = get s 7

191 t = uint 0

192 for i ulong 64 unroll

193 h = add h get kt i

194 h = add h get w i

195 t = xor rotr e 6 rotr e 11

196 t = xor t rotr e 25

197 h = add h t

198 h = add h xor g and e xor f g

199 d = add d h

200 t = xor rotr a 2 rotr a 13

201 t = xor t rotr a 22

202 h = add h t

203 t = and c or a b

204 h = add h or and a b t

205 t = h

206 h = g

207 g = f

208 f = e

209 e = d

210 d = c

211 c = b

212 b = a

213 a = t

214 end

215 put s 0 add get s 0 a

216 put s 1 add get s 1 b

217 put s 2 add get s 2 c

218 put s 3 add get s 3 d

219 put s 4 add get s 4 e

220 put s 5 add get s 5 f

221 put s 6 add get s 6 g

222 put s 7 add get s 7 h

223 end

224

225 note One block m[o .. o+64) into s. sched and rounds stay calls: inlined, their names would share

226 note one 16-register frame with this function's parameters (no spilling, error 12).

227 fn compress s edit uint 8 w edit uint 64 kt view uint 64 m view uchar * o ulong to void

228 sched w m o

229 rounds s w kt

230 end

231

232 note The whole blocks of m (len m is a multiple of 64 and at most 2^25, so under 2^19 passes).

233 fn run s edit uint 8 w edit uint 64 kt view uint 64 m view uchar * to void

234 for j ulong shr len m 6

235 compress s w kt m shl j 6

236 end

237 end

238

239 note The whole blocks of m (len m a multiple of 64). A rolled loop traps 4 after `1000000` passes

240 note (OMEGESE.md section 2; omc s_for), so m is cut into runs of 2^25 bytes (2^19 blocks):

241 note len m = top * 2^44 + mid * 2^25 + rest, and no loop passes 2^20 times. top reaches `1000000`

242 note only above 1.7e19 bytes, which no AArch64 address space holds.

243 fn blocks s edit uint 8 w edit uint 64 kt view uint 64 m view uchar * to void

244 q = ulong 0

245 for a ulong shr len m 44

246 for b ulong 0x80000

247 run s w kt part m q 0x2000000

248 q = add q 0x2000000

249 end

250 end

251 for b ulong and shr len m 25 0x7ffff

252 run s w kt part m q 0x2000000

253 q = add q 0x2000000

254 end

255 run s w kt part m q sub len m q

256 end

257

258 note Pad the k pending bytes already in p (k < 64; p was all zero past them): 0x80, zeros, and the

259 note 64-bit big-endian bit length of the n-byte message in the last 8 bytes of one or two blocks.

260 fn finish s edit uint 8 w edit uint 64 kt view uint 64 p edit uchar 128 k ulong n ulong to void

261 put p k 0x80

262 e = ulong 64

263 if ge k 56

264 e = 128

265 end

266 bits = shl n 3

267 for i ulong 8 unroll

268 put p sub e add i 1 uchar and shr bits mul i 8 0xff

269 end

270 compress s w kt view p 0

271 if eq e 128

272 compress s w kt view p 64

273 end

274 end

275

276 fn sha256_init c edit shactx to void

277 s = new uint 8 0

278 iv s

279 for i ulong 8 unroll

280 put c state i get s i

281 end

282 put c count 0

283 end

284

285 note k bytes of d from o into the context's buffer at bi (bi + k <= 64). A function of its own: inside

286 note absorb the copy loop needs more than the 16 registers (error 12 under compiler-s4).

287 fn tobuf c edit shactx bi ulong d view uchar * o ulong k ulong to void

288 for i ulong k

289 put c buf add bi i get d add o i

290 end

291 end

292

293 note Whole blocks are hashed straight from d; the bytes that complete a pending block go through blk.

294 fn absorb c edit shactx d view uchar * bi ulong to void

295 n = len d

296 s = new uint 8 0

297 w = new uint 64 0

298 kt = new uint 64 0

299 blk = new uchar 64 0

300 kinit kt

301 for i ulong 8 unroll

302 put s i get c state i

303 end

304 off = ulong 0

305 if gt bi 0

306 off = sub 64 bi

307 for i ulong bi

308 put blk i get c buf i

309 end

310 for i ulong off

311 put blk add bi i get d i

312 end

313 compress s w kt view blk 0

314 end

315 nb = shr sub n off 6

316 blocks s w kt part d off shl nb 6

317 off = add off shl nb 6

318 tobuf c 0 d off sub n off

319 for i ulong 8 unroll

320 put c state i get s i

321 end

322 end

323

324 note Any length, including 0 and >= 2^32. lt n sub 64 bi cannot wrap (bi < 64); add bi n could.

325 fn sha256_update c edit shactx d view uchar * to void

326 n = len d

327 cnt = get c count

328 bi = and cnt 63

329 put c count add cnt n

330 if lt n sub 64 bi

331 tobuf c bi d 0 n

332 ret

333 end

334 absorb c d bi

335 end

336

337 fn sha256_final c edit shactx o out uchar 32 to void

338 s = new uint 8 0

339 w = new uint 64 0

340 kt = new uint 64 0

341 p = new uchar 128 0

342 v = ulong 0

343 kinit kt

344 for i ulong 8 unroll

345 put s i get c state i

346 end

347 cnt = get c count

348 k = and cnt 63

349 for i ulong k

350 put p i get c buf i

351 end

352 finish s w kt p k cnt

353 for i ulong 8 unroll

354 v = ulong get s i

355 for j ulong 4 unroll

356 put o add mul i 4 j uchar and shr v sub 24 mul j 8 0xff

357 end

358 end

359 end

360

361 note Equal to init, update(d), final on a fresh context (section 7), with the state in locals. o may

362 note overlap d: the binding copies o out only after the call returns status 0.

363 fn sha256_hash d view uchar * o out uchar 32 to void

364 s = new uint 8 0

365 w = new uint 64 0

366 kt = new uint 64 0

367 p = new uchar 128 0

368 v = ulong 0

369 kinit kt

370 iv s

371 n = len d

372 nb = shr n 6

373 blocks s w kt part d 0 shl nb 6

374 off = shl nb 6

375 k = sub n off

376 for i ulong k

377 put p i get d add off i

378 end

379 finish s w kt p k n

380 for i ulong 8 unroll

381 v = ulong get s i

382 for j ulong 4 unroll

383 put o add mul i 4 j uchar and shr v sub 24 mul j 8 0xff

384 end

385 end

386 end

387 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

388 note lib.om: the output buffer, numbers, ANSI escapes, paths, files, environment and child

389 note processes shared by every screen of the AienOS wizard. Linux arm64 only; every kernel result is

390 note a count or minus the Linux errno and is checked where it is used.

391

392 global ob uchar 262144

393 global obn ulong 1

394 global pb uchar 4096

395 global pbn ulong 1

396 global rb uchar 524288

397 global rbn ulong 1

398 global hb uchar 1024

399 global hbn ulong 1

400 global rt uchar 1024

401 global rtn ulong 1

402 global pr uchar 512

403 global prn ulong 1

404 global ib uchar 4096

405 global ibn ulong 1

406 global eb uchar 4096

407 global pk uchar 4096

408 global pkn ulong 1

409 global sb uchar 128

410 global ws uchar 8

411 global sn int 64

412 text tslash "/"

413 text t_yes "yes"

414 text tusrbin "/usr/bin/"

415 text tbin "/bin/"

416

417 note Append t to the output buffer. A frame never comes near the 256 KiB cap; past it the

418 note bytes are dropped rather than trapping, and the next flush starts clean.

419 fn emit t view uchar * to void

420 n = get obn 0

421 if gt add n len t len ob

422 ret

423 end

424 for i ulong len t

425 put ob add n i get t i

426 end

427 put obn 0 add n len t

428 end

429

430 fn putb b uchar to void

431 n = get obn 0

432 if lt n len ob

433 put ob n b

434 put obn 0 add n 1

435 end

436 end

437

438 note Decimal digits of v, most significant first.

439 fn num v ulong to void

440 d = new uchar 20 0

441 k = ulong 0

442 x = v

443 while true bound 21

444 put d k uchar add rem x 10 48

445 k = add k 1

446 x = div x 10

447 if eq x 0

448 break

449 end

450 end

451 for i ulong k

452 putb get d sub sub k 1 i

453 end

454 end

455

456 fn snum v long to void

457 if lt v 0

458 putb 45

459 num ulong neg v

460 ret

461 end

462 num ulong v

463 end

464

465 fn numw v ulong w ulong to void

466 x = v

467 k = ulong 1

468 while ge x 10 bound 21

469 x = div x 10

470 k = add k 1

471 end

472 while lt k w bound 64

473 putb 32

474 k = add k 1

475 end

476 num v

477 end

478

479 note Write the whole buffer to fd 1 with a partial-write loop, then empty it.

480 fn flush to long

481 n = get obn 0

482 o = ulong 0

483 while lt o n bound 262145

484 w = write 1 ob o sub n o

485 if le w 0

486 put obn 0 0

487 ret w

488 end

489 o = add o ulong w

490 end

491 put obn 0 0

492 ret long n

493 end

494

495 fn csi to void

496 putb 27

497 putb 91

498 end

499

500 fn mv r ulong c ulong to void

501 csi

502 num r

503 putb 59

504 num c

505 putb 72

506 end

507

508 fn fg r ulong g ulong b ulong to void

509 csi

510 putb 51

511 putb 56

512 putb 59

513 putb 50

514 putb 59

515 num r

516 putb 59

517 num g

518 putb 59

519 num b

520 putb 109

521 end

522

523 fn bg r ulong g ulong b ulong to void

524 csi

525 putb 52

526 putb 56

527 putb 59

528 putb 50

529 putb 59

530 num r

531 putb 59

532 num g

533 putb 59

534 num b

535 putb 109

536 end

537

538 fn sgr0 to void

539 csi

540 putb 48

541 putb 109

542 end

543

544 fn bold to void

545 csi

546 putb 49

547 putb 109

548 end

549

550 note Erase from the cursor to the end of the line.

551 fn eol to void

552 csi

553 putb 75

554 end

555

556 fn cls to void

557 csi

558 putb 50

559 putb 74

560 end

561

562 note Cursor home with no parameters: every animation frame starts with it.

563 fn home to void

564 csi

565 putb 72

566 end

567

568 note Alternate screen and hidden cursor on (true) or the user's screen and cursor back (false).

569 fn scrn on bool to void

570 csi

571 putb 63

572 num 1049

573 if on

574 putb 104

575 csi

576 putb 63

577 num 25

578 putb 108

579 else

580 putb 108

581 csi

582 putb 63

583 num 25

584 putb 104

585 end

586 end

587

588 note The 64-entry sine table, sin(2 pi k / 64) scaled by 1000, computed with Wolfram:

589 note Table[Round[1000*Sin[2 Pi k/64]], {k, 0, 63}]. Only the first quadrant is stored by hand;

590 note the rest follows from sin(pi - x) = sin x and sin(x + pi) = -sin x.

591 fn sinit to void

592 q = new int 17 0

593 put q 1 98

594 put q 2 195

595 put q 3 290

596 put q 4 383

597 put q 5 471

598 put q 6 556

599 put q 7 634

600 put q 8 707

601 put q 9 773

602 put q 10 831

603 put q 11 882

604 put q 12 924

605 put q 13 957

606 put q 14 981

607 put q 15 995

608 put q 16 1000

609 for k ulong 17

610 put sn k get q k

611 put sn sub 32 k get q k

612 end

613 for k ulong 32

614 put sn add k 32 neg get sn k

615 end

616 end

617

618 fn isin k ulong to long

619 ret long get sn and k 63

620 end

621

622 fn icos k ulong to long

623 ret long get sn and add k 16 63

624 end

625

626 note Paths: pb is built piece by piece and handed to the host words with its length pbn.

627 fn pclr to void

628 put pbn 0 0

629 end

630

631 fn pstr t view uchar * to void

632 n = get pbn 0

633 if gt add n len t len pb

634 trap 3

635 end

636 for i ulong len t

637 put pb add n i get t i

638 end

639 put pbn 0 add n len t

640 end

641

642 fn pbyte b uchar to void

643 n = get pbn 0

644 put pb n b

645 put pbn 0 add n 1

646 end

647

648 fn pnum v ulong to void

649 d = new uchar 20 0

650 k = ulong 0

651 x = v

652 while true bound 21

653 put d k uchar add rem x 10 48

654 k = add k 1

655 x = div x 10

656 if eq x 0

657 break

658 end

659 end

660 for i ulong k

661 pbyte get d sub sub k 1 i

662 end

663 end

664

665 fn phome to void

666 for i ulong get hbn 0

667 pbyte get hb i

668 end

669 end

670

671 fn proot to void

672 for i ulong get rtn 0

673 pbyte get rt i

674 end

675 end

676

677 note A probe path: the test-only prefix AIENOS_PROBE_ROOT (empty in normal use) then t.

678 fn pprobe t view uchar * to void

679 pclr

680 for i ulong get prn 0

681 pbyte get pr i

682 end

683 pstr t

684 end

685

686 note Append rb[o .. o+n) to the path.

687 fn prb o ulong n ulong to void

688 for i ulong n

689 pbyte get rb add o i

690 end

691 end

692

693 fn pdrop k ulong to void

694 put pbn 0 sub get pbn 0 k

695 end

696

697 note Stat pb into sb. Returns 0 or minus errno.

698 fn pstat to long

699 ret stat pb 0 get pbn 0 sb 0 128

700 end

701

702 note File type bits of the last stat: 4 directory, 2 character device, 8 regular, 10 link.

703 fn stype to ulong

704 m = or or uint get sb 16 shl uint get sb 17 8 shl uint get sb 18 16

705 ret ulong shr and m 61440 12

706 end

707

708 fn ssize to ulong

709 x = ulong 0

710 for i ulong 8

711 x = or x shl ulong get sb add 48 i mul i 8

712 end

713 ret x

714 end

715

716 fn sino to ulong

717 x = ulong 0

718 for i ulong 8

719 x = or x shl ulong get sb add 8 i mul i 8

720 end

721 ret x

722 end

723

724 fn pexist to bool

725 ret eq pstat 0

726 end

727

728 note Read the whole file named by pb into rb (at most len rb bytes). Returns the count or -errno.

729 fn slurp to long

730 put rbn 0 0

731 fd = fopen pb 0 get pbn 0 524288 0

732 if lt fd 0

733 ret fd

734 end

735 n = ulong 0

736 while lt n len rb bound 524289

737 k = read int fd rb n sub len rb n

738 if lt k 0

739 c = fclose int fd

740 ret k

741 end

742 if eq k 0

743 break

744 end

745 n = add n ulong k

746 end

747 c = fclose int fd

748 put rbn 0 n

749 ret long n

750 end

751

752 note Write rb[0 .. n) to the file named by pb, created or truncated, mode 0644.

753 fn spill n ulong to long

754 fd = fopen pb 0 get pbn 0 525889 420

755 if lt fd 0

756 ret fd

757 end

758 o = ulong 0

759 while lt o n bound 524289

760 k = write int fd rb o sub n o

761 if le k 0

762 c = fclose int fd

763 ret -5

764 end

765 o = add o ulong k

766 end

767 c = fclose int fd

768 ret 0

769 end

770

771 note Does rb start, at offset o, with the bytes of t?

772 fn rbat o ulong t view uchar * to bool

773 if gt add o len t get rbn 0

774 ret false

775 end

776 for i ulong len t

777 if ne get rb add o i get t i

778 ret false

779 end

780 end

781 ret true

782 end

783

784 note First offset at or after o where t occurs in rb, or the length of rb's content when absent.

785 fn rbfind o ulong t view uchar * to ulong

786 n = get rbn 0

787 i = o

788 while lt i n bound 524289

789 if rbat i t

790 ret i

791 end

792 i = add i 1

793 end

794 ret n

795 end

796

797 note Does t occur inside rb[o .. e)?

798 fn rbin o ulong e ulong t view uchar * to bool

799 if lt e len t

800 ret false

801 end

802 i = o

803 while le add i len t e bound 524289

804 if rbat i t

805 ret true

806 end

807 i = add i 1

808 end

809 ret false

810 end

811

812 note Decimal number in rb at o; stops at the first non-digit.

813 fn rbnum o ulong to ulong

814 x = ulong 0

815 i = o

816 while lt i get rbn 0 bound 21

817 c = get rb i

818 if or lt c 48 gt c 57

819 break

820 end

821 x = add mul x 10 ulong sub c 48

822 i = add i 1

823 end

824 ret x

825 end

826

827 note Copy the environment entry KEY=value whose key is k into eb; returns the value length, or

828 note -1 when the key is absent. The value starts at eb[len k + 1].

829 fn envget k view uchar * to long

830 c = envcnt

831 for i ulong ulong c

832 n = envread i eb 0 len eb

833 if gt n long len k

834 m = true

835 for j ulong len k

836 if ne get eb j get k j

837 m = false

838 end

839 end

840 if and m eq get eb len k 61

841 ret sub n add long len k 1

842 end

843 end

844 end

845 ret -1

846 end

847

848 note Read one line from fd 0 into ib (without its newline). Returns its length, or -1 at end of input.

849 fn rline to long

850 n = ulong 0

851 put ibn 0 0

852 while lt n sub len ib 1 bound 4096

853 k = read 0 ib n 1

854 if le k 0

855 if eq n 0

856 ret -1

857 end

858 break

859 end

860 if eq get ib n 10

861 break

862 end

863 n = add n 1

864 end

865 put ibn 0 n

866 ret long n

867 end

868

869 fn ibis t view uchar * to bool

870 if ne get ibn 0 len t

871 ret false

872 end

873 for i ulong len t

874 if ne get ib i get t i

875 ret false

876 end

877 end

878 ret true

879 end

880

881 note Packed argument lists for execprog: a little-endian u16 count, then u16 length + bytes records.

882 fn pkclr to void

883 put pk 0 0

884 put pk 1 0

885 put pkn 0 2

886 end

887

888 fn pkrec n ulong to ulong

889 c = add or uint get pk 0 shl uint get pk 1 8 1

890 put pk 0 uchar and c 255

891 put pk 1 uchar shr c 8

892 o = get pkn 0

893 put pk o uchar and n 255

894 put pk add o 1 uchar shr n 8

895 put pkn 0 add add o 2 n

896 ret add o 2

897 end

898

899 fn pkstr t view uchar * to void

900 o = pkrec len t

901 for i ulong len t

902 put pk add o i get t i

903 end

904 end

905

906 note The current path pb as one argument.

907 fn pkpath to void

908 o = pkrec get pbn 0

909 for i ulong get pbn 0

910 put pk add o i get pb i

911 end

912 end

913

914 fn pknum v ulong to void

915 pclr

916 pnum v

917 pkpath

918 end

919

920 note Exit status from the 4-byte wait status in ws: the exit code, or 128 + signal.

921 fn wcode to long

922 s = uint get ws 0

923 if ne and s 127 0

924 ret long add and s 127 128

925 end

926 ret long uint get ws 1

927 end

928

929 note Run the packed program in pk with fd 1 and 2 sent to the file named by pb (appended) or, when

930 note pb is empty, inherited. Returns the exit status or a negative errno from fork.

931 fn runpk to long

932 lfd = long -1

933 if gt get pbn 0 0

934 lfd = fopen pb 0 get pbn 0 525377 420

935 if lt lfd 0

936 ret lfd

937 end

938 end

939 pid = fork

940 if lt pid 0

941 ret pid

942 end

943 if eq pid 0

944 if ge lfd 0

945 d = dupfd int lfd 1 0

946 d = dupfd int lfd 2 0

947 end

948 r = execprog pk 0 get pkn 0

949 exit 127

950 end

951 if ge lfd 0

952 c = fclose int lfd

953 end

954 r = waitpid int pid ws 0 4 0

955 if ne r pid

956 ret -10

957 end

958 ret wcode

959 end

960

961 note Run pk with its stdout captured into rb (at most len rb bytes); stdin and stderr are inherited.

962 note Returns the exit status; rbn holds the captured length.

963 fn runcap to long

964 put rbn 0 0

965 r = pipefds ws 0 8 524288

966 if ne r 0

967 ret r

968 end

969 rd = or or uint get ws 0 shl uint get ws 1 8 shl uint get ws 2 16

970 wr = or or uint get ws 4 shl uint get ws 5 8 shl uint get ws 6 16

971 pid = fork

972 if lt pid 0

973 ret pid

974 end

975 if eq pid 0

976 d = dupfd int wr 1 0

977 r = execprog pk 0 get pkn 0

978 exit 127

979 end

980 c = fclose int wr

981 n = ulong 0

982 while lt n len rb bound 524289

983 k = read int rd rb n sub len rb n

984 if le k 0

985 break

986 end

987 n = add n ulong k

988 end

989 c = fclose int rd

990 put rbn 0 n

991 r = waitpid int pid ws 0 4 0

992 if ne r pid

993 ret -10

994 end

995 ret wcode

996 end

997

998 note Find a host helper by name in /usr/bin then /bin; leaves its path in pb. False when absent.

999 fn findbin t view uchar * to bool

1000 pclr

1001 pstr tusrbin

1002 pstr t

1003 if eq faccess pb 0 get pbn 0 1 0

1004 ret true

1005 end

1006 pclr

1007 pstr tbin

1008 pstr t

1009 ret eq faccess pb 0 get pbn 0 1 0

1010 end

1011 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

1012 note hole.om: the animated black hole. Each terminal cell shows two square pixels with the upper

1013 note half block (U+2580): the foreground colour is the upper pixel, the background the lower one.

1014 note No floating point and no trigonometry beyond the 64-entry sine table: the angle around the

1015 note hole is the integer "diamond angle" (0..255 for one turn), and every radius is compared squared.

1016

1017 global gm long 12

1018 global tw ulong 1

1019 global th ulong 1

1020 global tick ulong 1

1021 text lb0 "libcuda.so"

1022 text lb1 "cuBLAS"

1023 text lb2 "nvcc"

1024 text lb3 "CUDA toolkit"

1025 text lb4 "libcudart"

1026 text lb5 "cuDNN"

1027 text lb6 "NCCL"

1028 text lb7 "TensorRT"

1029 text tblk "▀"

1030

1031 note gm: 0 cx, 1 cy (pixels), 2 R, 3 horizon^2, 4 photon ring^2, 5 disk inner^2, 6 disk outer^2,

1032 note 7 glow^2, 8 scene rows, 9 horizon radius, 10 lensed arc^2.

1033 fn hgeom rows ulong to void

1034 cx = long div get tw 0 2

1035 cy = long rows

1036 r = cx

1037 if lt cy r

1038 r = cy

1039 end

1040 r = div mul r 95 100

1041 rh = div mul r 44 100

1042 put gm 0 cx

1043 put gm 1 cy

1044 put gm 2 r

1045 put gm 3 mul rh rh

1046 rp = add rh add div r 16 1

1047 put gm 4 mul rp rp

1048 di = div mul rh 135 100

1049 put gm 5 mul di di

1050 ro = div mul r 26 10

1051 lim = div mul cx 92 100

1052 if gt ro lim

1053 ro = lim

1054 end

1055 put gm 6 mul ro ro

1056 gl = div mul rp 160 100

1057 put gm 7 mul gl gl

1058 put gm 8 long rows

1059 put gm 9 rh

1060 lz = div mul rh 150 100

1061 put gm 10 mul lz lz

1062 end

1063

1064 note Diamond angle of (x, y): 0..255 for one counter-clockwise turn, monotone in the true angle.

1065 fn dang x long y long to ulong

1066 ax = x

1067 if lt ax 0

1068 ax = neg ax

1069 end

1070 ay = y

1071 if lt ay 0

1072 ay = neg ay

1073 end

1074 s = add ax ay

1075 if eq s 0

1076 ret 0

1077 end

1078 if ge y 0

1079 if ge x 0

1080 ret ulong div mul 64 ay s

1081 end

1082 ret ulong add 64 div mul 64 ax s

1083 end

1084 if lt x 0

1085 ret ulong add 128 div mul 64 ay s

1086 end

1087 ret ulong add 192 div mul 64 ax s

1088 end

1089

1090 fn pack r long g long b long to ulong

1091 ret or or shl ulong r 16 shl ulong g 8 ulong b

1092 end

1093

1094 note Scale a packed colour by m/1000 and clamp each channel to 255.

1095 fn scale c ulong m long to ulong

1096 r = div mul long and shr c 16 255 m 1000

1097 g = div mul long and shr c 8 255 m 1000

1098 b = div mul long and c 255 m 1000

1099 if gt r 255

1100 r = 255

1101 end

1102 if gt g 255

1103 g = 255

1104 end

1105 if gt b 255

1106 b = 255

1107 end

1108 if lt r 0

1109 r = 0

1110 end

1111 if lt g 0

1112 g = 0

1113 end

1114 if lt b 0

1115 b = 0

1116 end

1117 ret pack r g b

1118 end

1119

1120 note One channel of a mix: (x u + y t) / 256.

1121 fn mixc x long y long u long t long to long

1122 ret div add mul x u mul y t 256

1123 end

1124

1125 note Mix two packed colours: t/256 of b over a.

1126 fn mix a ulong b ulong t long to ulong

1127 u = sub 256 t

1128 r = mixc long and shr a 16 255 long and shr b 16 255 u t

1129 g = mixc long and shr a 8 255 long and shr b 8 255 u t

1130 c = mixc long and a 255 long and b 255 u t

1131 ret pack r g c

1132 end

1133

1134 note Accretion disk at (dx, dyd) with dd2 = dx^2 + dyd^2: hot white at the inner edge through orange

1135 note to violet at the rim, three spiral arms that wind tighter inward, the approaching side brighter.

1136 fn dcol t long to ulong

1137 if ge t 128

1138 ret mix pack 255 132 36 pack 110 28 120 mul sub t 128 2

1139 end

1140 ret mix pack 255 240 210 pack 255 132 36 mul t 2

1141 end

1142

1143 fn dlum dx long dyd long tw2 long to long

1144 p = add div dang dx dyd 4 ulong tw2

1145 p = add p mul get tick 0 2

1146 ret add 640 div mul 360 isin mul p 3 1000

1147 end

1148

1149 fn diskc dx long dyd long dd2 long to ulong

1150 in2 = get gm 5

1151 t = div mul sub dd2 in2 256 add sub get gm 6 in2 1

1152 c = dcol t

1153 i = dlum dx dyd div mul in2 40 add dd2 1

1154 dop = sub 1000 div mul dx 350 add get gm 2 1

1155 ret scale c div mul i dop 1000

1156 end

1157

1158 fn shash x ulong y ulong to ulong

1159 h = xor mul x `374761393` mul y `668265263`

1160 h = mul xor h shr h 13 `1274126177`

1161 ret and shr xor h shr h 16 7 2047

1162 end

1163

1164 fn star x ulong y ulong to ulong

1165 h = shash x y

1166 if ge h 12

1167 ret pack 3 3 10

1168 end

1169 v = long add 70 mul h 15

1170 if eq and shr add get tick 0 mul h 5 3 1 1

1171 v = div mul v 2 3

1172 end

1173 ret pack v v add v 25

1174 end

1175

1176 note The far side of the disk, bent over and under the shadow by the hole's gravity.

1177 fn lensc dx long dy long d2 long to ulong

1178 rp2 = get gm 4

1179 t = div mul sub d2 rp2 256 add sub get gm 10 rp2 1

1180 c = dcol t

1181 ret scale c dlum dx mul dy 4 64

1182 end

1183

1184 note Faint orange halo just outside the photon ring, fading into the stars.

1185 fn glow x ulong y ulong d2 long to ulong

1186 g7 = get gm 7

1187 t = div mul sub g7 d2 200 sub g7 get gm 4

1188 ret mix star x y pack 160 60 20 t

1189 end

1190

1191 note Colour of pixel (x, y) of the scene.

1192 fn px x ulong y ulong to ulong

1193 dx = sub long x get gm 0

1194 dy = sub long y get gm 1

1195 d2 = add mul dx dx mul dy dy

1196 dyd = mul dy 4

1197 dd2 = add mul dx dx mul dyd dyd

1198 indisk = and ge dd2 get gm 5 le dd2 get gm 6

1199 if and indisk ge dy 0

1200 ret diskc dx dyd dd2

1201 end

1202 if lt d2 get gm 3

1203 ret 0

1204 end

1205 if lt d2 get gm 4

1206 f = add 820 div mul 180 isin add div dang dx dy 4 get tick 0 1000

1207 ret scale pack 255 226 170 f

1208 end

1209 if lt d2 get gm 10

1210 ret lensc dx dy d2

1211 end

1212 if indisk

1213 ret diskc dx dyd dd2

1214 end

1215 if lt d2 get gm 7

1216 ret glow x y d2

1217 end

1218 ret star x y

1219 end

1220

1221 fn hpix c ulong top bool to void

1222 r = and shr c 16 255

1223 g = and shr c 8 255

1224 b = and c 255

1225 if top

1226 fg r g b

1227 else

1228 bg r g b

1229 end

1230 end

1231

1232 note Draw the scene rows 1..rows at full terminal width into the output buffer.

1233 fn hdraw rows ulong to void

1234 lf = ulong `16777216`

1235 lb = ulong `16777216`

1236 for row ulong rows

1237 mv add row 1 1

1238 lf = `16777216`

1239 lb = `16777216`

1240 for x ulong get tw 0

1241 a = px x mul row 2

1242 b = px x add mul row 2 1

1243 if ne a lf

1244 hpix a true

1245 lf = a

1246 end

1247 if ne b lb

1248 hpix b false

1249 lb = b

1250 end

1251 emit tblk

1252 end

1253 sgr0

1254 end

1255 end

1256

1257 fn lemit i ulong o ulong k ulong to void

1258 if eq i 0

1259 emit part lb0 o k

1260 end

1261 if eq i 1

1262 emit part lb1 o k

1263 end

1264 if eq i 2

1265 emit part lb2 o k

1266 end

1267 if eq i 3

1268 emit part lb3 o k

1269 end

1270 if eq i 4

1271 emit part lb4 o k

1272 end

1273 if eq i 5

1274 emit part lb5 o k

1275 end

1276 if eq i 6

1277 emit part lb6 o k

1278 end

1279 if eq i 7

1280 emit part lb7 o k

1281 end

1282 end

1283

1284 fn llen i ulong to ulong

1285 if eq i 0

1286 ret len lb0

1287 end

1288 if eq i 1

1289 ret len lb1

1290 end

1291 if eq i 2

1292 ret len lb2

1293 end

1294 if eq i 3

1295 ret len lb3

1296 end

1297 if eq i 4

1298 ret len lb4

1299 end

1300 if eq i 5

1301 ret len lb5

1302 end

1303 if eq i 6

1304 ret len lb6

1305 end

1306 ret len lb7

1307 end

1308

1309 note Label i of the NVIDIA user-space stack spirals inward along the disk plane. It starts green

1310 note at the edge of the picture, turns red as it falls, loses letters at the horizon and is gone.

1311 fn lfrm i ulong to ulong

1312 ret rem add get tick 0 mul i 15 120

1313 end

1314

1315 fn lrad i ulong to long

1316 f = lfrm i

1317 ret div mul mul get gm 2 3 long sub 120 f 240

1318 end

1319

1320 fn lang i ulong to ulong

1321 f = lfrm i

1322 ret add add mul i 8 div mul f 3 2 div mul f f 90

1323 end

1324

1325 fn lpos i ulong to void

1326 r = lrad i

1327 a = lang i

1328 x = add get gm 0 div mul r icos a 1000

1329 y = add get gm 1 div mul mul r isin a 2 5000

1330 rh = get gm 9

1331 if or le r rh lt y 0

1332 ret

1333 end

1334 lshow i r x y

1335 end

1336

1337 fn lshow i ulong r long x long y long to void

1338 rh = get gm 9

1339 n = llen i

1340 k = n

1341 if lt r mul rh 2

1342 k = ulong div mul long n sub r rh rh

1343 end

1344 if eq k 0

1345 ret

1346 end

1347 row = add ulong div y 2 1

1348 if gt row ulong get gm 8

1349 ret

1350 end

1351 col = sub x long div k 2

1352 if or lt col 1 gt add ulong col k get tw 0

1353 ret

1354 end

1355 lpaint i sub n k k lfade r row ulong col

1356 end

1357

1358 fn lfade r long to long

1359 d = mul sub r get gm 9 256

1360 t = div d add mul get gm 2 2 1

1361 if gt t 256

1362 ret 256

1363 end

1364 ret t

1365 end

1366

1367 fn lpaint i ulong d ulong k ulong t long row ulong col ulong to void

1368 c = mix pack 255 70 30 pack 118 185 0 t

1369 mv row col

1370 fg and shr c 16 255 and shr c 8 255 and c 255

1371 bg 0 0 0

1372 bold

1373 lemit i div d 2 k

1374 sgr0

1375 end

1376

1377 fn hlabels to void

1378 for i ulong 8

1379 lpos i

1380 end

1381 end

1382

1383 note One complete frame of the scene: picture, then labels over it.

1384 fn hframe rows ulong to void

1385 hgeom rows

1386 hdraw rows

1387 hlabels

1388 put tick 0 add get tick 0 1

1389 end

1390 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

1391 note doctor.om: what this machine is, read only. Nothing here writes a file or loads a library.

1392 note Every absolute path goes through pprobe, so a test can point the doctor at a fake tree with

1393 note AIENOS_PROBE_ROOT; in normal use that prefix is empty.

1394

1395 const NCHK ulong 8

1396 global dk ulong 8

1397 global dt uchar 1536

1398 global dtn ulong 8

1399 global dci ulong 1

1400 global db uchar 32768

1401 global dv ulong 8

1402 text c_arch "/proc/sys/kernel/arch"

1403 text c_a64 "aarch64"

1404 text c_pci "/sys/bus/pci/devices"

1405 text c_vend "/vendor"

1406 text c_dev "/device"

1407 text c_nvv "0x10de"

1408 text c_gb10 "0x2e12"

1409 text c_dctl "/dev/nvidiactl"

1410 text c_dn0 "/dev/nvidia0"

1411 text c_duvm "/dev/nvidia-uvm"

1412 text c_pdrv "/proc/driver/nvidia/version"

1413 text c_mver "/sys/module/nvidia/version"

1414 text c_good "580.173.02"

1415 text c_mem "/proc/meminfo"

1416 text c_mtot "MemTotal:"

1417 text c_mav "MemAvailable:"

1418 text c_mmap "Mapped:"

1419 text c_lock "/tmp/aien-gb10.lock"

1420 text c_plk "/proc/locks"

1421 text c_cuda "/usr/local/cuda"

1422 text c_lcu "/usr/lib/aarch64-linux-gnu/libcuda.so.1"

1423 text c_smi "/usr/bin/nvidia-smi"

1424 text t_gb " GB"

1425 text t_nl "\n"

1426 text n_arch "CPU"

1427 text n_gpu "GPU"

1428 text n_drv "Driver"

1429 text n_mem "Memory"

1430 text n_disk "Disk"

1431 text n_inst "AienOS"

1432 text n_busy "GPU lock"

1433 text n_nv "NVIDIA"

1434 text d_a1 "arm64 (aarch64), Linux"

1435 text d_a2 "not arm64: this alpha needs Linux arm64"

1436 text d_g1 "NVIDIA GB10 found (PCI 10de:2e12), device nodes present"

1437 text d_g2 "no NVIDIA GB10 found: this alpha runs only on a DGX Spark (GB10)"

1438 text d_g3 "GB10 found but /dev/nvidiactl, /dev/nvidia0 or /dev/nvidia-uvm is missing"

1439 text d_d1 "kernel driver "

1440 text d_d2 " (the version this alpha was built and tested against)"

1441 text d_d3 " found; this alpha only knows 580.173.02, so it stops here"

1442 text d_d4 "no NVIDIA kernel module loaded (/sys/module/nvidia/version missing)"

1443 text d_m1 " GB memory, "

1444 text d_m2 " GB free for a model"

1445 text d_m3 "; another model is using memory, so the first chat waits until it is free"

1446 text d_m4 "; this alpha needs a 128 GB GB10"

1447 text h_df "df"

1448 text h_b1 "-B1"

1449 text h_av "--output=avail"

1450 text d_k1 " free in your home"

1451 text d_k2 "; the model needs "

1452 text d_k3 "unknown free space (df not found); the model needs "

1453 text d_i1 "not installed yet"

1454 text d_i2 "installed: "

1455 text d_i3 ", model verified"

1456 text d_i4 ", model not downloaded yet"

1457 text t_cur "/.local/share/aienos/current"

1458 text d_b1 "the GB10 lock (/tmp/aien-gb10.lock) is not held right now"

1459 text d_b2 "busy: process "

1460 text d_b3 " holds the GB10 lock, so I start no second model"

1461 text d_n1 "found "

1462 text d_n2 "libcuda"

1463 text d_n3 "the CUDA toolkit"

1464 text d_n4 "nvidia-smi"

1465 text d_n5 ": they stay installed and untouched, and AienOS never loads them"

1466 text d_nc ", "

1467 text d_n6 "no NVIDIA user-space libraries found; AienOS does not need them"

1468 text k_ok " ok "

1469 text k_wn " note "

1470 text k_no " no "

1471 text k_in " info "

1472

1473 note Detail line of check i, built with dstr/dnum/drb.

1474 fn dsel i ulong to void

1475 put dci 0 i

1476 put dtn i 0

1477 end

1478

1479 fn dstr t view uchar * to void

1480 i = get dci 0

1481 n = get dtn i

1482 for j ulong len t

1483 if lt add n j 190

1484 put dt add mul i 192 add n j get t j

1485 end

1486 end

1487 m = add n len t

1488 if gt m 190

1489 m = 190

1490 end

1491 put dtn i m

1492 end

1493

1494 fn dbyte b uchar to void

1495 i = get dci 0

1496 n = get dtn i

1497 if lt n 190

1498 put dt add mul i 192 n b

1499 put dtn i add n 1

1500 end

1501 end

1502

1503 fn dnum v ulong to void

1504 d = new uchar 20 0

1505 k = ulong 0

1506 x = v

1507 while true bound 21

1508 put d k uchar add rem x 10 48

1509 k = add k 1

1510 x = div x 10

1511 if eq x 0

1512 break

1513 end

1514 end

1515 for j ulong k

1516 dbyte get d sub sub k 1 j

1517 end

1518 end

1519

1520 note Bytes of rb[o ..) up to the first newline or n bytes.

1521 fn drb o ulong n ulong to void

1522 for j ulong n

1523 if ge add o j get rbn 0

1524 ret

1525 end

1526 c = get rb add o j

1527 if eq c 10

1528 ret

1529 end

1530 dbyte c

1531 end

1532 end

1533

1534 note Size in GB, rounded to one decimal, from a byte count (1 GB = 10^9 bytes).

1535 fn dgb v ulong to void

1536 r = add v `50000000`

1537 dnum div r `1000000000`

1538 dbyte 46

1539 dnum div rem r `1000000000` `100000000`

1540 dstr t_gb

1541 end

1542

1543 fn verdict i ulong k ulong to void

1544 put dk i k

1545 end

1546

1547 note 0 CPU architecture. The binary itself is aarch64 and static, so running at all proves the ISA;

1548 note the kernel's own word is shown when it has one.

1549 fn ckarch to void

1550 dsel 0

1551 pprobe c_arch

1552 n = slurp

1553 if lt n 0

1554 verdict 0 0

1555 dstr d_a1

1556 ret

1557 end

1558 if rbat 0 c_a64

1559 verdict 0 0

1560 dstr d_a1

1561 ret

1562 end

1563 verdict 0 2

1564 dstr d_a2

1565 end

1566

1567 note Is pci device directory entry rb-name a GB10? Builds devices/NAME/vendor and /device.

1568 fn pcidev o ulong n ulong to bool

1569 pprobe c_pci

1570 pbyte 47

1571 for j ulong n

1572 pbyte get db add o j

1573 end

1574 k = get pbn 0

1575 pstr c_vend

1576 r = slurp

1577 if or lt r 0 not rbat 0 c_nvv

1578 ret false

1579 end

1580 put pbn 0 k

1581 pstr c_dev

1582 r = slurp

1583 if lt r 0

1584 ret false

1585 end

1586 ret rbat 0 c_gb10

1587 end

1588

1589 fn dbu16 o ulong to ulong

1590 lo = ulong get db o

1591 hi = ulong get db add o 1

1592 ret or lo shl hi 8

1593 end

1594

1595 note Length of the zero-terminated name at db[o].

1596 fn dname o ulong to ulong

1597 k = ulong 0

1598 while lt add o k len db bound 300

1599 if eq get db add o k 0

1600 ret k

1601 end

1602 k = add k 1

1603 end

1604 ret k

1605 end

1606

1607 note Count GB10 devices (PCI 10de:2e12) under /sys/bus/pci/devices.

1608 fn gbcount to ulong

1609 pprobe c_pci

1610 fd = fopen pb 0 get pbn 0 540672 0

1611 if lt fd 0

1612 ret 0

1613 end

1614 found = ulong 0

1615 while true bound 4096

1616 n = getdnts int fd db 0 len db

1617 if le n 0

1618 break

1619 end

1620 o = ulong 0

1621 while lt o ulong n bound 32768

1622 rl = dbu16 add o 16

1623 nl = dname add o 19

1624 if and gt nl 0 ne get db add o 19 46

1625 if pcidev add o 19 nl

1626 found = add found 1

1627 end

1628 end

1629 if eq rl 0

1630 break

1631 end

1632 o = add o rl

1633 end

1634 end

1635 c = fclose int fd

1636 ret found

1637 end

1638

1639 fn chrdev t view uchar * to bool

1640 pprobe t

1641 if ne pstat 0

1642 ret false

1643 end

1644 ret eq stype 2

1645 end

1646

1647 fn ckgpu to void

1648 dsel 1

1649 g = gbcount

1650 put dv 1 g

1651 if eq g 0

1652 verdict 1 2

1653 dstr d_g2

1654 ret

1655 end

1656 ok = and and chrdev c_dctl chrdev c_dn0 chrdev c_duvm

1657 pprobe c_pdrv

1658 if or not ok not pexist

1659 verdict 1 2

1660 dstr d_g3

1661 ret

1662 end

1663 verdict 1 0

1664 dstr d_g1

1665 end

1666

1667 fn ckdrv to void

1668 dsel 2

1669 pprobe c_mver

1670 n = slurp

1671 if lt n 0

1672 verdict 2 2

1673 dstr d_d4

1674 ret

1675 end

1676 dstr d_d1

1677 drb 0 40

1678 if rbat 0 c_good

1679 verdict 2 0

1680 dstr d_d2

1681 ret

1682 end

1683 verdict 2 2

1684 dstr d_d3

1685 end

1686

1687 note The kB value after key k in /proc/meminfo (rb), 0 when absent.

1688 fn memkb k view uchar * to ulong

1689 o = rbfind 0 k

1690 if ge o get rbn 0

1691 ret 0

1692 end

1693 o = add o len k

1694 while eq get rb o 32 bound 64

1695 o = add o 1

1696 end

1697 ret rbnum o

1698 end

1699

1700 fn ckmem to void

1701 dsel 3

1702 pprobe c_mem

1703 n = slurp

1704 if lt n 0

1705 verdict 3 2

1706 ret

1707 end

1708 tot = memkb c_mtot

1709 av = memkb c_mav

1710 mp = memkb c_mmap

1711 fr = ulong 0

1712 if gt av mp

1713 fr = sub av mp

1714 end

1715 put dv 3 fr

1716 dgbk tot

1717 dstr d_m1

1718 dgbk fr

1719 dstr d_m2

1720 if lt tot `67108864`

1721 verdict 3 2

1722 dstr d_m4

1723 ret

1724 end

1725 note 35B load need (Core qwen36_batch at `59b05a71`, live load log): 37254 MiB model + 8 rows x 1982.85 MiB

1726 note + 8192 MiB kept free = 61309 MiB = `62780416` kB (Wolfram: Ceiling[37254+8*1982.85+8192]*1024).

1727 if lt fr `62780416`

1728 verdict 3 1

1729 dstr d_m3

1730 ret

1731 end

1732 verdict 3 0

1733 end

1734

1735 fn dgbk kb ulong to void

1736 dnum div mul kb 1024 `1000000000`

1737 end

1738

1739 note Free bytes where the model will live, read with the host's df (Omega has no statfs word yet).

1740 fn dfree to ulong

1741 if not findbin h_df

1742 ret 0

1743 end

1744 pkclr

1745 pkpath

1746 pkstr h_b1

1747 pkstr h_av

1748 pclr

1749 phome

1750 pkpath

1751 r = runcap

1752 if ne r 0

1753 ret 0

1754 end

1755 o = rbfind 0 t_nl

1756 ret rbnum add o 1

1757 end

1758

1759 fn ckdisk need ulong to void

1760 dsel 4

1761 f = dfree

1762 put dv 4 f

1763 if eq f 0

1764 verdict 4 1

1765 dstr d_k3

1766 dgb need

1767 ret

1768 end

1769 dgb f

1770 dstr d_k1

1771 if lt f need

1772 verdict 4 2

1773 dstr d_k2

1774 dgb need

1775 ret

1776 end

1777 verdict 4 0

1778 end

1779

1780 fn ckinst to void

1781 dsel 5

1782 verdict 5 3

1783 pclr

1784 phome

1785 pstr t_cur

1786 n = readlnk pb 0 get pbn 0 rb 0 256

1787 if le n 0

1788 dstr d_i1

1789 ret

1790 end

1791 put rbn 0 ulong n

1792 dstr d_i2

1793 s = ulong 0

1794 for j ulong ulong n

1795 if eq get rb j 47

1796 s = add j 1

1797 end

1798 end

1799 drb s sub ulong n s

1800 if mdone

1801 dstr d_i3

1802 else

1803 dstr d_i4

1804 end

1805 end

1806

1807 note Is the GB10 lock file held? Its inode is looked up in /proc/locks. Returns the holder pid or 0.

1808 fn lockpid to ulong

1809 pprobe c_lock

1810 if ne pstat 0

1811 ret 0

1812 end

1813 ino = sino

1814 pprobe c_plk

1815 n = slurp

1816 if lt n 0

1817 ret 0

1818 end

1819 o = ulong 0

1820 while lt o get rbn 0 bound 524289

1821 e = rbfind o t_nl

1822 p = lkline o e ino

1823 if gt p 0

1824 ret p

1825 end

1826 o = add e 1

1827 end

1828 ret 0

1829 end

1830

1831 note One /proc/locks line in rb[o..e): "1: POSIX ADVISORY WRITE PID MAJ:MIN:INODE START END".

1832 note Returns PID when INODE equals ino.

1833 fn lkline o ulong e ulong ino ulong to ulong

1834 f = ulong 0

1835 i = o

1836 pid = ulong 0

1837 while lt i e bound 4096

1838 if eq get rb i 32

1839 while and lt i e eq get rb i 32 bound 4096

1840 i = add i 1

1841 end

1842 f = add f 1

1843 if eq f 4

1844 pid = rbnum i

1845 end

1846 if eq f 5

1847 ret lkino i e ino pid

1848 end

1849 else

1850 i = add i 1

1851 end

1852 end

1853 ret 0

1854 end

1855

1856 fn lkino i ulong e ulong ino ulong pid ulong to ulong

1857 j = i

1858 c = ulong 0

1859 while and lt j e lt c 2 bound 64

1860 if eq get rb j 58

1861 c = add c 1

1862 end

1863 j = add j 1

1864 end

1865 if eq rbnum j ino

1866 ret pid

1867 end

1868 ret 0

1869 end

1870

1871 fn ckbusy to void

1872 dsel 6

1873 p = lockpid

1874 put dv 6 p

1875 if eq p 0

1876 verdict 6 0

1877 dstr d_b1

1878 ret

1879 end

1880 verdict 6 1

1881 dstr d_b2

1882 dnum p

1883 dstr d_b3

1884 end

1885

1886 fn cknv to void

1887 dsel 7

1888 verdict 7 3

1889 k = ulong 0

1890 pprobe c_lcu

1891 a = pexist

1892 pprobe c_cuda

1893 b = pexist

1894 pprobe c_smi

1895 c = pexist

1896 if not or or a b c

1897 dstr d_n6

1898 ret

1899 end

1900 dstr d_n1

1901 if a

1902 dstr d_n2

1903 end

1904 if and a or b c

1905 dstr d_nc

1906 end

1907 if b

1908 dstr d_n3

1909 end

1910 if and b c

1911 dstr d_nc

1912 end

1913 if c

1914 dstr d_n4

1915 end

1916 dstr d_n5

1917 end

1918

1919 note Run every check. Returns true when the machine can take this alpha (no check failed).

1920 fn doctor need ulong to bool

1921 ckarch

1922 ckgpu

1923 ckdrv

1924 ckmem

1925 ckdisk need

1926 ckinst

1927 ckbusy

1928 cknv

1929 ok = true

1930 for i ulong NCHK

1931 if eq get dk i 2

1932 ok = false

1933 end

1934 end

1935 ret ok

1936 end

1937

1938 fn cname i ulong to void

1939 if eq i 0

1940 emit n_arch

1941 end

1942 if eq i 1

1943 emit n_gpu

1944 end

1945 if eq i 2

1946 emit n_drv

1947 end

1948 if eq i 3

1949 emit n_mem

1950 end

1951 if eq i 4

1952 emit n_disk

1953 end

1954 if eq i 5

1955 emit n_inst

1956 end

1957 if eq i 6

1958 emit n_busy

1959 end

1960 if eq i 7

1961 emit n_nv

1962 end

1963 end

1964

1965 fn ctag k ulong colour bool to void

1966 if colour

1967 if eq k 0

1968 fg 120 220 120

1969 end

1970 if eq k 1

1971 fg 250 200 80

1972 end

1973 if eq k 2

1974 fg 255 90 80

1975 end

1976 if eq k 3

1977 fg 140 170 255

1978 end

1979 end

1980 if eq k 0

1981 emit k_ok

1982 end

1983 if eq k 1

1984 emit k_wn

1985 end

1986 if eq k 2

1987 emit k_no

1988 end

1989 if eq k 3

1990 emit k_in

1991 end

1992 if colour

1993 sgr0

1994 end

1995 end

1996

1997 note One check as one line: [tag] name padded to 8, then the detail.

1998 fn cline i ulong colour bool to void

1999 putb 91

2000 ctag get dk i colour

2001 putb 93

2002 putb 32

2003 cname i

2004 n = cnlen i

2005 while lt n 9 bound 16

2006 putb 32

2007 n = add n 1

2008 end

2009 dline i

2010 end

2011

2012 fn dline i ulong to void

2013 for j ulong get dtn i

2014 putb get dt add mul i 192 j

2015 end

2016 end

2017

2018 fn cnlen i ulong to ulong

2019 if eq i 0

2020 ret len n_arch

2021 end

2022 if eq i 1

2023 ret len n_gpu

2024 end

2025 if eq i 2

2026 ret len n_drv

2027 end

2028 if eq i 3

2029 ret len n_mem

2030 end

2031 if eq i 4

2032 ret len n_disk

2033 end

2034 if eq i 5

2035 ret len n_inst

2036 end

2037 if eq i 6

2038 ret len n_busy

2039 end

2040 ret len n_nv

2041 end

2042 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

2043 note net.om: a small HTTP/1.0 client for the engine on 127.0.0.1, written with the native socket

2044 note words, and the JSON string escaping it needs. No TLS: it only ever talks to the loopback door.

2045 note Chat replies are read as a server-sent event stream and shown token by token.

2046

2047 global qb uchar 65536

2048 global qbn ulong 1

2049 global hs uchar 262144

2050 global hsn ulong 1

2051 global ab uchar 65536

2052 global abn ulong 1

2053 global nt ulong 4

2054 text j_open "{\"stream\":true,\"max_tokens\":1024,\"messages\":["

2055 text j_close "]}"

2056 text j_user "{\"role\":\"user\",\"content\":\""

2057 text j_asst "{\"role\":\"assistant\",\"content\":\""

2058 text j_end "\"}"

2059 text j_comma ","

2060 text h_post "POST /v1/chat/completions HTTP/1.0"

2061 text h_host "Host: 127.0.0.1"

2062 text h_ctype "Content-Type: application/json"

2063 text h_clen "Content-Length: "

2064 text h_get1 "GET "

2065 text h_get2 " HTTP/1.0"

2066 text h_data "data: "

2067 text h_done "[DONE]"

2068 text h_cont "\"content\":\""

2069 text h_health "/health"

2070

2071 fn qstr t view uchar * to void

2072 n = get qbn 0

2073 if gt add n len t len qb

2074 trap 3

2075 end

2076 for i ulong len t

2077 put qb add n i get t i

2078 end

2079 put qbn 0 add n len t

2080 end

2081

2082 fn qcrlf to void

2083 qbyte 13

2084 qbyte 10

2085 end

2086

2087 fn qline t view uchar * to void

2088 qstr t

2089 qcrlf

2090 end

2091

2092 note Offset of the blank line that ends the headers in rb, or the content length when absent.

2093 fn hend to ulong

2094 e4 = new uchar 4 13

2095 put e4 1 10

2096 put e4 3 10

2097 ret rbfind 0 e4

2098 end

2099

2100 fn qbyte b uchar to void

2101 n = get qbn 0

2102 put qb n b

2103 put qbn 0 add n 1

2104 end

2105

2106 fn qnum v ulong to void

2107 d = new uchar 20 0

2108 k = ulong 0

2109 x = v

2110 while true bound 21

2111 put d k uchar add rem x 10 48

2112 k = add k 1

2113 x = div x 10

2114 if eq x 0

2115 break

2116 end

2117 end

2118 for i ulong k

2119 qbyte get d sub sub k 1 i

2120 end

2121 end

2122

2123 note Append one byte to the conversation history hs (JSON already escaped).

2124 fn hbyte b uchar to void

2125 n = get hsn 0

2126 if lt n len hs

2127 put hs n b

2128 put hsn 0 add n 1

2129 end

2130 end

2131

2132 fn hstr t view uchar * to void

2133 for i ulong len t

2134 hbyte get t i

2135 end

2136 end

2137

2138 fn hexd v ulong to uchar

2139 if lt v 10

2140 ret uchar add v 48

2141 end

2142 ret uchar add v 87

2143 end

2144

2145 note The user's line ib, escaped as a JSON string body, appended to the history.

2146 fn hesc to void

2147 for i ulong get ibn 0

2148 c = get ib i

2149 if or eq c 34 eq c 92

2150 hbyte 92

2151 hbyte c

2152 else

2153 if lt c 32

2154 hbyte 92

2155 hbyte 117

2156 hbyte 48

2157 hbyte 48

2158 hbyte hexd ulong shr c 4

2159 hbyte hexd ulong and c 15

2160 else

2161 hbyte c

2162 end

2163 end

2164 end

2165 end

2166

2167 note A loopback TCP connection to port p. Returns the descriptor or -errno.

2168 fn tcp p ulong to long

2169 a = new uchar 16 0

2170 put a 0 2

2171 put a 2 uchar shr p 8

2172 put a 3 uchar and p 255

2173 put a 4 127

2174 put a 7 1

2175 fd = socknew 2 524289 0

2176 if lt fd 0

2177 ret fd

2178 end

2179 r = connect int fd a 0 16

2180 if ne r 0

2181 c = fclose int fd

2182 ret r

2183 end

2184 ret fd

2185 end

2186

2187 fn sendq fd int to long

2188 n = get qbn 0

2189 o = ulong 0

2190 while lt o n bound 65537

2191 k = send fd qb o sub n o 0

2192 if le k 0

2193 ret -5

2194 end

2195 o = add o ulong k

2196 end

2197 ret 0

2198 end

2199

2200 note GET path on 127.0.0.1:p. Returns the HTTP status (200 ..), or a negative error.

2201 fn hget p ulong t view uchar * to long

2202 fd = tcp p

2203 if lt fd 0

2204 ret fd

2205 end

2206 put qbn 0 0

2207 qstr h_get1

2208 qstr t

2209 qline h_get2

2210 qline h_host

2211 qcrlf

2212 r = sendq int fd

2213 if ne r 0

2214 c = fclose int fd

2215 ret r

2216 end

2217 put rbn 0 0

2218 k = waitio int fd 1 `5000000000`

2219 if le k 0

2220 c = fclose int fd

2221 ret -110

2222 end

2223 k = recv int fd rb 0 64 0

2224 c = fclose int fd

2225 if lt k 12

2226 ret -71

2227 end

2228 put rbn 0 ulong k

2229 ret long rbnum 9

2230 end

2231

2232 fn alive p ulong to bool

2233 ret eq hget p h_health 200

2234 end

2235

2236 note Decode one \uXXXX escape's four hex digits at rb[o].

2237 fn hex4 o ulong to ulong

2238 v = ulong 0

2239 for i ulong 4

2240 c = ulong get rb add o i

2241 d = ulong 0

2242 if and ge c 48 le c 57

2243 d = sub c 48

2244 end

2245 if and ge c 97 le c 102

2246 d = sub c 87

2247 end

2248 if and ge c 65 le c 70

2249 d = sub c 55

2250 end

2251 v = or shl v 4 d

2252 end

2253 ret v

2254 end

2255

2256 note UTF-8 of code point v to the output buffer.

2257 fn utf8 v ulong to void

2258 if lt v 128

2259 putb uchar v

2260 ret

2261 end

2262 if lt v 2048

2263 putb uchar or 192 shr v 6

2264 putb uchar or 128 and v 63

2265 ret

2266 end

2267 if lt v 65536

2268 putb uchar or 224 shr v 12

2269 putb uchar or 128 and shr v 6 63

2270 putb uchar or 128 and v 63

2271 ret

2272 end

2273 putb uchar or 240 shr v 18

2274 putb uchar or 128 and shr v 12 63

2275 putb uchar or 128 and shr v 6 63

2276 putb uchar or 128 and v 63

2277 end

2278

2279 note Print the JSON string body starting at rb[o] up to its closing quote, decoding escapes, and keep

2280 note the raw escaped bytes in ab for the history. Returns the offset after the closing quote.

2281 fn jshow o ulong e ulong to ulong

2282 i = o

2283 while lt i e bound 524289

2284 c = get rb i

2285 if eq c 34

2286 ret add i 1

2287 end

2288 abyte c

2289 if ne c 92

2290 putb c

2291 i = add i 1

2292 else

2293 i = jesc add i 1 e

2294 end

2295 end

2296 ret i

2297 end

2298

2299 fn abyte c uchar to void

2300 n = get abn 0

2301 if lt n len ab

2302 put ab n c

2303 put abn 0 add n 1

2304 end

2305 end

2306

2307 note One escape after a backslash at rb[i]; returns the offset after it.

2308 fn jesc i ulong e ulong to ulong

2309 if ge i e

2310 ret i

2311 end

2312 c = get rb i

2313 abyte c

2314 if eq c 110

2315 putb 10

2316 ret add i 1

2317 end

2318 if eq c 116

2319 putb 9

2320 ret add i 1

2321 end

2322 if eq c 114

2323 ret add i 1

2324 end

2325 if eq c 117

2326 if le add i 5 e

2327 for k ulong 4

2328 abyte get rb add add i 1 k

2329 end

2330 v = hex4 add i 1

2331 if and ge v 55296 lt v 56320

2332 ret jsur i e v

2333 end

2334 utf8 v

2335 ret add i 5

2336 end

2337 ret e

2338 end

2339 putb c

2340 ret add i 1

2341 end

2342

2343 note A high surrogate at rb[i-1..i+5) followed by \uDC00..\uDFFF.

2344 fn jsur i ulong e ulong v ulong to ulong

2345 if and le add i 11 e eq get rb add i 5 92

2346 for k ulong 6

2347 abyte get rb add add i 5 k

2348 end

2349 lo = hex4 add i 7

2350 utf8 add 65536 add shl sub v 55296 10 sub lo 56320

2351 ret add i 11

2352 end

2353 utf8 65533

2354 ret add i 5

2355 end

2356

2357 note Handle the complete event lines in rb[o .. e): print every content delta. Returns the offset of

2358 note the first incomplete line, or the length of rb's content plus one after [DONE].

2359 fn events o ulong to ulong

2360 i = o

2361 while lt i get rbn 0 bound 524289

2362 nl = rbfind i t_nl

2363 if ge nl get rbn 0

2364 ret i

2365 end

2366 if rbat i h_data

2367 if rbat add i len h_data h_done

2368 ret add get rbn 0 1

2369 end

2370 c = rbfind i h_cont

2371 if lt c nl

2372 if eq get nt 0 0

2373 put nt 1 ulong sub monons long get nt 2

2374 end

2375 put nt 0 add get nt 0 1

2376 x = jshow add c len h_cont nl

2377 w = flush

2378 end

2379 end

2380 i = add nl 1

2381 end

2382 ret i

2383 end

2384

2385 note Send the history as one chat request and stream the answer to the screen. The answer's escaped

2386 note text is kept in ab for the history. Returns 0, a negative error, or the HTTP status when not 200.

2387 fn chatreq p ulong to long

2388 body = add add len j_open get hsn 0 len j_close

2389 put qbn 0 0

2390 qline h_post

2391 qline h_host

2392 qline h_ctype

2393 qstr h_clen

2394 qnum body

2395 qcrlf

2396 qcrlf

2397 if gt add get qbn 0 body len qb

2398 ret -7

2399 end

2400 qstr j_open

2401 for i ulong get hsn 0

2402 qbyte get hs i

2403 end

2404 qstr j_close

2405 fd = tcp p

2406 if lt fd 0

2407 ret fd

2408 end

2409 r = sendq int fd

2410 if ne r 0

2411 c = fclose int fd

2412 ret r

2413 end

2414 put abn 0 0

2415 put nt 0 0

2416 put nt 2 ulong monons

2417 r = chatrx int fd

2418 c = fclose int fd

2419 ret r

2420 end

2421

2422 note Receive the reply: status line, headers, then events until [DONE] or the server closes.

2423 fn chatrx fd int to long

2424 put rbn 0 0

2425 hb2 = ulong 0

2426 st = long 0

2427 o = ulong 0

2428 while lt get rbn 0 len rb bound 524289

2429 k = waitio fd 1 `600000000000`

2430 if le k 0

2431 ret -110

2432 end

2433 k = recv fd rb get rbn 0 sub len rb get rbn 0 0

2434 if le k 0

2435 break

2436 end

2437 put rbn 0 add get rbn 0 ulong k

2438 if eq hb2 0

2439 e = hend

2440 if lt e get rbn 0

2441 hb2 = add e 4

2442 st = long rbnum 9

2443 o = hb2

2444 if ne st 200

2445 ret st

2446 end

2447 end

2448 end

2449 if gt hb2 0

2450 o = events o

2451 if gt o get rbn 0

2452 ret 0

2453 end

2454 end

2455 end

2456 if eq hb2 0

2457 ret -71

2458 end

2459 ret 0

2460 end

2461 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

2462 note steps.om: the screens of the wizard (welcome, doctor, plan, consent, install, model, first chat,

2463 note done), the panel under the black hole, the progress bar, file hashing with the Omega SHA-256 unit,

2464 note the model download and the engine's start and stop.

2465 note

2466 note Panel markup: byte 1 gold, 2 plain, 3 green, 4 red, 5 dim, 6 bright. A line ends at byte 10.

2467

2468 global ui ulong 12

2469 global pt uchar 8192

2470 global ptn ulong 1

2471 global pp uchar 256

2472 global ppn ulong 1

2473 global mf uchar 65536

2474 global mfn ulong 1

2475 global mnm uchar 128

2476 global mnn ulong 1

2477 global dg uchar 32

2478 global bs uchar 1024

2479 global bsn ulong 1

2480 global pidb uchar 32

2481 global ppt uchar 4096

2482 global pptn ulong 1

2483 text s_title " Sovereign Intelligence alpha "

2484 text s_step " step "

2485 text s_of " of 8 "

2486 text s_n0 "welcome"

2487 text s_n1 "doctor"

2488 text s_n2 "plan"

2489 text s_n3 "your yes"

2490 text s_n4 "install"

2491 text s_n5 "model"

2492 text s_n6 "first chat"

2493 text s_n7 "done"

2494 text s_omega " written in Omega (.om)"

2495 text t_tbase "~/.local/share/aienos"

2496 text t_files " files"

2497 text t_slash " / "

2498 text m_name "name "

2499 text m_url "url "

2500 text m_bytes "bytes "

2501 text m_files "files "

2502 text t_share "/share/aienos/model.manifest"

2503 text t_base "/.local/share/aienos"

2504 text t_models "/models/"

2505 text t_vfy "/.aienos-verified"

2506 text t_sums "/SHA256SUMS"

2507 text i_l1 "Checking every file of this release with SHA-256."

2508 text i_l2 "The hash runs in Omega (the sha256.om unit shipped beside me)."

2509 text i_ok " files match SHA256SUMS."

2510 text i_bad "A file does not match SHA256SUMS: "

2511 text i_bad2 "This copy is damaged or was changed. Install again with the curl command."

2512 text i_cut "Meanwhile the user-space stack falls into the hole: libcuda, cuBLAS, nvcc."

2513 text i_cut2 "That is the picture only. On disk those stay installed; AienOS just never loads them."

2514 text i_md1 "Created "

2515 text i_md2 " for the model."

2516 text t_mkfail "I could not create the model folder in ~/.local/share/aienos."

2517 text t_wait "working, please wait"

2518 text t_next "Press Enter to continue"

2519 text t_close "Press Enter to close"

2520 text h_curl "curl"

2521 text c_f "-fL"

2522 text c_s "-sS"

2523 text c_r "--retry"

2524 text c_5 "5"

2525 text c_c "-C"

2526 text c_dash "-"

2527 text c_o "-o"

2528 text c_ua "--user-agent"

2529 text c_uav "aienos-wizard/alpha"

2530 text t_part ".part"

2531 text t_curlog "/download.log"

2532 text m_have "The model is already here and verified. Nothing to download."

2533 text m_l1 "Downloading "

2534 text m_l2 "from Hugging Face: "

2535 text m_l3 " in "

2536 text m_l4 " files."

2537 text m_l5 "Every file is checked against its SHA-256 before it is used."

2538 text m_l6 "A cut connection resumes where it stopped. q is not read here; Ctrl+C stops."

2539 text m_fail "The download or a hash check failed. Nothing broken was kept."

2540 text m_fail2 "Run aienos again to resume. The log is ~/.local/share/aienos/download.log."

2541 text m_done "Every model file is downloaded and matches its SHA-256."

2542 text t_dlocal "/.local"

2543 text t_dshare "/share"

2544

2545 note ui: 0 animate, 1 scene rows, 2 step, 3 last frame ns, 4 bytes done, 5 bytes total,

2546 note 6 bar shown, 7 files done, 8 files total, 9 engine pid, 10 frames since step entry.

2547

2548 fn pclear to void

2549 put ptn 0 0

2550 end

2551

2552 fn pl t view uchar * to void

2553 n = get ptn 0

2554 for i ulong len t

2555 if lt add n i len pt

2556 put pt add n i get t i

2557 end

2558 end

2559 m = add n len t

2560 if gt m len pt

2561 m = len pt

2562 end

2563 put ptn 0 m

2564 end

2565

2566 fn pc b uchar to void

2567 n = get ptn 0

2568 if lt n len pt

2569 put pt n b

2570 put ptn 0 add n 1

2571 end

2572 end

2573

2574 fn pln to void

2575 pc 10

2576 end

2577

2578 fn plnum v ulong to void

2579 d = new uchar 20 0

2580 k = ulong 0

2581 x = v

2582 while true bound 21

2583 put d k uchar add rem x 10 48

2584 k = add k 1

2585 x = div x 10

2586 if eq x 0

2587 break

2588 end

2589 end

2590 for i ulong k

2591 pc get d sub sub k 1 i

2592 end

2593 end

2594

2595 note Gigabytes (10^9 bytes) rounded to one decimal.

2596 fn plgb v ulong to void

2597 r = add v `50000000`

2598 plnum div r `1000000000`

2599 pc 46

2600 plnum div rem r `1000000000` `100000000`

2601 pl t_gb

2602 end

2603

2604 note The base folder ~/.local/share/aienos as text in the panel, spelled with a tilde.

2605 fn plbase to void

2606 pl t_tbase

2607 end

2608

2609 fn prompt t view uchar * to void

2610 put ppn 0 0

2611 for i ulong len t

2612 if lt i len pp

2613 put pp i get t i

2614 end

2615 end

2616 put ppn 0 len t

2617 end

2618

2619 fn mark b uchar to void

2620 if eq b 1

2621 fg 255 196 90

2622 end

2623 if eq b 2

2624 sgr0

2625 end

2626 if eq b 3

2627 fg 120 220 120

2628 end

2629 if eq b 4

2630 fg 255 100 90

2631 end

2632 if eq b 5

2633 fg 140 140 165

2634 end

2635 if eq b 6

2636 bold

2637 fg 245 245 255

2638 end

2639 end

2640

2641 fn sname i ulong to void

2642 if eq i 0

2643 emit s_n0

2644 end

2645 if eq i 1

2646 emit s_n1

2647 end

2648 if eq i 2

2649 emit s_n2

2650 end

2651 if eq i 3

2652 emit s_n3

2653 end

2654 if eq i 4

2655 emit s_n4

2656 end

2657 if eq i 5

2658 emit s_n5

2659 end

2660 if eq i 6

2661 emit s_n6

2662 end

2663 if eq i 7

2664 emit s_n7

2665 end

2666 end

2667

2668 fn header row ulong to void

2669 mv row 1

2670 bg 18 16 28

2671 fg 255 196 90

2672 bold

2673 emit s_title

2674 sgr0

2675 bg 18 16 28

2676 fg 200 200 220

2677 emit s_step

2678 num add get ui 2 1

2679 emit s_of

2680 sname get ui 2

2681 fg 120 120 150

2682 emit s_omega

2683 eol

2684 sgr0

2685 end

2686

2687 note Draw the panel lines from row r0 on, at most rows lines, each cleared to the end of the line.

2688 note Put one panel byte at column col (counted from 3); bytes past the terminal's width are

2689 note dropped so a long line never wraps into the next one. Returns the new column.

2690 fn pput b uchar col ulong to ulong

2691 if ge col sub get tw 0 1

2692 ret col

2693 end

2694 putb b

2695 if eq and b 192 128

2696 ret col

2697 end

2698 ret add col 1

2699 end

2700

2701 fn pdraw r0 ulong rows ulong colour bool to void

2702 row = r0

2703 col = ulong 3

2704 i = ulong 0

2705 n = get ptn 0

2706 mv row 3

2707 eol

2708 while lt i n bound 8193

2709 b = get pt i

2710 if eq b 10

2711 row = add row 1

2712 if ge row add r0 rows

2713 ret

2714 end

2715 if colour

2716 sgr0

2717 end

2718 mv row 1

2719 eol

2720 mv row 3

2721 col = 3

2722 else

2723 if lt b 7

2724 if colour

2725 mark b

2726 end

2727 else

2728 col = pput b col

2729 end

2730 end

2731 i = add i 1

2732 end

2733 if colour

2734 sgr0

2735 end

2736 row = add row 1

2737 while lt row add r0 rows bound 256

2738 mv row 1

2739 eol

2740 row = add row 1

2741 end

2742 end

2743

2744 note The progress bar: done/total bytes as a gold bar, the percentage and the file count.

2745 fn pbar row ulong to void

2746 mv row 3

2747 eol

2748 if eq get ui 6 0

2749 ret

2750 end

2751 w = ulong 40

2752 tot = get ui 5

2753 if eq tot 0

2754 tot = 1

2755 end

2756 dn = get ui 4

2757 if gt dn tot

2758 dn = tot

2759 end

2760 f = div mul dn w tot

2761 fg 255 196 90

2762 for i ulong w

2763 if lt i f

2764 bg 255 170 60

2765 else

2766 bg 50 44 70

2767 end

2768 putb 32

2769 end

2770 sgr0

2771 putb 32

2772 numw div mul dn 100 tot 3

2773 putb 37

2774 putb 32

2775 putb 32

2776 num get ui 7

2777 emit t_slash

2778 num get ui 8

2779 emit t_files

2780 end

2781

2782 fn pprompt row ulong colour bool to void

2783 mv row 3

2784 eol

2785 if colour

2786 fg 255 196 90

2787 bold

2788 end

2789 putb 62

2790 putb 32

2791 for i ulong get ppn 0

2792 putb get pp i

2793 end

2794 if colour

2795 sgr0

2796 end

2797 end

2798

2799 note One animation frame: the scene, the header, the panel, the bar and the prompt.

2800 fn frame to void

2801 if eq get ui 0 0

2802 ret

2803 end

2804 sh = get ui 1

2805 t = get th 0

2806 home

2807 hframe sh

2808 header add sh 1

2809 pdraw add sh 2 sub sub t sh 4 true

2810 pbar sub t 1

2811 pprompt t true

2812 w = flush

2813 put ui 3 ulong monons

2814 put ui 10 add get ui 10 1

2815 end

2816

2817 note Draw a frame only when 80 ms have passed since the last one; used inside long loops.

2818 fn tickui to void

2819 if eq get ui 0 0

2820 ret

2821 end

2822 if gt sub ulong monons get ui 3 `80000000`

2823 frame

2824 end

2825 end

2826

2827 note Plain mode (no terminal or too small): print the panel once, without colour or animation.

2828 fn plainout to void

2829 putb 10

2830 emit s_title

2831 emit s_step

2832 num add get ui 2 1

2833 emit s_of

2834 sname get ui 2

2835 putb 10

2836 for i ulong get ptn 0

2837 b = get pt i

2838 if or ge b 7 eq b 10

2839 putb b

2840 end

2841 end

2842 putb 10

2843 if gt get ui 6 0

2844 pbarp

2845 end

2846 w = flush

2847 end

2848

2849 fn pbarp to void

2850 tot = get ui 5

2851 if eq tot 0

2852 tot = 1

2853 end

2854 num div mul get ui 4 100 tot

2855 putb 37

2856 putb 32

2857 num get ui 7

2858 emit t_slash

2859 num get ui 8

2860 emit t_files

2861 putb 10

2862 end

2863

2864 fn enter i ulong to void

2865 put ui 2 i

2866 put ui 6 0

2867 put ui 10 0

2868 if eq get ui 0 1

2869 cls

2870 end

2871 end

2872

2873 note Show the step: a frame, or in plain mode the panel text.

2874 fn show to void

2875 if eq get ui 0 1

2876 frame

2877 else

2878 plainout

2879 end

2880 end

2881

2882 note Wait for one line of input while the hole keeps turning. Returns its length or -1 at end of input.

2883 fn ask to long

2884 if eq get ui 0 1

2885 while true bound 999999

2886 frame

2887 k = waitio 0 1 `80000000`

2888 if ne k 0

2889 break

2890 end

2891 end

2892 else

2893 for i ulong get ppn 0

2894 putb get pp i

2895 end

2896 putb 58

2897 putb 32

2898 w = flush

2899 end

2900 ret rline

2901 end

2902

2903 note Keep animating for about ms milliseconds (plain mode returns at once).

2904 fn hold ms ulong to void

2905 if eq get ui 0 0

2906 ret

2907 end

2908 st = ulong monons

2909 while lt sub ulong monons st mul ms `1000000` bound 100000

2910 frame

2911 s = sleepns `60000000`

2912 end

2913 end

2914

2915 note ---------- SHA-256 of a file, with the Omega unit in sha256.om ----------

2916

2917 note Hash the file named by pb into dg, adding its bytes to ui 4 as it goes. Returns the size or -errno.

2918 fn fhash to long

2919 c = new uchar 104 0

2920 buf = new uchar `1048576` 0

2921 o = new uchar 32 0

2922 fd = fopen pb 0 get pbn 0 524288 0

2923 if lt fd 0

2924 ret fd

2925 end

2926 sha256_init c

2927 tot = ulong 0

2928 while true bound 999999

2929 k = read int fd buf 0 len buf

2930 if lt k 0

2931 x = fclose int fd

2932 ret k

2933 end

2934 if eq k 0

2935 break

2936 end

2937 sha256_update c part buf 0 ulong k

2938 tot = add tot ulong k

2939 put ui 4 add get ui 4 ulong k

2940 tickui

2941 end

2942 x = fclose int fd

2943 sha256_final c o

2944 for i ulong 32

2945 put dg i get o i

2946 end

2947 ret long tot

2948 end

2949

2950 note Does dg equal the 64 lowercase hex digits at mf[o]?

2951 fn dgis o ulong to bool

2952 for i ulong 32

2953 b = get dg i

2954 if ne get mf add o mul i 2 hexd ulong shr b 4

2955 ret false

2956 end

2957 if ne get mf add add o mul i 2 1 hexd ulong and b 15

2958 ret false

2959 end

2960 end

2961 ret true

2962 end

2963

2964 note ---------- manifests ----------

2965

2966 note Load the file named by pb into mf. Returns its length or -errno.

2967 fn mload to long

2968 n = slurp

2969 if lt n 0

2970 ret n

2971 end

2972 if gt get rbn 0 len mf

2973 ret -27

2974 end

2975 for i ulong get rbn 0

2976 put mf i get rb i

2977 end

2978 put mfn 0 get rbn 0

2979 ret n

2980 end

2981

2982 fn mfat o ulong t view uchar * to bool

2983 if gt add o len t get mfn 0

2984 ret false

2985 end

2986 for i ulong len t

2987 if ne get mf add o i get t i

2988 ret false

2989 end

2990 end

2991 ret true

2992 end

2993

2994 fn mfnl o ulong to ulong

2995 i = o

2996 while lt i get mfn 0 bound 65537

2997 if eq get mf i 10

2998 ret i

2999 end

3000 i = add i 1

3001 end

3002 ret get mfn 0

3003 end

3004

3005 fn mfnum o ulong to ulong

3006 x = ulong 0

3007 i = o

3008 while lt i get mfn 0 bound 21

3009 c = get mf i

3010 if or lt c 48 gt c 57

3011 ret x

3012 end

3013 x = add mul x 10 ulong sub c 48

3014 i = add i 1

3015 end

3016 ret x

3017 end

3018

3019 note Model manifest lines: "name N", "url U", "bytes B", "files F", then "SHA256 SIZE PATH" per file.

3020

3021 note Offset of the value after key t at the start of a manifest line, or the manifest length.

3022 fn mkey t view uchar * to ulong

3023 o = ulong 0

3024 while lt o get mfn 0 bound 65537

3025 if mfat o t

3026 ret add o len t

3027 end

3028 o = add mfnl o 1

3029 end

3030 ret get mfn 0

3031 end

3032

3033 fn mopen to bool

3034 pclr

3035 proot

3036 pstr t_share

3037 n = mload

3038 if lt n 0

3039 ret false

3040 end

3041 o = mkey m_name

3042 e = mfnl o

3043 if ge o e

3044 ret false

3045 end

3046 put mnn 0 0

3047 for i ulong sub e o

3048 if lt i len mnm

3049 put mnm i get mf add o i

3050 put mnn 0 add i 1

3051 end

3052 end

3053 ret true

3054 end

3055

3056 fn mbytes to ulong

3057 ret mfnum mkey m_bytes

3058 end

3059

3060 fn mfiles to ulong

3061 ret mfnum mkey m_files

3062 end

3063

3064 fn pbase to void

3065 pclr

3066 phome

3067 pstr t_base

3068 end

3069

3070 note pb = ~/.local/share/aienos/models/NAME

3071 fn pmodel to void

3072 pbase

3073 pstr t_models

3074 for i ulong get mnn 0

3075 pbyte get mnm i

3076 end

3077 end

3078

3079 fn mdone to bool

3080 if not mopen

3081 ret false

3082 end

3083 pmodel

3084 pstr t_vfy

3085 ret pexist

3086 end

3087

3088 note ---------- install step: verify this release ----------

3089

3090 note Verify root/SHA256SUMS ("HEX PATH" lines). Returns the number of files checked, or the

3091 note negative offset+1 of the first bad line.

3092 fn sums to long

3093 pclr

3094 proot

3095 pstr t_sums

3096 n = mload

3097 if lt n 0

3098 ret -1

3099 end

3100 put ui 4 0

3101 put ui 5 sumbytes

3102 put ui 6 1

3103 put ui 7 0

3104 put ui 8 sumcount

3105 o = ulong 0

3106 k = long 0

3107 while lt o get mfn 0 bound 65537

3108 e = mfnl o

3109 if ishex o e

3110 r = sumline o e

3111 if not r

3112 ret neg long add o 1

3113 end

3114 k = add k 1

3115 put ui 7 ulong k

3116 end

3117 o = add e 1

3118 end

3119 ret k

3120 end

3121

3122 fn sumline o ulong e ulong to bool

3123 pclr

3124 proot

3125 pbyte 47

3126 for i ulong sub sub e o 66

3127 pbyte get mf add add o 66 i

3128 end

3129 r = fhash

3130 if lt r 0

3131 ret false

3132 end

3133 ret dgis o

3134 end

3135

3136 fn sumcount to ulong

3137 k = ulong 0

3138 o = ulong 0

3139 while lt o get mfn 0 bound 65537

3140 e = mfnl o

3141 if ishex o e

3142 k = add k 1

3143 end

3144 o = add e 1

3145 end

3146 ret k

3147 end

3148

3149 note Total size of the files listed in SHA256SUMS (for the progress bar).

3150 fn sumbytes to ulong

3151 t = ulong 0

3152 o = ulong 0

3153 while lt o get mfn 0 bound 65537

3154 e = mfnl o

3155 if ishex o e

3156 pclr

3157 proot

3158 pbyte 47

3159 for i ulong sub sub e o 66

3160 pbyte get mf add add o 66 i

3161 end

3162 if eq pstat 0

3163 t = add t ssize

3164 end

3165 end

3166 o = add e 1

3167 end

3168 ret t

3169 end

3170

3171 fn mkdirs to bool

3172 pclr

3173 phome

3174 pstr t_dlocal

3175 r = makedir pb 0 get pbn 0 493

3176 pstr t_dshare

3177 r = makedir pb 0 get pbn 0 493

3178 pbase

3179 r = makedir pb 0 get pbn 0 448

3180 pmodel

3181 pdrop add get mnn 0 1

3182 r = makedir pb 0 get pbn 0 448

3183 pmodel

3184 r = makedir pb 0 get pbn 0 448

3185 ret or eq r 0 eq r -17

3186 end

3187

3188 fn stinst to bool

3189 enter 4

3190 pclear

3191 pl i_l1

3192 pln

3193 pl i_l2

3194 pln

3195 pln

3196 pc 5

3197 pl i_cut

3198 pln

3199 pl i_cut2

3200 pc 2

3201 prompt t_wait

3202 show

3203 k = sums

3204 put ui 6 0

3205 pclear

3206 if lt k 0

3207 pc 4

3208 pl i_bad

3209 pc 2

3210 pln

3211 pl i_bad2

3212 prompt t_close

3213 show

3214 r = ask

3215 ret false

3216 end

3217 pc 3

3218 plnum ulong k

3219 pl i_ok

3220 pc 2

3221 pln

3222 if not mkdirs

3223 pc 4

3224 pl t_mkfail

3225 pc 2

3226 prompt t_close

3227 show

3228 r = ask

3229 ret false

3230 end

3231 pl i_md1

3232 plbase

3233 pl t_models

3234 for i ulong get mnn 0

3235 pc get mnm i

3236 end

3237 pl i_md2

3238 pln

3239 pln

3240 pc 5

3241 pl i_cut

3242 pln

3243 pl i_cut2

3244 pc 2

3245 prompt t_next

3246 hold 1500

3247 show

3248 r = ask

3249 ret ge r 0

3250 end

3251

3252 note ---------- model download ----------

3253

3254 note Per file line at mf[o..e): "SHA SIZE PATH". Puts the path start in ui 11 and returns the size.

3255 fn fline o ulong e ulong to ulong

3256 s = add o 65

3257 sz = mfnum s

3258 i = s

3259 while and lt i e ne get mf i 32 bound 32

3260 i = add i 1

3261 end

3262 put ui 11 add i 1

3263 ret sz

3264 end

3265

3266 note pb = model folder / PATH (from mf[ui 11 .. e)).

3267 fn pmfile e ulong to void

3268 pmodel

3269 pbyte 47

3270 for i ulong sub e get ui 11

3271 pbyte get mf add get ui 11 i

3272 end

3273 end

3274

3275 note Run curl for URL base + PATH into pb + ".part", animating while it runs. Returns curl's status.

3276 fn fetch e ulong sz ulong to long

3277 pkclr

3278 if not findbin h_curl

3279 ret -2

3280 end

3281 pkpath

3282 pkstr c_f

3283 pkstr c_s

3284 pkstr c_r

3285 pkstr c_5

3286 pkstr c_ua

3287 pkstr c_uav

3288 pkstr c_c

3289 pkstr c_dash

3290 pkstr c_o

3291 pmfile e

3292 pstr t_part

3293 savep

3294 pkpath

3295 pkurl e

3296 pbase

3297 pstr t_curlog

3298 ret runbg sz

3299 end

3300

3301 note The URL: the manifest's url value, then PATH.

3302 fn pkurl e ulong to void

3303 u = mkey m_url

3304 ue = mfnl u

3305 pclr

3306 for i ulong sub ue u

3307 pbyte get mf add u i

3308 end

3309 for i ulong sub e get ui 11

3310 pbyte get mf add get ui 11 i

3311 end

3312 pkpath

3313 end

3314

3315 note Like runpk, but animates and follows the .part file's size while the child runs.

3316 fn runbg sz ulong to long

3317 lfd = fopen pb 0 get pbn 0 525377 384

3318 if lt lfd 0

3319 ret lfd

3320 end

3321 pid = fork

3322 if lt pid 0

3323 ret pid

3324 end

3325 if eq pid 0

3326 d = dupfd int lfd 1 0

3327 d = dupfd int lfd 2 0

3328 r = execprog pk 0 get pkn 0

3329 exit 127

3330 end

3331 c = fclose int lfd

3332 base = get ui 4

3333 while true bound 999999

3334 r = waitpid int pid ws 0 4 1

3335 if eq r pid

3336 ret wcode

3337 end

3338 if lt r 0

3339 ret r

3340 end

3341 put ui 4 add base partsz

3342 frame

3343 s = sleepns `200000000`

3344 end

3345 ret -4

3346 end

3347

3348 note Size of the .part file being written (its path was saved in ppt by fetch).

3349 fn partsz to ulong

3350 r = stat ppt 0 get pptn 0 sb 0 128

3351 if ne r 0

3352 ret 0

3353 end

3354 ret ssize

3355 end

3356

3357 fn savep to void

3358 for i ulong get pbn 0

3359 put ppt i get pb i

3360 end

3361 put pptn 0 get pbn 0

3362 end

3363

3364 fn mstep to bool

3365 enter 5

3366 if not mopen

3367 ret false

3368 end

3369 if mdone

3370 pclear

3371 pc 3

3372 pl m_have

3373 pc 2

3374 pln

3375 prompt t_next

3376 show

3377 r = ask

3378 ret ge r 0

3379 end

3380 pclear

3381 pl m_l1

3382 pc 6

3383 for i ulong get mnn 0

3384 pc get mnm i

3385 end

3386 pc 2

3387 pln

3388 pl m_l2

3389 plgb mbytes

3390 pl m_l3

3391 plnum mfiles

3392 pl m_l4

3393 pln

3394 pl m_l5

3395 pln

3396 pln

3397 pc 5

3398 pl m_l6

3399 pc 2

3400 prompt t_wait

3401 put ui 4 0

3402 put ui 5 mbytes

3403 put ui 6 1

3404 put ui 7 0

3405 put ui 8 mfiles

3406 show

3407 r = mall

3408 put ui 6 0

3409 if not r

3410 pclear

3411 pc 4

3412 pl m_fail

3413 pc 2

3414 pln

3415 pl m_fail2

3416 prompt t_close

3417 show

3418 x = ask

3419 ret false

3420 end

3421 pmodel

3422 pstr t_vfy

3423 put rb 0 111

3424 put rb 1 107

3425 put rb 2 10

3426 x = spill 3

3427 pclear

3428 pc 3

3429 pl m_done

3430 pc 2

3431 pln

3432 prompt t_next

3433 show

3434 x = ask

3435 ret ge x 0

3436 end

3437

3438 note Is mf[o..e) a file line: 64 lowercase hex digits, then a space?

3439 fn ishex o ulong e ulong to bool

3440 if le sub e o 66

3441 ret false

3442 end

3443 for i ulong 64

3444 c = get mf add o i

3445 if not or and ge c 48 le c 57 and ge c 97 le c 102

3446 ret false

3447 end

3448 end

3449 ret eq get mf add o 64 32

3450 end

3451

3452 note Fetch and verify every file of the model manifest.

3453 fn mall to bool

3454 o = ulong 0

3455 while lt o get mfn 0 bound 65537

3456 e = mfnl o

3457 if ishex o e

3458 if not mfile o e

3459 ret false

3460 end

3461 put ui 7 add get ui 7 1

3462 end

3463 o = add e 1

3464 end

3465 ret true

3466 end

3467

3468 note One model file: keep it if it is there and hashes right, else download to .part, check the

3469 note size and hash, then rename it into place. A file that fails its hash is deleted.

3470 fn mfile o ulong e ulong to bool

3471 sz = fline o e

3472 pmfile e

3473 if eq pstat 0

3474 if eq ssize sz

3475 r = fhash

3476 if and ge r 0 dgis o

3477 ret true

3478 end

3479 put ui 4 sub get ui 4 sz

3480 end

3481 r = unlink pb 0 get pbn 0

3482 end

3483 ret mget o e sz

3484 end

3485

3486 fn mget o ulong e ulong sz ulong to bool

3487 for tries ulong 2

3488 pmfile e

3489 pstr t_part

3490 st = get ui 4

3491 if eq pstat 0

3492 if gt ssize sz

3493 r = unlink pb 0 get pbn 0

3494 end

3495 end

3496 c = fetch e sz

3497 put ui 4 st

3498 pmfile e

3499 pstr t_part

3500 if and eq c 0 eq pstat 0

3501 if eq ssize sz

3502 h = fhash

3503 if dgis o

3504 ret mplace e

3505 end

3506 end

3507 end

3508 pmfile e

3509 pstr t_part

3510 r = unlink pb 0 get pbn 0

3511 end

3512 ret false

3513 end

3514

3515 note Rename model/PATH.part to model/PATH with renameat2 (packed list of the two paths).

3516 fn mplace e ulong to bool

3517 pkclr

3518 pmfile e

3519 pstr t_part

3520 pkpath

3521 pmfile e

3522 pkpath

3523 r = renames pk 0 get pkn 0 0

3524 ret eq r 0

3525 end

3526 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

3527 note engine.om: start, watch and stop the engine (aien-serve-http, Core ship/motor-l387, engine omega) on

3528 note 127.0.0.1, check from /proc that it loaded no CUDA library, the first-chat screen, the done

3529 note screen, the uninstaller and the rollback.

3530

3531 const PORT ulong 18100

3532 text e_bin "/bin/aien-serve-http"

3533 text e_eng "--engine"

3534 text e_omega "omega"

3535 text e_mdir "--model-dir"

3536 text e_port "--port"

3537 text e_ctx "--max-context"

3538 text e_ctxv "49152"

3539 text e_cap "--max-tokens-cap"

3540 text e_capv "16384"

3541 text e_thk "--thinking"

3542 text e_off "off"

3543 text e_slot "--batch-slots"

3544 text e_slotv "8"

3545 text e_log "/engine.log"

3546 text e_pid "/engine.pid"

3547 text e_null "/dev/null"

3548 text e_proc "/proc/"

3549 text e_exe "/exe"

3550 text e_maps "/maps"

3551 text e_name "aien-serve-http"

3552 text e_cu1 "libcuda"

3553 text e_cu2 "libcublas"

3554 text e_cu3 "libcudart"

3555 text e_cu4 "libnvidia-"

3556 text f_skip1 "I am not starting the engine now: "

3557 text f_mem "another model is using this GB10's memory."

3558 text f_lock "another process holds the GB10 lock."

3559 text f_skip2 "Your model is installed. When the GPU is free, run: aienos chat"

3560 text f_load1 "Starting the engine (Core ship/motor-l387 `59b05a71`) and loading the 35B onto the GB10."

3561 text f_load2 "The first load reads about 37.5 GB, so it can take a few minutes."

3562 text f_fail1 "The engine stopped before it was ready. Its log: ~/.local/share/aienos/engine.log"

3563 text f_q "Say hello in one short sentence, and tell me what you are."

3564 text f_you "you "

3565 text f_ai "model "

3566 text f_ttf "first token after "

3567 text f_ms " ms"

3568 text f_cuda "CUDA libraries in the engine's memory map (/proc/"

3569 text f_cuda2 "/maps): "

3570 text f_run "The engine keeps running on 127.0.0.1:18100. Stop it with: aienos stop"

3571 text d_l1 "Your local model is ready."

3572 text d_l0 "Your model is installed and verified. Start it with aienos chat when the GPU is free."

3573 text d_l2 " aienos chat talk to it in this terminal"

3574 text d_l3 " aienos doctor check this machine again"

3575 text d_l4 " aienos stop stop the engine"

3576 text d_l5 " aienos source where my .om source lives"

3577 text d_l6 " aienos uninstall remove everything AienOS put on this machine"

3578 text d_l7 "OpenAI-style API: http://127.0.0.1:18100/v1/chat/completions"

3579 text u_list "/installed-files"

3580 text u_sure "This removes AienOS from this machine. Type yes to remove it"

3581 text u_keep "--keep-model"

3582 text u_yes "--yes"

3583 text u_done "AienOS is removed. NVIDIA's driver and CUDA were never touched."

3584 text u_kept "The model was kept in ~/.local/share/aienos/models."

3585 text u_no "Nothing was removed."

3586 text u_stop "The engine did not stop; nothing was removed."

3587 text u_dot ".."

3588 text u_mods "models"

3589 text r_rel "/releases"

3590 text r_cur "/current"

3591 text r_new "/current.new"

3592 text r_pre "releases/"

3593 text r_none "There is no other release to roll back to."

3594 text r_ok "current now points to "

3595

3596 note The packed argument list of the live 35B server's command (same flags), on PORT.

3597 fn eargs to void

3598 pkclr

3599 pclr

3600 proot

3601 pstr e_bin

3602 pkpath

3603 pkstr e_eng

3604 pkstr e_omega

3605 pkstr e_mdir

3606 pmodel

3607 pkpath

3608 pkstr e_port

3609 pknum PORT

3610 pkstr e_ctx

3611 pkstr e_ctxv

3612 pkstr e_cap

3613 pkstr e_capv

3614 pkstr e_thk

3615 pkstr e_off

3616 pkstr e_slot

3617 pkstr e_slotv

3618 end

3619

3620 note Start the engine in its own session, output appended to engine.log, pid in engine.pid.

3621 fn estart to long

3622 eargs

3623 pbase

3624 pstr e_log

3625 lfd = fopen pb 0 get pbn 0 525377 384

3626 if lt lfd 0

3627 ret lfd

3628 end

3629 nfd = fopen e_null 0 len e_null 524288 0

3630 pid = fork

3631 if lt pid 0

3632 ret pid

3633 end

3634 if eq pid 0

3635 s = setsid

3636 d = dupfd int nfd 0 0

3637 d = dupfd int lfd 1 0

3638 d = dupfd int lfd 2 0

3639 r = execprog pk 0 get pkn 0

3640 exit 127

3641 end

3642 c = fclose int lfd

3643 c = fclose int nfd

3644 put ui 9 ulong pid

3645 put rbn 0 0

3646 pclr

3647 pnum ulong pid

3648 for i ulong get pbn 0

3649 put rb i get pb i

3650 end

3651 put rb get pbn 0 10

3652 k = add get pbn 0 1

3653 pbase

3654 pstr e_pid

3655 r = spill k

3656 ret pid

3657 end

3658

3659 note The pid in engine.pid when that process is still aien-serve-http, else 0.

3660 fn epid to ulong

3661 pbase

3662 pstr e_pid

3663 n = slurp

3664 if le n 0

3665 ret 0

3666 end

3667 p = rbnum 0

3668 if eq p 0

3669 ret 0

3670 end

3671 pclr

3672 pstr e_proc

3673 pnum p

3674 pstr e_exe

3675 n = readlnk pb 0 get pbn 0 rb 0 4096

3676 if le n 0

3677 ret 0

3678 end

3679 put rbn 0 ulong n

3680 if lt ulong n len e_name

3681 ret 0

3682 end

3683 if rbat sub ulong n len e_name e_name

3684 ret p

3685 end

3686 ret 0

3687 end

3688

3689 note Stop the engine: SIGTERM, then wait up to 120 s for it to go. Returns true when it is gone.

3690 fn estop to bool

3691 p = epid

3692 if eq p 0

3693 ret true

3694 end

3695 r = killpid int p 15

3696 for i ulong 1200

3697 x = waitpid int p ws 0 4 1

3698 if eq epid 0

3699 pbase

3700 pstr e_pid

3701 x = unlink pb 0 get pbn 0

3702 ret true

3703 end

3704 s = sleepns `100000000`

3705 end

3706 ret false

3707 end

3708

3709 note Count the CUDA user-space libraries in /proc/PID/maps (libcuda, libcublas, libcudart,

3710 note libnvidia-*). Returns the count, or -1 when the maps could not be read.

3711 fn ecuda p ulong to long

3712 pclr

3713 pstr e_proc

3714 pnum p

3715 pstr e_maps

3716 n = slurp

3717 if lt n 0

3718 ret -1

3719 end

3720 k = long 0

3721 o = ulong 0

3722 while lt o get rbn 0 bound 524289

3723 e = rbfind o t_nl

3724 if culine o e

3725 k = add k 1

3726 end

3727 o = add e 1

3728 end

3729 ret k

3730 end

3731

3732 fn culine o ulong e ulong to bool

3733 a = or rbin o e e_cu1 rbin o e e_cu2

3734 b = or rbin o e e_cu3 rbin o e e_cu4

3735 ret or a b

3736 end

3737

3738 note Wait for the engine's /health while the hole turns. Gives up after limit seconds or when the

3739 note process exits. Returns true when it answers.

3740 fn ewait limit ulong to bool

3741 st = ulong monons

3742 p = get ui 9

3743 while lt sub ulong monons st mul limit `1000000000` bound 999999

3744 if alive PORT

3745 ret true

3746 end

3747 x = waitpid int p ws 0 4 1

3748 if eq x long p

3749 ret false

3750 end

3751 put ui 4 div sub ulong monons st `1000000000`

3752 for k ulong 20

3753 frame

3754 s = sleepns `100000000`

3755 end

3756 end

3757 ret false

3758 end

3759

3760 fn ckskip to bool

3761 if eq get dk 6 1

3762 pl f_skip1

3763 pl f_lock

3764 ret true

3765 end

3766 if eq get dk 3 1

3767 pl f_skip1

3768 pl f_mem

3769 ret true

3770 end

3771 ret false

3772 end

3773

3774 note The first-chat step. Returns false only when the engine failed to come up.

3775 fn stchat to bool

3776 enter 6

3777 pclear

3778 put ui 11 0

3779 if ckskip

3780 pln

3781 pln

3782 pl f_skip2

3783 prompt t_next

3784 show

3785 r = ask

3786 ret true

3787 end

3788 if not alive PORT

3789 pl f_load1

3790 pln

3791 pl f_load2

3792 prompt t_wait

3793 put ui 6 0

3794 show

3795 p = estart

3796 if lt p 0

3797 ret false

3798 end

3799 if not ewait 2400

3800 pclear

3801 pc 4

3802 pl f_fail1

3803 pc 2

3804 prompt t_close

3805 show

3806 r = ask

3807 ret false

3808 end

3809 end

3810 put ui 11 1

3811 firstq

3812 ret true

3813 end

3814

3815 note Ask the first question and stream the answer under the picture, then show the evidence lines.

3816 fn firstq to void

3817 put hsn 0 0

3818 hstr j_user

3819 put ibn 0 len f_q

3820 for i ulong len f_q

3821 put ib i get f_q i

3822 end

3823 hesc

3824 hstr j_end

3825 pclear

3826 pc 5

3827 pl f_you

3828 pc 2

3829 pl f_q

3830 pln

3831 pc 1

3832 pl f_ai

3833 pc 2

3834 prompt t_wait

3835 show

3836 if eq get ui 0 1

3837 mv add get ui 1 4 10

3838 end

3839 r = chatreq PORT

3840 w = flush

3841 ftail

3842 end

3843

3844 fn ftail to void

3845 pclear

3846 pc 3

3847 pl f_ttf

3848 plnum div get nt 1 `1000000`

3849 pl f_ms

3850 pc 2

3851 pln

3852 p = epid

3853 if gt p 0

3854 pl f_cuda

3855 plnum p

3856 pl f_cuda2

3857 c = ecuda p

3858 if eq c 0

3859 pc 3

3860 end

3861 plnum ulong c

3862 pc 2

3863 pln

3864 end

3865 pl f_run

3866 prompt t_next

3867 if eq get ui 0 1

3868 pdraw sub get th 0 4 3 true

3869 pprompt get th 0 true

3870 x = flush

3871 else

3872 plainout

3873 end

3874 r = rline

3875 end

3876

3877 fn stdone ready bool to void

3878 enter 7

3879 pclear

3880 pc 3

3881 if ready

3882 pl d_l1

3883 else

3884 pl d_l0

3885 end

3886 pc 2

3887 pln

3888 pln

3889 pl d_l2

3890 pln

3891 pl d_l3

3892 pln

3893 pl d_l4

3894 pln

3895 pl d_l5

3896 pln

3897 pl d_l6

3898 pln

3899 pln

3900 pc 5

3901 pl d_l7

3902 pc 2

3903 prompt t_close

3904 show

3905 r = ask

3906 end

3907

3908 note ---------- uninstall ----------

3909

3910 note Is pb inside the home folder: HOME + "/" + something, with no ".." component?

3911 fn inhome to bool

3912 h = get hbn 0

3913 if le get pbn 0 add h 1

3914 ret false

3915 end

3916 if le h 1

3917 ret false

3918 end

3919 for i ulong h

3920 if ne get pb i get hb i

3921 ret false

3922 end

3923 end

3924 if ne get pb h 47

3925 ret false

3926 end

3927 for i ulong sub get pbn 0 1

3928 if and eq get pb i 46 eq get pb add i 1 46

3929 ret false

3930 end

3931 end

3932 ret true

3933 end

3934

3935 note Unlink every path in installed-files that lies inside the home folder.

3936 fn ulist to void

3937 pbase

3938 pstr u_list

3939 n = mload

3940 if lt n 0

3941 ret

3942 end

3943 o = ulong 0

3944 while lt o get mfn 0 bound 65537

3945 e = mfnl o

3946 pclr

3947 for i ulong sub e o

3948 pbyte get mf add o i

3949 end

3950 if inhome

3951 r = unlink pb 0 get pbn 0

3952 end

3953 o = add e 1

3954 end

3955 end

3956

3957 note Remove the tree at pb (not following links). depth guards the recursion; keep skips the

3958 note models folder at the top level.

3959 fn rmt depth ulong keep bool to void

3960 d = new uchar 8192 0

3961 if gt depth 32

3962 ret

3963 end

3964 for pass ulong 3

3965 fd = fopen pb 0 get pbn 0 573440 0

3966 if lt fd 0

3967 r = unlink pb 0 get pbn 0

3968 ret

3969 end

3970 while true bound 100000

3971 n = getdnts int fd d 0 8192

3972 if le n 0

3973 break

3974 end

3975 o = ulong 0

3976 while lt o ulong n bound 8192

3977 o = rment d o depth keep

3978 end

3979 end

3980 c = fclose int fd

3981 r = rmdir pb 0 get pbn 0

3982 if or eq r 0 eq r -2

3983 ret

3984 end

3985 end

3986 end

3987

3988 note One directory entry at d[o]: remove it (recursing into directories). Returns the next offset.

3989 fn rment d view uchar 8192 o ulong depth ulong keep bool to ulong

3990 rl = or ulong get d add o 16 shl ulong get d add o 17 8

3991 if eq rl 0

3992 ret 8192

3993 end

3994 k = ulong 0

3995 while ne get d add add o 19 k 0 bound 256

3996 k = add k 1

3997 end

3998 if isdot d add o 19 k

3999 ret add o rl

4000 end

4001 if and and keep eq depth 0 isname d add o 19 k

4002 ret add o rl

4003 end

4004 sv = get pbn 0

4005 pbyte 47

4006 for i ulong k

4007 pbyte get d add add o 19 i

4008 end

4009 if eq get d add o 18 4

4010 rmt add depth 1 keep

4011 else

4012 r = unlink pb 0 get pbn 0

4013 end

4014 put pbn 0 sv

4015 ret add o rl

4016 end

4017

4018 fn isdot d view uchar 8192 o ulong k ulong to bool

4019 if ne get d o 46

4020 ret false

4021 end

4022 if eq k 1

4023 ret true

4024 end

4025 ret and eq k 2 eq get d add o 1 46

4026 end

4027

4028 fn isname d view uchar 8192 o ulong k ulong to bool

4029 if ne k len u_mods

4030 ret false

4031 end

4032 for i ulong k

4033 if ne get d add o i get u_mods i

4034 ret false

4035 end

4036 end

4037 ret true

4038 end

4039

4040 note aienos uninstall [--keep-model] [--yes]

4041 fn uninst keep bool yes bool to int

4042 if not yes

4043 emit u_sure

4044 putb 58

4045 putb 32

4046 w = flush

4047 n = rline

4048 if not ibis t_yes

4049 emit u_no

4050 putb 10

4051 w = flush

4052 ret 0

4053 end

4054 end

4055 if not estop

4056 emit u_stop

4057 putb 10

4058 w = flush

4059 ret 1

4060 end

4061 ulist

4062 pbase

4063 rmt 0 keep

4064 emit u_done

4065 putb 10

4066 if keep

4067 emit u_kept

4068 putb 10

4069 end

4070 w = flush

4071 ret 0

4072 end

4073

4074 note ---------- rollback ----------

4075

4076 note aienos rollback: point current at the newest other release in releases/.

4077 fn rollbk to int

4078 best = new uchar 256 0

4079 pbase

4080 pstr r_cur

4081 n = readlnk pb 0 get pbn 0 rb 0 512

4082 put rbn 0 0

4083 if gt n 0

4084 put rbn 0 ulong n

4085 end

4086 bn = rpick best

4087 if eq bn 0

4088 emit r_none

4089 putb 10

4090 w = flush

4091 ret 1

4092 end

4093 ret rswap best bn

4094 end

4095

4096 note Pick the greatest release name that is not the current target (rb holds the link text).

4097 fn rpick best edit uchar 256 to ulong

4098 d = new uchar 8192 0

4099 bn = ulong 0

4100 pbase

4101 pstr r_rel

4102 fd = fopen pb 0 get pbn 0 540672 0

4103 if lt fd 0

4104 ret 0

4105 end

4106 n = getdnts int fd d 0 8192

4107 c = fclose int fd

4108 if le n 0

4109 ret 0

4110 end

4111 o = ulong 0

4112 while lt o ulong n bound 8192

4113 rl = or ulong get d add o 16 shl ulong get d add o 17 8

4114 if eq rl 0

4115 break

4116 end

4117 bn = rcand d add o 19 best bn

4118 o = add o rl

4119 end

4120 ret bn

4121 end

4122

4123 note Consider entry name d[o..]: keep it in best when it is greater than best and not current.

4124 fn rcand d view uchar 8192 o ulong best edit uchar 256 bn ulong to ulong

4125 k = ulong 0

4126 while and ne get d add o k 0 lt k 200 bound 256

4127 k = add k 1

4128 end

4129 if eq get d o 46

4130 ret bn

4131 end

4132 if and eq get rbn 0 add len r_pre k rbat len r_pre part d o k

4133 ret bn

4134 end

4135 if not gtname d o k best bn

4136 ret bn

4137 end

4138 for i ulong k

4139 put best i get d add o i

4140 end

4141 ret k

4142 end

4143

4144 fn gtname d view uchar 8192 o ulong k ulong best view uchar 256 bn ulong to bool

4145 for i ulong k

4146 if ge i bn

4147 ret true

4148 end

4149 a = get d add o i

4150 b = get best i

4151 if ne a b

4152 ret gt a b

4153 end

4154 end

4155 ret false

4156 end

4157

4158 fn rswap best view uchar 256 bn ulong to int

4159 pkclr

4160 pclr

4161 pstr r_pre

4162 for i ulong bn

4163 pbyte get best i

4164 end

4165 pkpath

4166 pbase

4167 pstr r_new

4168 x = unlink pb 0 get pbn 0

4169 pkpath

4170 r = symlnk pk 0 get pkn 0

4171 if ne r 0

4172 ret 1

4173 end

4174 pkclr

4175 pbase

4176 pstr r_new

4177 pkpath

4178 pbase

4179 pstr r_cur

4180 pkpath

4181 r = renames pk 0 get pkn 0 0

4182 if ne r 0

4183 ret 1

4184 end

4185 emit r_ok

4186 emit r_pre

4187 for i ulong bn

4188 putb get best i

4189 end

4190 putb 10

4191 w = flush

4192 ret 0

4193 end

4194 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

4195 note main.om: the aienos command. With no argument (or "wizard") it runs the full-screen wizard;

4196 note "doctor", "chat", "start", "stop", "verify", "source", "about", "uninstall" and "rollback" are the

4197 note small commands beside it. Build: concatenate sha256.om lib.om hole.om doctor.om net.om steps.om

4198 note engine.om main.om, in that order, and compile the result with the pinned omc (see build.sh).

4199

4200 text v_tag "alpha-`20261026`.2"

4201 text a_l1 "Sovereign Intelligence alpha-`20261026`.2: the installer and the aienos command"

4202 text a_l2 "written in Omega (.om), compiled by omc sha256 `befb8199db8c4bca188a494dfaac2a6f0ee5c36fcea11188c75666c55fce8a1d`"

4203 text a_l3 " (aien-dev/omega-mv `3364a1dfd0ca50c1b82bf19ba34932d8bc10a7a9`, seed/out/omc)"

4204 text a_l4 "engine: aien-serve-http sha256 `19173f9ec3b609fe79af644f84741d8808b92ea8eb3ecec4bc945af6f22b3aeb`,"

4205 text a_l5 " the build that serves the Spark's 35B: aien-dev/aien-sovereign-core-mv branch ship/motor-l387"

4206 text a_l6 " commit `59b05a71a33e4a2f1324db2f2b6407ee82b8c2c3` (a development build, not a Core release tag)"

4207 text a_l7 " evidence: Core evidence/l387-motor-ship (merge train 20261022T0244Z-`bfc41659`, timing runs)"

4208 text a_l8 "GPU path: the engine's statically linked libomega_gpu.a (omega ship/motor-l387 `6de999da`) talks to"

4209 text a_l9 " /dev/nvidiactl, /dev/nvidia0 and /dev/nvidia-uvm. There is no separate CUDA++ runtime."

4210 text a_l10 "model: Qwen/Qwen3.6-35B-A3B-FP8 revision `95a723d08a9490559dae23d0cff1d9466213d989` (37.5 GB)"

4211 text a_l11 " This is the only model offered. A 27B is to come; it is not offered in this release."

4212 text a_l12 "evidence: this engine binary serving the 35B on a GB10 EXERCISED (it is the live server's build);"

4213 text a_l13 " this installer's GB10 install and first token, and the 3x physical qualification: NOT_RUN."

4214 text a_l14 "signature: Ed25519 alpha release key `ff949504b427680039d53c33c85c448546b57d590eb1ecee3bb2ed6c2eaaf54a`"

4215 text a_l15 " (an alpha key; it is rotated to a ceremony key before beta)"

4216 text s_l1 "My Omega source ships with this release:"

4217 text s_l2 "/share/aienos/wizard/"

4218 text s_l3 " sha256.om lib.om hole.om doctor.om net.om steps.om engine.om main.om"

4219 text s_l4 "/share/aienos/aienos.om"

4220 text s_l5 " the same files concatenated in build order: one unit, one compile"

4221 text s_l6 "Also online: https://www.aienos.com/alpha/ and https://github.com/aien-dev/sovereign-intelligence"

4222 text w_l1 "Welcome. I am Drake, and this is Sovereign Intelligence, the AienOS alpha."

4223 text w_l2 "This installer is written in Omega, my own language. It sets up a local model on"

4224 text w_l3 "your DGX Spark that runs on my own engine: no CUDA toolkit, no libcuda, no cuBLAS."

4225 text w_l4 "NVIDIA's kernel driver stays. Everything else NVIDIA ships stays installed, unused."

4226 text w_l5 "Next: doctor, plan, your yes, install, model, first chat. Nothing changes before your yes."

4227 text w_l6 "Type about for versions and evidence, source for my .om source, q to quit."

4228 text w_go "Press Enter to run the doctor"

4229 text x_l1 "This alpha runs on Linux arm64 with an NVIDIA GB10 (DGX Spark) only."

4230 text x_l2 "Here is what is coming: https://www.aienos.com/alpha/"

4231 text x_l3 "I changed nothing. The files the installer unpacked go away with: aienos uninstall"

4232 text p_l1 "Here is exactly what changes, all inside your home folder:"

4233 text p_l2 "/releases/"

4234 text p_l3 " this release, already unpacked and checked"

4235 text p_l4 "/models/"

4236 text p_l5 "~/.local/bin/aienos, the menu entry and the desktop icon (already there)"

4237 text p_l6 "/engine.log the engine's log, when it runs"

4238 text p_l7 "Not touched: NVIDIA's driver, the CUDA toolkit, libcuda, cuBLAS, /usr, /etc. No sudo."

4239 text p_l8 "Undo everything at any time: aienos uninstall"

4240 text p_l9 " the model: "

4241 text p_ok "Press Enter for the last question"

4242 text c_l1 "Type yes to begin. Anything else stops here, and nothing changes."

4243 text c_q "yes or no"

4244 text c_stop "Stopped. Nothing was changed."

4245 text c_fail "Stopped. Run aienos again once the problem above is fixed; it picks up where it left off."

4246 text t_q "q"

4247 text t_about "about"

4248 text t_source "source"

4249 text t_probe "AIENOS_PROBE_ROOT"

4250 text t_home "HOME"

4251 text t_plain "--plain"

4252 text t_exe "/proc/self/exe"

4253 text h_stty "stty"

4254 text h_size "size"

4255 text k_wiz "wizard"

4256 text k_doc "doctor"

4257 text k_chat "chat"

4258 text k_start "start"

4259 text k_stop "stop"

4260 text k_vfy "verify"

4261 text k_unin "uninstall"

4262 text k_roll "rollback"

4263 text k_help "usage: aienos [wizard [--plain] | doctor | chat | start | stop | verify | source | about | uninstall [--keep-model] [--yes] | rollback]"

4264 text n_nohome "HOME is not set; I cannot tell where to install."

4265 text n_badrt "I cannot find my own folder (/proc/self/exe)."

4266 text n_vok " files match SHA256SUMS"

4267 text n_vbad "a file does not match SHA256SUMS"

4268 text n_start "engine started, pid "

4269 text n_ready "engine ready on http://127.0.0.1:18100/v1"

4270 text n_nostrt "engine did not become ready; see ~/.local/share/aienos/engine.log"

4271 text n_stopd "engine stopped"

4272 text n_chat1 "aienos chat: type a message and press Enter. /bye leaves."

4273 text n_bye "/bye"

4274 text n_you "you> "

4275 text n_ai "model> "

4276 text n_err "request failed: "

4277 text t_sp " "

4278

4279 note argument i into ib; returns its length or -1.

4280 fn arg i ulong to long

4281 if ge i ulong argcnt

4282 ret -1

4283 end

4284 n = argread i ib 0 len ib

4285 if lt n 0

4286 ret -1

4287 end

4288 put ibn 0 ulong n

4289 ret n

4290 end

4291

4292 note HOME, the probe prefix and this release's folder (the parent of bin/aienos).

4293 fn setup to bool

4294 sinit

4295 n = envget t_home

4296 if le n 0

4297 ret false

4298 end

4299 for i ulong ulong n

4300 put hb i get eb add len t_home add i 1

4301 end

4302 put hbn 0 ulong n

4303 n = envget t_probe

4304 if gt n 0

4305 for i ulong ulong n

4306 put pr i get eb add len t_probe add i 1

4307 end

4308 put prn 0 ulong n

4309 end

4310 ret selfdir

4311 end

4312

4313 fn selfdir to bool

4314 n = readlnk t_exe 0 len t_exe rt 0 len rt

4315 if or le n 0 ge n long len rt

4316 ret false

4317 end

4318 k = ulong n

4319 s = ulong 0

4320 for pass ulong 2

4321 while and gt k 0 ne get rt sub k 1 47 bound 1024

4322 k = sub k 1

4323 end

4324 if gt k 0

4325 k = sub k 1

4326 end

4327 end

4328 put rtn 0 k

4329 ret gt k 0

4330 end

4331

4332 note Terminal: animate when stdin and stdout are character devices and stty reports at least

4333 note 64 columns and 22 rows; the picture takes what the 12-line panel leaves. The size comes from the host's stty (Omega has no window-size word yet).

4334 fn term plain bool to void

4335 put ui 0 0

4336 put tw 0 80

4337 put th 0 24

4338 if plain

4339 ret

4340 end

4341 r = fstat 0 sb 0 128

4342 if or ne r 0 ne stype 2

4343 ret

4344 end

4345 r = fstat 1 sb 0 128

4346 if or ne r 0 ne stype 2

4347 ret

4348 end

4349 if not findbin h_stty

4350 ret

4351 end

4352 pkclr

4353 pkpath

4354 pkstr h_size

4355 r = runcap

4356 if ne r 0

4357 ret

4358 end

4359 rows = rbnum 0

4360 sp = rbfind 0 t_sp

4361 cols = rbnum add sp 1

4362 if or lt cols 64 lt rows 22

4363 ret

4364 end

4365 if gt cols 400

4366 cols = 400

4367 end

4368 put tw 0 cols

4369 put th 0 rows

4370 note The panel under the picture keeps 12 lines: the plan and the doctor must fit whole.

4371 sh = ulong 6

4372 if gt rows 22

4373 sh = sub rows 16

4374 end

4375 if gt sh 30

4376 sh = 30

4377 end

4378 put ui 1 sh

4379 put ui 0 1

4380 end

4381

4382 fn plines to void

4383 pl w_l1

4384 pln

4385 pln

4386 pl w_l2

4387 pln

4388 pl w_l3

4389 pln

4390 pl w_l4

4391 pln

4392 pln

4393 pl w_l5

4394 pln

4395 pc 5

4396 pl w_l6

4397 pc 2

4398 end

4399

4400 fn about to void

4401 pl a_l1

4402 pln

4403 pl a_l2

4404 pln

4405 pl a_l3

4406 pln

4407 pl a_l4

4408 pln

4409 pl a_l5

4410 pln

4411 pl a_l6

4412 pln

4413 pl a_l7

4414 pln

4415 pl a_l8

4416 pln

4417 pl a_l9

4418 pln

4419 pl a_l10

4420 pln

4421 pl a_l11

4422 pln

4423 pl a_l12

4424 pln

4425 pl a_l13

4426 pln

4427 pl a_l14

4428 pln

4429 pl a_l15

4430 end

4431

4432 fn source to void

4433 pl s_l1

4434 pln

4435 pc 6

4436 plroot

4437 pl s_l2

4438 pc 2

4439 pln

4440 pl s_l3

4441 pln

4442 pc 6

4443 plroot

4444 pl s_l4

4445 pc 2

4446 pln

4447 pl s_l5

4448 pln

4449 pln

4450 pl s_l6

4451 end

4452

4453 fn plroot to void

4454 for i ulong get rtn 0

4455 pc get rt i

4456 end

4457 end

4458

4459 note Welcome; loops on about and source. Returns false to quit.

4460 fn stwel to bool

4461 while true bound 1000

4462 enter 0

4463 pclear

4464 plines

4465 prompt w_go

4466 show

4467 r = ask

4468 if lt r 0

4469 ret false

4470 end

4471 if ibis t_q

4472 ret false

4473 end

4474 if ibis t_about

4475 sub1 true

4476 end

4477 if ibis t_source

4478 sub1 false

4479 end

4480 if not or ibis t_about ibis t_source

4481 ret true

4482 end

4483 end

4484 ret false

4485 end

4486

4487 fn sub1 isab bool to void

4488 pclear

4489 if isab

4490 about

4491 else

4492 source

4493 end

4494 prompt t_next

4495 show

4496 r = ask

4497 end

4498

4499 note Doctor screen. Returns true when the machine can take this alpha.

4500 fn stdoc to bool

4501 enter 1

4502 pclear

4503 need = mneed

4504 ok = doctor need

4505 for i ulong NCHK

4506 dpanel i

4507 end

4508 if not ok

4509 pln

4510 pc 4

4511 pl x_l1

4512 pc 2

4513 pln

4514 pl x_l2

4515 pln

4516 pl x_l3

4517 prompt t_close

4518 show

4519 r = ask

4520 ret false

4521 end

4522 prompt t_next

4523 show

4524 r = ask

4525 ret ge r 0

4526 end

4527

4528 note Bytes the model still needs on disk: none when verified, else its size plus 1 GB.

4529 fn mneed to ulong

4530 if not mopen

4531 ret 0

4532 end

4533 if mdone

4534 ret 0

4535 end

4536 ret add mbytes `1000000000`

4537 end

4538

4539 fn dpanel i ulong to void

4540 k = get dk i

4541 if eq k 0

4542 pc 3

4543 pl k_ok

4544 end

4545 if eq k 1

4546 pc 1

4547 pl k_wn

4548 end

4549 if eq k 2

4550 pc 4

4551 pl k_no

4552 end

4553 if eq k 3

4554 pc 5

4555 pl k_in

4556 end

4557 pc 2

4558 pc 32

4559 n = get ptn 0

4560 dnm i

4561 while lt sub get ptn 0 n 9 bound 16

4562 pc 32

4563 end

4564 for j ulong get dtn i

4565 pc get dt add mul i 192 j

4566 end

4567 pln

4568 end

4569

4570 fn dnm i ulong to void

4571 if eq i 0

4572 pl n_arch

4573 end

4574 if eq i 1

4575 pl n_gpu

4576 end

4577 if eq i 2

4578 pl n_drv

4579 end

4580 if eq i 3

4581 pl n_mem

4582 end

4583 if eq i 4

4584 pl n_disk

4585 end

4586 if eq i 5

4587 pl n_inst

4588 end

4589 if eq i 6

4590 pl n_busy

4591 end

4592 if eq i 7

4593 pl n_nv

4594 end

4595 end

4596

4597 fn stplan to bool

4598 enter 2

4599 pclear

4600 pl p_l1

4601 pln

4602 pln

4603 pc 6

4604 plbase

4605 pl p_l2

4606 pl v_tag

4607 pc 2

4608 pl p_l3

4609 pln

4610 pc 6

4611 plbase

4612 pl p_l4

4613 for i ulong get mnn 0

4614 pc get mnm i

4615 end

4616 pc 2

4617 pln

4618 pl p_l9

4619 plgb mbytes

4620 pl m_l3

4621 plnum mfiles

4622 pl m_l4

4623 pln

4624 pc 6

4625 plbase

4626 pc 2

4627 pl p_l6

4628 pln

4629 pl p_l5

4630 pln

4631 pln

4632 pl p_l7

4633 pln

4634 pc 1

4635 pl p_l8

4636 pc 2

4637 prompt p_ok

4638 show

4639 r = ask

4640 ret ge r 0

4641 end

4642

4643 fn styes to bool

4644 enter 3

4645 pclear

4646 pc 6

4647 pl c_l1

4648 pc 2

4649 prompt c_q

4650 show

4651 r = ask

4652 ret and ge r 0 ibis t_yes

4653 end

4654

4655 fn bye t view uchar * to void

4656 if eq get ui 0 1

4657 scrn false

4658 end

4659 sgr0

4660 putb 10

4661 emit t

4662 putb 10

4663 w = flush

4664 end

4665

4666 note The full wizard. Exit 0 for a finished run and for a friendly refusal; 1 when a step failed.

4667 fn wizard plain bool to int

4668 term plain

4669 if not mopen

4670 ret 3

4671 end

4672 if eq get ui 0 1

4673 scrn true

4674 w = flush

4675 end

4676 if not stwel

4677 bye c_stop

4678 ret 0

4679 end

4680 if not stdoc

4681 bye x_l3

4682 ret 0

4683 end

4684 if not stplan

4685 bye c_stop

4686 ret 0

4687 end

4688 if not styes

4689 bye c_stop

4690 ret 0

4691 end

4692 if not stinst

4693 bye c_fail

4694 ret 1

4695 end

4696 if not mstep

4697 bye c_fail

4698 ret 1

4699 end

4700 if not stchat

4701 bye c_fail

4702 ret 1

4703 end

4704 stdone eq get ui 11 1

4705 if eq get ui 11 1

4706 bye d_l1

4707 else

4708 bye d_l0

4709 end

4710 ret 0

4711 end

4712

4713 fn istty fd int to bool

4714 r = fstat fd sb 0 128

4715 ret and eq r 0 eq stype 2

4716 end

4717

4718 fn cdoctor to int

4719 need = mneed

4720 ok = doctor need

4721 col = istty 1

4722 for i ulong NCHK

4723 cline i col

4724 putb 10

4725 end

4726 w = flush

4727 if ok

4728 ret 0

4729 end

4730 emit x_l1

4731 putb 10

4732 emit x_l2

4733 putb 10

4734 w = flush

4735 ret 1

4736 end

4737

4738 fn cverify to int

4739 x = mopen

4740 k = sums

4741 if lt k 0

4742 emit n_vbad

4743 putb 10

4744 w = flush

4745 ret 1

4746 end

4747 num ulong k

4748 emit n_vok

4749 putb 10

4750 w = flush

4751 ret 0

4752 end

4753

4754 note Start the engine when the doctor allows it and wait until it answers.

4755 fn cstart to int

4756 x = mopen

4757 if alive PORT

4758 emit n_ready

4759 putb 10

4760 w = flush

4761 ret 0

4762 end

4763 ok = doctor 0

4764 pclear

4765 if ckskip

4766 for i ulong get ptn 0

4767 putb get pt i

4768 end

4769 putb 10

4770 w = flush

4771 ret 2

4772 end

4773 p = estart

4774 if lt p 0

4775 ret 1

4776 end

4777 emit n_start

4778 num ulong p

4779 putb 10

4780 w = flush

4781 if not ewait 2400

4782 emit n_nostrt

4783 putb 10

4784 w = flush

4785 ret 1

4786 end

4787 emit n_ready

4788 putb 10

4789 w = flush

4790 ret 0

4791 end

4792

4793 fn cstop to int

4794 if estop

4795 emit n_stopd

4796 putb 10

4797 w = flush

4798 ret 0

4799 end

4800 ret 1

4801 end

4802

4803 fn cchat to int

4804 r = cstart

4805 if ne r 0

4806 ret r

4807 end

4808 emit n_chat1

4809 putb 10

4810 put hsn 0 0

4811 while true bound 100000

4812 emit n_you

4813 w = flush

4814 n = rline

4815 if or lt n 0 ibis n_bye

4816 ret 0

4817 end

4818 if gt get hsn 0 0

4819 hstr j_comma

4820 end

4821 hstr j_user

4822 hesc

4823 hstr j_end

4824 emit n_ai

4825 w = flush

4826 q = chatreq PORT

4827 putb 10

4828 w = flush

4829 if ne q 0

4830 emit n_err

4831 snum q

4832 putb 10

4833 w = flush

4834 else

4835 hstr j_comma

4836 hstr j_asst

4837 for i ulong get abn 0

4838 hbyte get ab i

4839 end

4840 hstr j_end

4841 end

4842 end

4843 ret 0

4844 end

4845

4846 fn cprint to int

4847 for i ulong get ptn 0

4848 b = get pt i

4849 if or ge b 7 eq b 10

4850 putb b

4851 end

4852 end

4853 putb 10

4854 w = flush

4855 ret 0

4856 end

4857

4858 fn iskey t view uchar * to bool

4859 ret ibis t

4860 end

4861

4862 fn main to int

4863 if not setup

4864 emit n_nohome

4865 putb 10

4866 w = flush

4867 ret 2

4868 end

4869 if lt arg 1 0

4870 ret wizard false

4871 end

4872 if iskey k_wiz

4873 plain = false

4874 if ge arg 2 0

4875 plain = ibis t_plain

4876 end

4877 ret wizard plain

4878 end

4879 if iskey k_doc

4880 ret cdoctor

4881 end

4882 if iskey k_chat

4883 ret cchat

4884 end

4885 if iskey k_start

4886 ret cstart

4887 end

4888 if iskey k_stop

4889 ret cstop

4890 end

4891 if iskey k_vfy

4892 ret cverify

4893 end

4894 if iskey t_source

4895 pclear

4896 source

4897 ret cprint

4898 end

4899 if iskey t_about

4900 pclear

4901 about

4902 ret cprint

4903 end

4904 if iskey k_unin

4905 ret cunin

4906 end

4907 if iskey k_roll

4908 ret rollbk

4909 end

4910 emit k_help

4911 putb 10

4912 w = flush

4913 ret 2

4914 end

4915

4916 fn cunin to int

4917 keep = false

4918 yes = false

4919 for i ulong 2

4920 if ge arg add i 2 0

4921 if ibis u_keep

4922 keep = true

4923 end

4924 if ibis u_yes

4925 yes = true

4926 end

4927 end

4928 end

4929 x = mopen

4930 ret uninst keep yes

4931 end

4932 

04 / BUILD IT WITH ME

Tell me what happened.

Open an issue in omega-projects (omega-projects issues). Include your hardware, operating system, release tag, the step that failed and the exact error. Remove tokens, personal paths, private prompts and model data before sharing a log.

05 / THE WAY BACK

No one-way door.

The installation lives under ~/.local/share/aienos. It does not uninstall or overwrite NVIDIA packages or CUDA. Run aienos uninstall and type yes when asked. It removes the alpha installation, downloaded model, command and launchers. To keep the downloaded model, use aienos uninstall --keep-model. If the command is missing, run ~/.local/share/aienos/current/bin/aienos uninstall.

Uninstaller source and release instructions

I would rather hear why you left than make it difficult to leave.