aien-protocols-mv
Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem
Brought by drakestapleton
aien-protocols-mv / specs / osh-platform / vectors / README.md
| 1 | # OSH conformance vectors |
| 2 | |
| 3 | Status: v1 DRAFT with the ABI. Expected outputs v001 to v015 were authored from `../OSH_PLATFORM_ABI.md`; v016 to v020 came from the first implementation (omega#336). The omega lexer, parser and expander tests run all 20 (spec section 14, item 6). Inputs are generated by `../tools/make-vectors.sh`; `expected.txt` is committed by hand. |
| 4 | |
| 5 | ## Files per vector `vNNN` |
| 6 | |
| 7 | - `vNNN.in`: the exact input bytes handed to the core, newline-terminated unless the vector says otherwise. May contain NUL and bytes >= 0x80. |
| 8 | - `vNNN.env` (optional): answers to variable requests, one per line, raw bytes to end of line (a value cannot contain a newline). `NAME=VALUE` sets a variable. Lines starting with `@` set specials: `@status=N` is the value of `$?` for every request, `@arg0=` to `@arg9=` set positional parameters (the number of `@argK` lines present, counting from `@arg1` with no gaps, is `$#`). A name with no line is unset. |
| 9 | |
| 10 | The harness never executes pipelines. After each `PIPELINE_READY` it records the request, then calls `expand_run` again, treating `$?` as the fixed `@status` (default 0). |
| 11 | |
| 12 | ## expected.txt line grammar |
| 13 | |
| 14 | ``` |
| 15 | <vector> ok [lex_resumes=N] | P<i> conn=<0-3> | C<j> b=<0-6> argv=<q>,<q>... as=<NAME>=<q>,... rd=<K><fd>:<target>,... |
| 16 | <vector> refuse <code> <NAME> off=<byte offset> |
| 17 | <vector> more |
| 18 | ``` |
| 19 | |
| 20 | - A pipeline is `P<i>`; its commands follow as `C<j>` in order, each preceded by ` | `. Lists of argv, assignments and redirections are comma separated; an empty list is written as nothing after `=`. |
| 21 | - `<q>` is a double-quoted byte string; `\"`, `\\`, `\xHH` escape `"`, `\` and any byte outside 0x20 to 0x7E. `"a"*1100` means 1100 repetitions. |
| 22 | - Redirection `<K>` is `IN`, `OUT`, `APPEND` or `DUP`; `<fd>` the redirected descriptor; `<target>` a `<q>`, or for `DUP` the source descriptor number. |
| 23 | - `more` means the final call returned `NEED_MORE_INPUT` with no further input available. |
| 24 | - `lex_resumes=N` is the exact number of `BUDGET_EXHAUSTED` returns the lexer gave before `PHASE_DONE`. |
| 25 | - A core conforms when every line matches byte for byte. Refusal offsets follow spec section 5.4. |
| 26 | |
| 27 | ## Stream and task vectors (`sNNN_<case>.vec`, `tNNN_<case>.vec`) |
| 28 | |
| 29 | Status: v1 DRAFT revision 2, with [`../STREAM_TASK.md`](../STREAM_TASK.md). Shared by every adapter (Omega's Linux host adapter, the Aienux native harness). The `vNNN` shell-core vectors above are unchanged; `tools/check-stream-vectors.sh` regenerates them and fails if they differ. The grammar is the Aienux native pipe fixture grammar (aienos-mv `native/kernel/tests/fixtures/pipe/README.md` at `f8700d4cb65e`, written so the corpus could move here) with its kernel-only counters removed and task, launch, authority and recovery commands added. `<q>` is the quoted byte string of `expected.txt` (`\xHH`, `\"`, `\\`; spaces may appear inside the quotes). Checked by `tools/osh_sv_ref.c` (reference model) through `tools/check-stream-vectors.sh`, which also proves with `tools/mutate-stream-ref.sh` that every check of the model is caught by some vector. |
| 30 | |
| 31 | ### Header (all required, before the first step) |
| 32 | |
| 33 | | line | meaning | |
| 34 | |---|---| |
| 35 | | `case <name>` | the file is `sNNN_<name>.vec` (streams) or `tNNN_<name>.vec` (tasks) | |
| 36 | | `kind positive\|negative` | negative: the vector contains refusals or failures | |
| 37 | | `exec host-logic\|native-qemu` | `host-logic`: a host unit run of the adapter's own logic counts as evidence. `native-qemu`: it parks callers, starts tasks or runs them concurrently; Aienux evidence only from a native run under QEMU, Omega evidence only from real Linux processes | |
| 38 | | `domain 1\|2\|any` | authority domain of the vector's capabilities (ST5); an adapter without that domain reports `NOT_RUN` | |
| 39 | | `needs <feature>...` | `streams`, `frames`, `tasks`, `launch`, `journal` (crash and recovery), `reset`, `test-authority` (the harness can mint and revoke capabilities with chosen generations), `fault-spawn` (make a chosen spawn fail), `fault-lose` (make a task's end unobservable); any missing feature gives `NOT_RUN` | |
| 40 | |
| 41 | `#` at the start of a line is a comment. Every other line is `<command> => <result>` or `check <item>...`. The runner compares the whole result text byte for byte. Every vector ends with `check empty`. |
| 42 | |
| 43 | ### Stream commands |
| 44 | |
| 45 | Two principals, tables `A` and `B`, start empty. A handle name keeps its value after `close`, so a later use tests a stale handle. |
| 46 | |
| 47 | | command | meaning | result on success | |
| 48 | |---|---|---| |
| 49 | | `create <R> <W> <T>` | `PIPE_CREATE` in table T; each end gets its data right plus `d g v` | `OK` | |
| 50 | | `write <H> <q>` / `fill <H> <count\|cap> <hex byte>` | non-blocking `STREAM_WRITE`; `cap` is `LIMITS_GET.max_pipe_bytes` | `OK n=<N>` | |
| 51 | | `read <H> <max>` | non-blocking `STREAM_READ` | `OK n=<N> data=<q>`, or `OK n=0` | |
| 52 | | `skim <H> <max>` | the same read, result without the bytes | `OK n=<N>` | |
| 53 | | `bread <H> <max> <action>` / `bwrite <H> <q> <action>` | blocking call; the first time it would park, the peer runs `<action>` (`none`, or one `write`, `read`, `close`, `revoke`, `cancel` command that must return `OK`); a second park gives up `INTERRUPTED` (the stalled-peer deadline) | as `read` / `write` | |
| 54 | | `close <H>` | `STREAM_CLOSE` | `OK` | |
| 55 | | `dup <H> <NEW> <T> <rights>` | `STREAM_DUP` into table T; letters `r w m g d v` (ST4.11) | `OK` | |
| 56 | | `revoke <H>` | the authority root revokes the pipe, through H's `v` right | `OK` | |
| 57 | | `cancel <H>` | an interrupt aimed at that end (ST4.7) | `OK` | |
| 58 | | `release <T>` / `sweep <T>` | close every handle in T; `release` prints the count (adapter-specific), `sweep` does not | `OK n=<N>` / `OK` | |
| 59 | | `saturate <H> <T> last=<D>` | duplicate H with its data right into T until `LIMIT`; D names the last duplicate made | `LIMIT` | |
| 60 | | `exhaust <T> min=<N>` | create pipes in T until `LIMIT`, require at least N and that the refused create left nothing, then close them | `LIMIT` | |
| 61 | | `limits` | `LIMITS_GET` meets ST9 | `OK max_pipe_bytes>=65536 max_streams>=16 max_tasks>=8` | |
| 62 | | `frame <T> <slice> <cell>...` | raw platform call (ST2) from table T; slice `-` or `<q>`; cells hex, `$<H>` = the adapter's handle cell for H; peer table is the other one | `OK`, or `OK n=<N>` for read and write | |
| 63 | |
| 64 | ### Task, launch and authority commands |
| 65 | |
| 66 | | command | meaning | result | |
| 67 | |---|---|---| |
| 68 | | `cap <C> [gen=<n>]` | the test authority mints a capability for spawning in the vector's domain; default generation 7 (domain 1) or `0x100000007` (domain 2) | `OK` | |
| 69 | | `revokecap <C>` | the authority root revokes it | `OK` | |
| 70 | | `bind <B> cap=<C> [gen=<n>] [domain=<d>] [index=<n>]` / `bind <B> none` | a binding built from C with fields overridden; `none` is no binding | `OK` | |
| 71 | | `spawn <T> <prog> [in=<H>] [out=<H>] bind=<B>` | `TASK_SPAWN` from table A; an omitted slot is empty | `OK` or the refusal | |
| 72 | | `run` | let every task run until none can move (a deterministic stand-in for time passing) | `OK` | |
| 73 | | `wait <T>` | `TASK_WAIT` with deadline 0 | `OK status=<N> outcome=<O>`, `WOULD_BLOCK`, `OUTCOME_UNKNOWN status=1 outcome=OUTCOME_UNKNOWN` | |
| 74 | | `state <T>` | `TASK_STATE` | `OK state=RUNNING\|ENDED` | |
| 75 | | `tcancel <T> interrupt\|terminate` | `TASK_CANCEL` | `OK` | |
| 76 | | `launch <P> bind=<B> [in=<q>] [inject=<k>:<ERR>] [revoke=<k>:<C>] : <prog> ! <prog> ...` | launch one pipeline (ST7); stdin of the first command is `in` then end of stream, stdout of the last is captured; `inject` makes the spawn of command k fail with ERR; `revoke` revokes C just before command k's effect | `OK`, or `<ERR> status=<N> outcomes=<O>,... statuses=<N\|->,...` | |
| 77 | | `waitp <P>` | wait for every command (deadline 0) | `OK status=<N> outcomes=... statuses=... out=<q>` or `WOULD_BLOCK` | |
| 78 | | `cancelp <P> interrupt\|terminate` | `TASK_CANCEL` every running command of P | `OK` | |
| 79 | | `reset` | session reset with ABI section 12 cleanup | `OK cancelled=<N>` | |
| 80 | | `crash` / `recover` | the adapter dies with no cleanup and restarts; recovery reports intents without outcome | `OK` / `OK unknown=<N> replayed=0` | |
| 81 | | `lose <T>` | the ended task's status becomes unobservable to the adapter (Linux: someone else reaped it) | `OK` | |
| 82 | |
| 83 | Programs the harness provides (not shell commands; the adapter's test harness implements them natively): `exit <N>`; `emit <q> [<N>]` writes the bytes then exits N (default 0); `cat` copies input to output until end of stream; `drain` reads to end of stream; `flood` writes `y\n` forever; `hang` waits until interrupted; `stubborn` ignores interrupts; `nosuch` is a name `RESOLVE` does not find; `foreign` is a name that resolves to a class this adapter does not provide. A program that gets `BROKEN_PIPE` on output exits 141; an obeyed interrupt ends it with 130 (ST6.3). Outcomes are the section 10 names; a status `-` is a command that never started. |
| 84 | |
| 85 | `check` items: `empty` (both tables, every pipe, every task and every intent record are gone and no recovery report is pending) and `pipes=<N>` (live pipes). |
| 86 | |
| 87 | ### Run reports and receipts |
| 88 | |
| 89 | An adapter runner prints one line per vector, `PASS <file>`, `MISMATCH <file>:<line> got "<x>" want "<y>"` or `NOT_RUN <file> <reason>` (missing feature or domain), then `OSHSV1_CONFORMANCE impl=<name> vectors=<n> pass=<n> fail=<n> not_run=<n>`. Its first line is `OSHSV1_RUN impl=<repo>@<40-hex commit> corpus=aien-protocols-mv@<40-hex commit> toolchain=<compiler and version> target=host|qemu-<machine>`; a report whose first line lacks any of these pins is not a receipt (ST10.3). The reference model prints the same format with `impl=reference-model`; its result is a check of the corpus only. |
| 90 | |
| 91 | ## Human-Directed Agentic Engineering |
| 92 | |
| 93 | Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, |
| 94 | architecture, constraints, acceptance criteria, and stopping points; agents implement, |
| 95 | execute checks, diagnose failures, and revise within those boundaries. Human review |
| 96 | retains responsibility for claims, acceptance, and release decisions. This describes |
| 97 | the development method, not a change to runtime autonomy or historical evidence. |
| 98 | |
| 99 | For the documented method and a systems-software case study, see Gregory M. Kurtzer |
| 100 | (2026), *Ginux: Building an Independent Kernel That Runs Linux Userspace through |
| 101 | Human-Directed Agentic Engineering*, technical report, v1, Zenodo, |
| 102 | <https://doi.org/10.5281/zenodo.23682548>. |