Files
aji/build.zig
T
dev 6eceb4405b E0-1: Agent Reference Bundle and Phase 2 baseline
- docs/agent/bundle.txt: minimal AIR reference by file and section
  (grammar, instructions, types, traps, verifier rules, resources,
  effects, capabilities, intrinsics, heap/regions, unsafe, runtime
  contract, diagnostics and registries); syntax-example.air verifies
  and runs
- zig build agent-reference: deterministic bundle and report (files,
  sections, bytes, lines, words); section extraction ignores fenced code
- tools/agent_bundle_tokens.py: cl100k_base, o200k_base and Qwen2.5 BPE
  counts; growth warnings >10 % and review >20 % against history.json
- baseline after Phase 2: 104 250 bytes, 16 197 words, ~27.3k tokens
- CI builds the bundle and counts tokens (non-blocking)
- evaluation protocol 0.2: benchmark families, Aji/AIR and Aji/source
  conditions, 36-run engineering smoke test, order of work
- RFC template and AGENTS.md: report bundle growth
2026-10-04 15:44:26 +03:00

86 lines
3.4 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Library: verifier, AIR, interpreter. Everything the TCB contains lives here.
const mod = b.addModule("aji", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
// The error-code registry in docs/ is the source of truth; a test keeps
// src/diag.zig in sync with it.
mod.addAnonymousImport("error_codes_md", .{
.root_source_file = b.path("docs/reference/error-codes.md"),
});
mod.addAnonymousImport("air_features_md", .{
.root_source_file = b.path("docs/reference/air-features.md"),
});
mod.addAnonymousImport("effects_md", .{
.root_source_file = b.path("docs/reference/effects.md"),
});
mod.addAnonymousImport("capabilities_md", .{
.root_source_file = b.path("docs/reference/capabilities.md"),
});
mod.addAnonymousImport("intrinsics_md", .{
.root_source_file = b.path("docs/reference/intrinsics.md"),
});
// CLI: `aji`.
const exe = b.addExecutable(.{
.name = "aji",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{.{ .name = "aji", .module = mod }},
}),
});
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
run_cmd.addPassthruArgs();
b.step("run", "Run the aji CLI").dependOn(&run_cmd.step);
// Unit tests.
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = mod })).step);
test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = exe.root_module })).step);
// Conformance suite runner (tests/conformance).
const conformance = b.addExecutable(.{
.name = "aji-conformance",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/conformance.zig"),
.target = target,
.optimize = optimize,
.imports = &.{.{ .name = "aji", .module = mod }},
}),
});
const run_conformance = b.addRunArtifact(conformance);
run_conformance.addArg("tests/conformance");
run_conformance.addPassthruArgs();
b.step("conformance", "Run the conformance suite").dependOn(&run_conformance.step);
test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = conformance.root_module })).step);
// Agent Reference Bundle (spec 14 §3.7): zig-out/agent/{reference-bundle.md,report.json}.
const bundle = b.addExecutable(.{
.name = "aji-agent-bundle",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/agent_bundle.zig"),
.target = target,
.optimize = optimize,
.imports = &.{.{ .name = "aji", .module = mod }},
}),
});
const run_bundle = b.addRunArtifact(bundle);
run_bundle.setCwd(b.path("."));
run_bundle.addArgs(&.{ ".", "zig-out/agent" });
run_bundle.has_side_effects = true;
b.step("agent-reference", "Build the Agent Reference Bundle and report its size").dependOn(&run_bundle.step);
test_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = bundle.root_module })).step);
}