P6A-8: Source Reference Bundle and harness profile aji_source

- source bundle: a /docs directory with QUICK.md (Quick Reference plus a
  where-to-read table), language/*.md, diagnostics/errors.md and the AIR
  bundle only under air/; built from docs/agent/source-bundle.txt
  (> output files, @manifest includes) by zig build agent-reference
- Quick Reference examples are checked: every aji block must be an
  excerpt of a conformance program in tests/conformance/source/quickref
  (zig build test fails otherwise); QR fixes found by the check
  (mut d = data, region not auto-borrowed, statement/borrow blocks that
  could not verify, io_error match)
- frontend: task.*/channel.*/mutex.* are not-yet-implemented, not E7006
- aji lower --stats: mechanical_air_eliminated_raw and _normalized (each
  byte-string materialization counted as one constant; spec 15 §11)
- harness: profile aji_source (doc_groups), per-file and per-group docs
  metrics on distinctive lines, profile columns (tool calls, lowered AIR
  raw/normalized, docs files read, IR-form and type-mismatch counts),
  dev-echo aji_source variant, scripted run and test, source token report
- plan: P6A-8 done, P6A-9 criteria; Q-021/Q-022 resolved; unsafe block
  deferred
This commit is contained in:
dev committed 2026-10-05 13:16:51 +03:00
1 parent 61be766634
commit 3e2d9b63a7
35 files changed
+1170 -106

No files matched your search

@@ -18,11 +18,14 @@ def build():
return subprocess.run(["cargo", "build", "-q", "--offline"], cwd=ws, capture_output=True).returncode == 0
if lang == "zig":
return subprocess.run(["zig", "build-exe", "main.zig"], cwd=ws, capture_output=True).returncode == 0
return subprocess.run([AJI, "check", "main.air"], cwd=ws, capture_output=True).returncode == 0
src = "main.aji" if lang == "aji_source" else "main.air"
return subprocess.run([AJI, "check", src], cwd=ws, capture_output=True).returncode == 0
def run(inp):
if lang == "aji_air":
p = subprocess.run([AJI, "run", "--grant", "in=io.read", "--grant", "out=io.write", "--stdin", inp, "main.air"], cwd=ws, capture_output=True, text=True, timeout=60)
if lang in ("aji_air", "aji_source"):
# `in` is a keyword in .aji, so the source entry point names it `input`.
argv = ["--grant", "in=io.read", "main.air"] if lang == "aji_air" else ["--grant", "input=io.read", "main.aji"]
p = subprocess.run([AJI, "run", argv[0], argv[1], "--grant", "out=io.write", "--stdin", inp, argv[2]], cwd=ws, capture_output=True, text=True, timeout=60)
try:
rec = json.loads(p.stdout)
except json.JSONDecodeError:
@@ -0,0 +1,5 @@
# Interface
- Source: `main.aji`, an `.aji` module.
- Entry point: `main(input: cap<io.read>, out: cap<io.write>)`; any return type.
- The program is run as `aji run --grant input=io.read --grant out=io.write --stdin TEXT main.aji`; the bytes written to standard output appear in the run record's `stdout` field.
@@ -0,0 +1,7 @@
#!/bin/sh
# Public test: one input.
out=$(aji run --grant input=io.read --grant out=io.write --stdin 'hello' main.aji) || { echo "FAIL: aji run failed"; echo "$out"; exit 1; }
case "$out" in
*'"stdout":"hello"'*) echo "PASS";;
*) echo "FAIL: unexpected run record: $out"; exit 1;;
esac
@@ -6,6 +6,7 @@
"prompt": "prompt.md",
"languages": {
"aji_air": {"workspace": "lang/aji_air", "test": "sh test.sh"},
"aji_source": {"workspace": "lang/aji_source", "test": "sh test.sh"},
"rust": {"workspace": "lang/rust", "test": "sh test.sh"},
"zig": {"workspace": "lang/zig", "test": "sh test.sh"}
},