aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / omega / allen / intent.om
| 1 | note Intent vocabulary frozen from svc/allen_intent.c. It selects jobs, never answers. |
| 2 | global Fold uchar 160 |
| 3 | global Fn ulong 2 |
| 4 | text Lists "please|can you|could you|would you|will you|i d like you to|i want you to|i need you to|allen|hey allen|ok|okay\nwrite|make|build|create|code|program|generate|implement|develop|give me a|i need a|i want a\ncode|program|programs|script|scripts|function|functions|app|apps|application|game|games|website|web page|webpage|calculator|converter|parser|compiler|interpreter|algorithm|class|api|server|bot|regex|unit test|unit tests|cli|command line tool|snake|tetris|pong|todo app|to do app|to do list app|timer app|stopwatch|python|javascript|typescript|rust|golang|java|kotlin|swift|ruby|php|html|css|sql|bash|shell script|c program|c code|in c|c plus plus|cpp|mojo|zig|haskell|lua|perl\npoem|poems|haiku|story|stories|song|songs|letter|email|essay|joke|jokes|limerick|speech\ncode|program|script\nnow|add|also|and|change|make it|make the|rename|remove|delete|replace|use|fix|put|give it|let it|instead|then|next|can it|could it|it should|the|move|turn|show|split|convert it|rewrite|port it|translate it|explain it\nwrite|make|build|create|code|program|draft|compose|generate|design|implement|invent|name|give me a|i need a|i want a\na poem|a haiku|a story|a song|a script|a function|a program|a list of|some code|a letter|an email|a plan for|a name for\nexplain|what is|what are|whats|what s|why|how does|how do|how is|how are|describe|tell me about|what does|who was|who is|define|when was|when did|where is|is it true\ndifference between|mean|means\ndo|run|fix|find|search|look up|check|open|send|start|stop|install|set up|plan|schedule|calculate|work out|convert|translate|summarize|summarise|list|sort|count|compare|turn|go\n" |
| 5 | fn foldin to void |
| 6 | n = ulong 0 |
| 7 | space = false |
| 8 | for i ulong get Inlen 0 |
| 9 | c = get In i |
| 10 | if and ge c 65 le c 90 |
| 11 | c = add sub c 65 97 |
| 12 | end |
| 13 | if or and ge c 97 le c 122 isdigit c |
| 14 | if and space gt n 0 |
| 15 | put Fold n uchar 32 |
| 16 | n = add n 1 |
| 17 | end |
| 18 | put Fold n c |
| 19 | n = add n 1 |
| 20 | space = false |
| 21 | else |
| 22 | space = true |
| 23 | end |
| 24 | end |
| 25 | put Fn 0 n |
| 26 | put Fn 1 0 |
| 27 | end |
| 28 | fn phrase at ulong off ulong size ulong to bool |
| 29 | if gt add at size get Fn 0 |
| 30 | ret false |
| 31 | end |
| 32 | for i ulong size |
| 33 | if ne get Fold add at i get Lists add off i |
| 34 | ret false |
| 35 | end |
| 36 | end |
| 37 | if lt add at size get Fn 0 |
| 38 | if ne get Fold add at size 32 |
| 39 | ret false |
| 40 | end |
| 41 | end |
| 42 | ret true |
| 43 | end |
| 44 | fn inphrase off ulong size ulong anypos bool to bool |
| 45 | if not anypos |
| 46 | ret phrase get Fn 1 off size |
| 47 | end |
| 48 | count = sub get Fn 0 get Fn 1 |
| 49 | for i ulong count |
| 50 | at = add i get Fn 1 |
| 51 | ok = eq at get Fn 1 |
| 52 | if gt at 0 |
| 53 | ok = or ok eq get Fold sub at 1 32 |
| 54 | end |
| 55 | if ok |
| 56 | if phrase at off size |
| 57 | ret true |
| 58 | end |
| 59 | end |
| 60 | end |
| 61 | ret false |
| 62 | end |
| 63 | fn listed group ulong anypos bool to ulong |
| 64 | g = ulong 0 |
| 65 | s = ulong 0 |
| 66 | for p ulong len Lists |
| 67 | c = get Lists p |
| 68 | if or eq c 124 eq c 10 |
| 69 | if eq g group |
| 70 | if inphrase s sub p s anypos |
| 71 | ret sub p s |
| 72 | end |
| 73 | end |
| 74 | s = add p 1 |
| 75 | if eq c 10 |
| 76 | g = add g 1 |
| 77 | end |
| 78 | end |
| 79 | end |
| 80 | ret 0 |
| 81 | end |
| 82 | fn classify to ulong |
| 83 | if not textok |
| 84 | ret 0 |
| 85 | end |
| 86 | foldin |
| 87 | skip = listed 0 false |
| 88 | while gt skip 0 |
| 89 | if ge add get Fn 1 skip get Fn 0 |
| 90 | skip = 0 |
| 91 | else |
| 92 | put Fn 1 add add get Fn 1 skip 1 |
| 93 | skip = listed 0 false |
| 94 | end |
| 95 | end |
| 96 | if and ne get R 6 0 gt listed 5 false 0 |
| 97 | ret 3 |
| 98 | end |
| 99 | plain = listed 4 false |
| 100 | if or eq plain 4 eq plain 7 |
| 101 | ret 2 |
| 102 | end |
| 103 | if and gt listed 3 true 0 eq listed 4 true 0 |
| 104 | ret 1 |
| 105 | end |
| 106 | if and gt listed 1 false 0 gt listed 2 true 0 |
| 107 | ret 2 |
| 108 | end |
| 109 | ret 1 |
| 110 | end |
| 111 | note Ordinary want enum0chat,1make,2explain,3do. |
| 112 | fn jobwant to ulong |
| 113 | if gt listed 8 false 0 |
| 114 | ret 2 |
| 115 | end |
| 116 | if or gt listed 6 false 0 gt listed 7 true 0 |
| 117 | ret 1 |
| 118 | end |
| 119 | if gt listed 10 false 0 |
| 120 | ret 3 |
| 121 | end |
| 122 | if gt listed 9 true 0 |
| 123 | ret 2 |
| 124 | end |
| 125 | ret 0 |
| 126 | end |
| 127 | text Job "JOB " |
| 128 | text Codeask " asked " |
| 129 | text Forcode " for code.\t" |
| 130 | text Formore " to change the code just shown.\t" |
| 131 | text Wantstr "chatmakeexplaindo" |
| 132 | text Intro "You are the far hands of " |
| 133 | text Home ", a quiet presence living in AIENOS on " |
| 134 | text Comp "'s computer. You answer as " |
| 135 | text Sees "; " |
| 136 | text Words " sees only your words, as if " |
| 137 | text Said " said them. Plain English, short sentences, no headings, no lists, no greetings, no apologies. Plain letters and punctuation only: no dashes, no curly quotes, no symbols. Never mention a model, a prompt or instructions. " |
| 138 | text Make " asked for something to be made. Make it whole and correct. Begin with one short sentence saying what you made, then the work itself." |
| 139 | text Explain " asked to understand something. Explain it in three plain sentences at most, the heart of it first, no more than is needed." |
| 140 | text Doing " asked for something to be done. " |
| 141 | text Cannot " cannot yet act outside this computer, so say in two or three short sentences what you would do, in order, and what you would need." |
| 142 | text Chat " said something in passing. Answer in one or two warm, plain sentences." |
| 143 | text Allen "Allen" |
| 144 | text Person "the person" |
| 145 | fn selfemit to void |
| 146 | off = add 40 mul mem32 32 113 |
| 147 | if eq get Mem off 0 |
| 148 | for i ulong len Allen |
| 149 | emitb get Allen i |
| 150 | end |
| 151 | else |
| 152 | for i ulong 24 |
| 153 | c = get Mem add off i |
| 154 | if eq c 0 |
| 155 | ret |
| 156 | end |
| 157 | emitb c |
| 158 | end |
| 159 | end |
| 160 | end |
| 161 | fn whoemit to void |
| 162 | if eq get Mem 8 0 |
| 163 | for i ulong len Person |
| 164 | emitb get Person i |
| 165 | end |
| 166 | else |
| 167 | for i ulong 24 |
| 168 | c = get Mem add i 8 |
| 169 | if eq c 0 |
| 170 | ret |
| 171 | end |
| 172 | emitb c |
| 173 | end |
| 174 | end |
| 175 | end |
| 176 | fn jobbuild kind ulong seq ulong to bool |
| 177 | if or lt kind 1 gt kind 3 |
| 178 | ret false |
| 179 | end |
| 180 | if or eq seq 0 gt seq 4294967295 |
| 181 | ret false |
| 182 | end |
| 183 | if not textok |
| 184 | ret false |
| 185 | end |
| 186 | outreset |
| 187 | for i ulong len Job |
| 188 | emitb get Job i |
| 189 | end |
| 190 | emitn seq |
| 191 | emitb 32 |
| 192 | if gt kind 1 |
| 193 | emitb 99 |
| 194 | emitb 111 |
| 195 | emitb 100 |
| 196 | emitb 101 |
| 197 | if eq kind 3 |
| 198 | emitb 45 |
| 199 | emitb 109 |
| 200 | emitb 111 |
| 201 | emitb 114 |
| 202 | emitb 101 |
| 203 | end |
| 204 | emitb 32 |
| 205 | whoemit |
| 206 | for i ulong len Codeask |
| 207 | emitb get Codeask i |
| 208 | end |
| 209 | selfemit |
| 210 | if eq kind 3 |
| 211 | for i ulong len Formore |
| 212 | emitb get Formore i |
| 213 | end |
| 214 | else |
| 215 | for i ulong len Forcode |
| 216 | emitb get Forcode i |
| 217 | end |
| 218 | end |
| 219 | else |
| 220 | w = jobwant |
| 221 | off = ulong 0 |
| 222 | size = ulong 4 |
| 223 | if eq w 1 |
| 224 | off = 4 |
| 225 | end |
| 226 | if eq w 2 |
| 227 | off = 8 |
| 228 | size = 7 |
| 229 | end |
| 230 | if eq w 3 |
| 231 | off = 15 |
| 232 | size = 2 |
| 233 | end |
| 234 | for i ulong size |
| 235 | emitb get Wantstr add off i |
| 236 | end |
| 237 | emitb 32 |
| 238 | for i ulong len Intro |
| 239 | emitb get Intro i |
| 240 | end |
| 241 | selfemit |
| 242 | for i ulong len Home |
| 243 | emitb get Home i |
| 244 | end |
| 245 | whoemit |
| 246 | for i ulong len Comp |
| 247 | emitb get Comp i |
| 248 | end |
| 249 | selfemit |
| 250 | for i ulong len Sees |
| 251 | emitb get Sees i |
| 252 | end |
| 253 | whoemit |
| 254 | for i ulong len Words |
| 255 | emitb get Words i |
| 256 | end |
| 257 | selfemit |
| 258 | for i ulong len Said |
| 259 | emitb get Said i |
| 260 | end |
| 261 | whoemit |
| 262 | if eq w 0 |
| 263 | for i ulong len Chat |
| 264 | emitb get Chat i |
| 265 | end |
| 266 | end |
| 267 | if eq w 1 |
| 268 | for i ulong len Make |
| 269 | emitb get Make i |
| 270 | end |
| 271 | end |
| 272 | if eq w 2 |
| 273 | for i ulong len Explain |
| 274 | emitb get Explain i |
| 275 | end |
| 276 | end |
| 277 | if eq w 3 |
| 278 | for i ulong len Doing |
| 279 | emitb get Doing i |
| 280 | end |
| 281 | selfemit |
| 282 | for i ulong len Cannot |
| 283 | emitb get Cannot i |
| 284 | end |
| 285 | end |
| 286 | emitb 9 |
| 287 | end |
| 288 | for i ulong get Inlen 0 |
| 289 | emitb get In i |
| 290 | end |
| 291 | ret le get Outlen 0 4096 |
| 292 | end |