tracker
All repositories: gitoria
10.0 KB
\* hl:proc — child processes as INSTANCE EVENTS.let server = spawn('llama-server -m ' + model + ' --port 8480')on server.line({ line, stream }) { … } \\ stream: 'stdout' | 'stderr'on server.exit({ exit, pid }) { … } \\ always arrives, kill or notserver.kill() \\ SIGTERM; exit still firesserver.write(text) \\ to its stdin ({ stdin = 'pipe' }): String or Bytes, rawserver.end() \\ close its stdin: it reads EOFA child spawned with `{ binary = true }` delivers its output as raw Bytesinstead of text lines — `on server.data({ data, stream })`, one event perchunk as it arrives, nothing split and nothing replaced. The default staystext lines.`stream` names the PIPE, not a verdict — most servers (llama.cpp included)write their whole LOG to stderr, keeping stdout for data.A CHILD DIES WITH ITS PARENT: every child is started with the kernel'sparent-death signal set to SIGTERM (Linux PR_SET_PDEATHSIG), so when thisprogram exits — any exit, a crash or Ctrl-C included — its children getSIGTERM and no orphan keeps a port. There is no option to turn it off. Thesetting is the child's own and is not inherited by what IT starts, so aprocess meant to outlive you is started one level down, by the child:spawnArgs([ 'sh', '-c', 'long-job &' ]).A command that CANNOT START has no exit — it is an ERROR: caught by`on server.Error(e)` (this instance) or the global `on Error(e)`; uncaughtit is a located crash naming the binary and the errno. A finished childretires its event source, so a program whose children are done simply ends.THE PROGRAM PATH follows the Hybriel path rule: `spawn('bin/llama-server …')`resolves bin/ against THIS SCRIPT's directory (like imports and hl:fs) — acopied build folder next to your .hl file just works. A bare name searchesPATH; absolute stays absolute.OPTIONS, the last argument of spawn and spawnArgs, all optional: `cwd`is the directory the child starts in — a relative one resolves againstTHIS SCRIPT's directory, like the program path; `env` is added to theenvironment the child inherits (`{ LANG = 'C' DEBUG = null }` sets LANGand removes DEBUG); `binary = true` delivers the output as Bytes (above);`stdin = 'pipe'` makes the child's stdin writable with write() and end()— without it the child inherits this program's stdin, as before.let st = spawn('git', [ 'status', '--short' ], { cwd = 'repo' })There is NO SHELL — no quoting, no expansion (the safety property, not agap). `spawnArgs([ 'sh', '-c', pipeline ])` is how you ASK for one,explicitly. *\/* Gate file (docs campaign): __native lives only here; the Process class(process.hl) carries the instance events and their declarations. */\* Start a child from ONE command string: split on WHITESPACE RUNS (spaces,tabs AND newlines — a command written across lines is one command); aquoted argument is GROUPED and its quotes stripped ('{"a": 1}' arrives asone argv entry). A command that cannot start is an Error — caught by`on server.Error(e)` or the global `on Error(e)`. *\spawn(String cmd \\ the program and its arguments, whitespace-separated — or, with `args`, the program aloneHybrid args = null \\ the arguments as a list, each passed as is (cmd is then not split)Hybrid options = null \\ { cwd, env, stdin, binary } — see the head of this file) {if (args == null) {return new Process().start(cmd, options)}return new Process().startArgs([cmd] + args, options)}\* The LIST form — argv exactly as given: for arguments that contain spaces,or to ask for a shell explicitly: spawnArgs([ 'sh', '-c', pipeline ]). *\spawnArgs(Hybrid args \\ argv entries, one string each — args[0] is the programHybrid options = null \\ { cwd, env, stdin, binary }, as for spawn) {return new Process().startArgs(args, options)}\* RUN A PROGRAM AND WAIT FOR IT (ticket #80): the blocking twin of spawn,for code that needs the output NOW — a page's root that is beingconstructed on the server, a build step, a script. It answers once theprogram has exited:let log = run([ 'git', 'log', '--oneline', '-5' ], { cwd = 'repo' })log.exit \\ the exit status (128 + n when signal n ended it)log.lines \\ stdout, one String per line, no newlineslog.stderr \\ stderr, the same`command` is a String (split like spawn's) or an argv list, passed as is.`options` are spawn's `cwd`, `env` and `binary` — with `binary = true`stdout comes back whole as `data`, a Bytes, instead of `lines` — and`timeout`, in seconds: past it the program is killed and the call is anError. `stdin`, a String or a Bytes (ticket #91), is what the programreads: written to it whole, then closed, so it reads EOF —let r = run([ 'git', 'upload-pack', '--stateless-rpc', dir ], { stdin = req.bytes binary = true })Without `stdin` the program's stdin is empty (/dev/null); a program thatwaited for input would otherwise hold the caller forever.The wait holds the fiber that called, as fetch() does, so a server keepsa run short or bounds it with `timeout`. A command that cannot start is anError, as for spawn; a program that ran and failed is not — read `exit`. *\run(command \\ the program and its arguments: a String, whitespace-separated, or a listHybrid options = null \\ { cwd, env, binary, stdin, timeout } — see above) {// stdin crosses the plugin boundary as hex (the ABI has no Bytes), beside the optionslet o = optionslet feed = nullif (o != null && o.stdin != null) {let t = hlTypeName(o.stdin)if (t == 'Bytes') {feed = o.stdin.hex()o.stdin = null} else if (t == 'String') {feed = toBytes(o.stdin).hex()o.stdin = null}}let r = __native("proc.run", command, o, feed)// a failure an `on Error` handler absorbed leaves the call yielding nullif (r == null) {return null}if (options != null && options.binary == true) {return { exit = r.exit data = toBytes(r.out) stderr = linesOf(r.err) }}return { exit = r.exit lines = linesOf(r.out) stderr = linesOf(r.err) }}// A stream's text as its lines: split at each newline, and a final newline ends// the last line rather than starting an empty one — spawn's `line` events say the same.linesOf(String text) {let nl = ""let out = []if (text == '') {return out}for (l of text.split(nl)) {out.push(l)}if (text.endsWith(nl)) {out.pop()}return out}\* The terminal's own input as instance events — `input = stdin()`, then`on input.line(text)` per typed line and `on input.eof()` at Ctrl-D. A joinedterminal realm (SPEC "Joining a realm") reads its keyboard here. *\stdin() {return new Stdin().start()}\* One environment variable, null when unset. The runtime loads a `.env`beside the project's entry BEFORE anything runs (KEY=VALUE lines, #comments; the real environment always wins), so env('OPENROUTER_KEY')reads either source through one call. *\env(String name \\ the variable's name) {return __native("proc.env", name)}\* THE PROGRAM'S OWN ARGUMENTS (mission 317) — the strings that follow theentry on the command line, in order, as a list; an empty list when therewere none.hybriel lex.hl a b // args() is ['a', 'b']./lex a b // the compiled binary answers the sameEVERYTHING AFTER THE ENTRY IS THE PROGRAM'S, unchanged: `hybriel[runtime flags] <file> [app args]` (creator ruling 2026-09-27). Flagsincluded — `hybriel t.hl x --post --strict --` gives['x', '--post', '--strict', '--']; hybriel's own flags (--strict,--offline, --strict-boundaries) are written BEFORE the entry.A project DIRECTORY entry is the same: every argument after it is theprogram's. Joining a realm is a runtime flag, written before the entry:`hybriel --realm=<name> <projectDir>` (SPEC "Joining a realm").Built here rather than handed over whole because a `__native` call answerswith ONE value and a list is what the caller wants: the count and the i-thargument are the two questions the runtime can answer, and the list is thelanguage's own. *\args() {let out = []let n = __native("proc.argc")let i = 0while (i < n) {out.push(__native("proc.arg", i))i = i + 1}return out}\* WRITE TO THIS PROGRAM'S OWN STDOUT, RAW (ruling on ticket #42): a String'sbytes or a Bytes, exactly as they are — no newline, no text form, unlikeconsole.log. For a binary protocol on stdout. Answers how many bytes went. *\writeStdout(data \\ a String or a Bytes) {if (hlTypeName(data) == 'Bytes') {return __native("proc.write_stdout_hex", data.hex())}return __native("proc.write_stdout", data)}\* WRITE TO THIS PROGRAM'S OWN STDERR, RAW: writeStdout's twin on the errorstream — a String's bytes or a Bytes, exactly as they are, no newline.Answers how many bytes went. *\writeStderr(data \\ a String or a Bytes) {if (hlTypeName(data) == 'Bytes') {return __native("proc.write_stderr_hex", data.hex())}return __native("proc.write_stderr", data)}\* END THIS PROGRAM NOW with an exit status (ruling on ticket #36): 0 issuccess, anything up to 255 tells the shell it failed. Nothing after thecall runs. An uncaught error still exits 1 by itself. *\exit(Number code = 0 \\ the exit status, 0-255) {__native("proc.exit", code)}\* THE PROGRAM'S OWN DIRECTORY, absolute (ticket #37): the directory of theentry script on the interpreter, the directory the executable sits in fora compiled binary (a binary knows no build directory). cwd() is where theuser launched from; file() is the calling file's path. *\dir() {return __native("proc.dir")}\* The process's current working directory, absolute — where the USERlaunched from. Your own files resolve script-relatively everywhere(imports, hl:fs, spawn); cwd() is for tools whose subject is the caller'sdirectory: a formatter, a scaffolder. *\cwd() {return __native("proc.cwd")}
Branches
- mainmain branch
Latest commits
- 96ba683adeploy.sh: a gate without a 'passed,' line (check-theme) no longer ends the scriptmre
- eb3b9205tracker: report 031mre
- 9b5d2e89tracker mission 031: README (What it does, Test: four gates + the #32 checks, Files: theme/, new pages), STATUS (real copy, A/B load, how to repeat, open points), LOGmre
- 39950e4ctracker#32 (mission 031): the WorldAPI theme (theme/ vendored verbatim from layouts.worldapi.org 85b5654; styles.hl inherits it: accent green-dark, type colours 1-6; own base/header rules, row lines, genre-pill and inverted-button frames removed, the season foldable keeps its line; check-theme 21 -> 0, 4th deploy gate; main actions class primary) and the #32 header (theme AppHeader/MainMenu/UserMenu/Sidebar/ContentFirst: desktop brand, search, Series|Shows|Movies|Genres|People, user icon with Unwatched..Settings, Logout; signed out the ident selector, phone the iD icon dropdown; phone menu in the sidebar overlay; marked entry by :has); /find -> /search/<q>, /genres, /people(/<letter>), /settings; main { ContentFirst { slot } } works around the hl:web one-line slot bug; gates 365/0, 32/0, 52/0, check-theme 0mre
- a386dc92tracker: reports 029 + 030mre
- 71e0fd7dtracker missions 029 + 030: README (What it does, Files, gate count), STATUS (real-copy numbers, how to repeat, open points), LOGmre
- d36ea6eatracker#34 + #35 (mission 030): Follow directly under the poster, as wide as the poster (show.hl, styles.hl); the status pill next to a series' title — TVmaze's status (new tvmazeStatus, stored by the sync's TVmaze merge) else TMDB's, TVmaze Ended + TMDB Canceled = Canceled, inverted (filled, dark text, no border), green running / yellow pending / red canceled / muted ended (shows.hl statusOf); the daily delta asks TVmaze's status of an unfollowed series TVmaze's change list names (dailysync.hl syncRunStep, sync.hl syncTvmazeStatus); the status backfill after the details repair (backfill.hl, jobs.hl statusTick; resumable, 550 ms per TVmaze request); gates 354/0, 32/0, 52/0mre
- 7d7d4487tracker#33 (mission 029): reduced titles — every title TMDB's details never went through this app (no detailsAt, no tmdbSync) is incomplete (shows.hl isIncomplete; the old tracker's migrated rows passed #26's test: 5,697 non-adult on the live copy, 691 series without seasons); the repair job does the visibly reduced first (shows.hl missingParts), the page completes one on open; a title TMDB has no poster for (The Remaining) shows the placeholder; tools/count-incomplete.hl; gate fixtures stand for synced titles (tmdbSync), tests/seed-reduced.hl + #33 checks; gates 347/0, 32/0, 52/0mre
- 661c2592tracker: report 028mre
- 27c916fatracker mission 028: README ("Code order", the new file map), STATUS (counts before/after, tests, how to repeat, open), LOGmre
- d924f398tracker mission 028: comments name the new files (sync.hl, dailysync.hl, backfill.hl, credits.hl, jobs.hl, images.hl …); tools/ref-params.py + tools/lambda-audit.py also scan lib/ (they globbed the root only), lambda-audit counts a plain `x = p` alias like `let x = p`mre
- 2e89b968tracker mission 028 (code order) 5/5 let: `let` only where a variable is reassigned — 667 never-reassigned lets became plain declarations (project.hl, lib/, components/, tools/, tests/); kept: 264 in loop bodies (a plain declaration there is 'Cannot reassign' on the 2nd pass), 234 reassigned, 27 whose name is also a member/outer/free name (a plain write would rebind it); tools/let-audit.py decides and fixes (README 'Code order'); tests/realdata-m028.{sh,mjs} = the page-output diff on a real copy; gates 342/0, 32/0, 52/0, real-copy pages identicalmre
- 54796ff2tracker mission 028 (code order) 4/5 thin faces + last copies: the show page's check/follow faces call lib/watches.hl toggleWatched / toggleSeasonWatched (seasonAllWatched moved there) and lib/follows.hl toggleFollowed; both logins (header selector face, /login/callback) share lib/users.hl userOfCode; todayStr/listOf copies in components and the export readers copied into tools/migrate.hl + tools/old-short-ids.hl now once (lib/util.hl, lib/export.hl); gates 342/0, 32/0, 52/0; old-short-ids output byte-identical, migrate output identicalmre
- 06b078e3tracker mission 028 (code order) 3/5 project.hl is the map: config, routes, wiring and a feature → file index (914 → 258 lines); the background jobs (daily sync run, backfills, details repair, credits job, merge, short ids, collection seed) moved unchanged into lib/jobs.hl (a class: their state is reassigned every step, a static cannot be; one instance made after the server), the login callback into lib/users.hl, poster/photo serving into lib/images.hl, the /shows/<slug> rule into lib/shows.hl showsMovedPath; route handlers are thin wrappers; gates 342/0, 32/0, 52/0, real-copy pages identicalmre
- 94716fd2tracker mission 028 (code order) 2/5 util + topics: lib/util.hl holds envOr, storageDir, postersDir, profilesDir, newId, hexDigits, todayStr, dateOr, textOr, hasId, listOr, firstOf, sortDesc once (were copied into up to 5 files); tmdbsync.hl split into tmdb.hl (TMDB/TVmaze requests), sync.hl (one title's sync), sync-helpers.hl, backfill.hl; details.hl split into details.hl, credits.hl, credits-helpers.hl (isIncomplete to shows.hl); search-helpers.hl (words, query, ranking, slugs); collections.hl (the TMDB collection seed, out of franchises.hl); deltasync.hl renamed dailysync.hl; no behaviour change: gates 342/0, 32/0, 52/0, real-copy pages identicalmre
- 186079b0tracker mission 028 (code order) 1/5 move: every root .hl except project.hl into lib/ (styles.hl into components/), import paths only; gates 342/0, 32/0, 52/0; real-copy pages identicalmre
- 4f47f181tracker: report 027mre
- dc1d4be4tracker mission 027: Hybriel master 06617221 vendored (plugin allocator fixes 3a781359 + 413f60e4); real copy RSS through first-start jobs + 400 loads flat ~2.55 GB (190aa11d 2.3 -> 5.6 GB), page times <= 1.1x; gates 342/0, 32/0, 52/0mre
- 84e1b3e1tracker: reports 025 + 026mre
- dc40d859tracker#31 (mission 026): duplicate titles merged — the 68 type+tmdbId pairs held by 157 records were the old tracker's (all migrated); merge.hl repair job (own clock, before the TMDB jobs) keeps one keeper per title (follows/watches > old short id > oldest), moves follows, watches, seasons, cast, credits, timelines, tombstones the rest (mergedInto, never deleted), slugs + short ids 301 to the keeper; stray seasons merged into their listed twin (Reacher S3 watches) or linked when watched; search import re-checks before its put; deploy.sh waits up to 90 s for 200; real copy 68 -> 0 dup ids, az5b2 follows/watches equal; gates 342/0, 32/0, 52/0mre