spec: accept RFC 0007 and integrate I/O and linear resources

- spec 06 §6-§7: feature resources, consumption and verifier rules,
  io_error
- spec 05 §11.1 fallible intrinsic form; spec 07 §8.7 frozen built-in
  enum variants, §8.9 resource types; spec 07a resources and run record
  fields; spec 11 §8 execution profiles, blocked outcome, result channel
- reference/intrinsics.md: formal catalogue; capabilities.md: io_error
  and fs prefix narrowing
- features: resources published, linear_aggregates reserved
This commit is contained in:
dev committed 2026-10-04 13:52:26 +03:00
1 parent c7bcea294e
commit 571cc6e362
9 files changed
+199 -83

No files matched your search

+31
View File
@@ -87,6 +87,7 @@ not_instantiated the environment did not start the program (spec 05 §10.2)
returned the program finished
trapped the program failed (T0xxx)
limit_exceeded the environment stopped the program
blocked the program can make no further progress (§8)
```
Running without a fuel limit is permitted (for example `aji run program.air`). Conformance, fuzz and stress runs MUST use a fuel limit.
@@ -100,3 +101,33 @@ With several tasks, fuel is global: the sum of instructions executed by all task
| fuel | how long the program may execute |
| schedule budget | how many interleavings schedule exploration examines |
| quantum | how many instructions a task executes before a forced scheduling point |
## 8. Execution profiles
Decision record: RFC 0007.
The run record gains fields for observable output. `aji run` uses the **deterministic** profile by default; `--profile hosted` uses the real host.
| Aspect | `deterministic` | `hosted` |
|---|---|---|
| stdout / stderr | captured; reported as `"stdout"` / `"stderr"` strings in the run record, which is printed on stdout | the process's real streams; the run record is written to a separate result channel (below) |
| stdin | from `--stdin TEXT` (empty by default) | real stdin |
| files | in-memory file system seeded by `--vfs PATH=TEXT`; files written during the run are reported as `"files"` in the run record | real file system, limited by capability scopes |
| network | in-process loopback: `net.connect` to a listening address of the same run queues a connection that `net.accept` returns; sends are buffered; an operation that would wait for an event that can never occur ends the run with the environment outcome `blocked` (below) | real sockets |
| clock | the number of instructions executed so far (1 ns per instruction) | real monotonic clock |
| random | PRNG seeded by `--seed N` (default 0), algorithm fixed by the spec | host CSPRNG |
**Quiescence.** In the `deterministic` profile, when an operation would wait, no other execution unit can run, and no future deterministic event can complete the wait, the run ends with the environment outcome
```json
{"status":"blocked","kind":"no_future_event","function":"…","block":"…","inst":0}
```
and `aji run` exits with code 7. This is not an `io_error` and not a trap: the program did not ask for a timeout, so none is invented. In the `hosted` profile the same operation simply blocks. A program that needs a timeout states it explicitly (timers and `select`, Phase 3). The outcomes are now:
```text
program outcome: returned, trapped
environment outcome: not_instantiated, limit_exceeded, blocked
```
**Result channel.** In the `hosted` profile the program owns stdout and stderr, so the run record cannot share them unambiguously. The machine-readable record goes to a separate channel: `aji run --profile hosted --result-file PATH` (a `--result-fd N` form may follow; `ajid` has its own control channel). Without `--result-file` the CLI may print a human-readable summary on stderr after the program ends; that summary is not a machine interface.