graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
build: move to the stable Zig 0.17.0 release
justrach85eb003f25f1
diff --git a/.github/actions/setup-codegraff-zig/action.yml b/.github/actions/setup-codegraff-zig/action.ymlindex b56988e7..93e4980d 100644--- a/.github/actions/setup-codegraff-zig/action.yml+++ b/.github/actions/setup-codegraff-zig/action.yml@@ -1,10 +1,10 @@name: Setup pinned Codegraff Zig-description: Restore or install Codegraff's checksum-pinned Zig nightly without a JavaScript runtime+description: Restore or install Codegraff's checksum-pinned Zig release without a JavaScript runtimeinputs:version:- description: Exact Zig nightly used by Codegraff- default: 0.17.0-dev.813+2153f8143+ description: Exact Zig release used by Codegraff+ default: 0.17.0runs:using: compositediff --git a/build.zig b/build.zigindex 0bdb3610..984b7e41 100644--- a/build.zig+++ b/build.zig@@ -3,7 +3,7 @@ const std = @import("std");pub fn build(b: *std.Build) void {const target = b.standardTargetOptions(.{});const optimize = b.standardOptimizeOption(.{});- const lean_release = optimize == .ReleaseFast or optimize == .ReleaseSmall;+ const lean_release = optimize == .fast or optimize == .small;// `--version` string: stamped from `git describe` at build time so every// binary says which commit built it; `-Dversion=X.Y.Z` overrides (the@@ -281,7 +281,7 @@ pub fn build(b: *std.Build) void {.cpu_arch = .wasm32,.os_tag = .freestanding,}),- .optimize = if (optimize == .Debug) .ReleaseSmall else optimize,+ .optimize = if (optimize == .debug) .small else optimize,.strip = true,}),});diff --git a/build.zig.zon b/build.zig.zonindex 5ee33cdd..f6291ded 100644--- a/build.zig.zon+++ b/build.zig.zon@@ -1,15 +1,15 @@.{.name = .codegraff,.version = "0.17.0",- .minimum_zig_version = "0.17.0-dev.813+2153f8143",+ .minimum_zig_version = "0.17.0",.dependencies = .{.accord = .{- .url = "git+https://github.com/justrach/accord#c053e17295cb7ad8c0fb284d7d7748aad4aeeeea",- .hash = "accord-0.0.0-aQy1J3iBAgADDHWM0hIAXhISKtQ0zasFN7TyLhI_tkI8",+ .url = "git+https://github.com/justrach/accord#24b83a12ae750ecd9952c1a601f0c242cfddcd00",+ .hash = "accord-0.0.0-aQy1J7aBAgC94tkQM7Y_ee6ILQq8Pu59Vaq-2onJ42K6",},.http_zig = .{- .url = "git+https://github.com/justrach/http-zig#b875fed4741b947e731b86f430f532895f13c1de",- .hash = "http_zig-0.1.0-2CB7E-ERAwBIvemDRdHHwUIk68jZJY0rlfQgNoi8rnqX",+ .url = "git+https://github.com/justrach/http-zig#5b0324bb3ab49fe18947b2f17fe7649760e1540a",+ .hash = "http_zig-0.1.0-2CB7E00SAwAnwnBkJDgCDm3zLwrCmZZkHNSw5t7X9Vbf",},},.paths = .{""},diff --git a/docs/zig-0.17-port-plan.md b/docs/zig-0.17-port-plan.mdindex 6ea52d31..791542df 100644--- a/docs/zig-0.17-port-plan.md+++ b/docs/zig-0.17-port-plan.md@@ -1,21 +1,39 @@-# Zig 0.17 development-toolchain migration+# Zig 0.17 migration-**Status: implemented for v0.0.210.** CodeGraff is pinned to-`0.17.0-dev.813+2153f8143` until a stable Zig 0.17 release is available. The-full version is intentional: a moving `master` pin would make CI and releases-non-reproducible.+**Status: on the stable Zig 0.17.0 release.** CodeGraff moved to the+development build `0.17.0-dev.813+2153f8143` for v0.0.210 and to the stable+`0.17.0` release once it shipped. The exact version is pinned: a moving pin+would make CI and releases non-reproducible.## Select the toolchain```sh-zigup 0.17.0-dev.813+2153f8143+zigup 0.17.0zig version```-The second command must print `0.17.0-dev.813+2153f8143`. The same exact value-is used by `build.zig.zon`, the installer, CI, Windows CI, and release builds.+The second command must print `0.17.0`. The same exact value is used by+`build.zig.zon`, the installers, CI, Windows CI, and release builds. The CI+installer (`scripts/install-zig-ci.py`) pins each platform's archive, `zig`+binary and extracted-tree SHA-256.-## Migration changes+## From the development build to 0.17.0++- The optimize modes are lowercase fields (`.debug`, `.safe`, `.fast`,+ `.small`); `build.zig` and `builtin.mode` checks use them. The old names+ remain only as deprecated declarations, and `-Doptimize=ReleaseFast` still+ parses.+- `zig fmt` rewrites renamed builtins, for example `@intFromEnum` to+ `@backingInt`; the reformatted files are part of the move.+- `std.crypto`: `X25519.KeyPair.generateDeterministic` and+ `X25519.recoverPublicKey` no longer return error unions, and RSA PKCS#1 v1.5+ `verify`/`concatVerify` take the signature by pointer.+- The unmanaged `ArrayList` has a `pointer_stability` field, so tests build a+ list from a slice with `.fromOwnedSlice`.+- The `accord` and `http-zig` dependencies are pinned to their `zig-0.17.0`+ branches, which carry the same changes.++## From Zig 0.16 to the development build- Replaced the removed `b.build_root` Build API field.- Replaced the removed `**` array/string repetition operator with `@splat` and@@ -52,6 +70,6 @@ trading away runtime speed.## Rollback-`zigup` keeps Zig 0.16 installed, so historical builds can still run with-`zigup run 0.16.0 build`. Current development and releases must use the pinned-Zig 0.17 development build above.+`zigup` keeps older toolchains installed, so historical builds can still run+with `zigup run 0.17.0-dev.813+2153f8143 build` (or `zigup run 0.16.0 build`+for older tags). Current development and releases must use Zig 0.17.0.diff --git a/install.sh b/install.shindex 923b8a45..7cfd3e9e 100644--- a/install.sh+++ b/install.sh@@ -16,7 +16,7 @@ set -euo pipefailREPO="${HARNESS_REPO:-https://github.com/justrach/codegraff}"INSTALL_DIR="${HARNESS_DIR:-$HOME/bin}"BIN="graff"-ZIG_VERSION="0.17.0-dev.813+2153f8143"+ZIG_VERSION="0.17.0"# ColorsR='\033[0;31m' G='\033[0;32m' Y='\033[0;33m' C='\033[0;36m' W='\033[1;37m' D='\033[0;90m' N='\033[0m'diff --git a/scripts/cloud-agent-install.sh b/scripts/cloud-agent-install.shindex b3c5f398..9e1ec8fa 100755--- a/scripts/cloud-agent-install.sh+++ b/scripts/cloud-agent-install.sh@@ -7,8 +7,8 @@set -euo pipefail# Keep these two in lockstep with scripts/install-zig-ci.py.-ZIG_VERSION="0.17.0-dev.813+2153f8143"-ZIG_LINUX_X86_64_SHA256="b0d46ffc4587b9e8dd0b524ee5bc4da1e67f28bba55e7c534cec64af2f2d7a74"+ZIG_VERSION="0.17.0"+ZIG_LINUX_X86_64_SHA256="1cbe9df9f27e6b78d14ccbca43b6703a404ef79ef1c463de901d7f088d4e2026"ZIG_ARCHIVE="zig-x86_64-linux-${ZIG_VERSION}.tar.xz"ZIG_PREFIX="/opt/codegraff-zig"diff --git a/scripts/install-zig-ci.py b/scripts/install-zig-ci.pyindex 2c2ae5e2..9cb4e15e 100644--- a/scripts/install-zig-ci.py+++ b/scripts/install-zig-ci.py@@ -1,5 +1,5 @@#!/usr/bin/env python3-"""Install Codegraff's exact Zig nightly after SHA-256 verification."""+"""Install Codegraff's exact Zig release after SHA-256 verification."""from __future__ import annotations@@ -16,25 +16,25 @@ import urllib.requestimport zipfile-PINNED_VERSION = "0.17.0-dev.813+2153f8143"+PINNED_VERSION = "0.17.0"ASSETS = {("Darwin", "aarch64"): ("zig-aarch64-macos-{version}.tar.xz",- "36673d2513afa4a96c86780648ba504beedd7f0451389091cf9d53e38d5b4840",- "08abf236d78c05b8520431fbca99903ff98653b2f1cd1c3665a7f8c91247421c",- "14a2d724c45db74ba6ef33c5d6c467dde1f6689349009b78d086df426866db09",+ "b607e9b9234790a008116ae5bdb71c6243b84b9fb42a53a9e70fde41c06c536a",+ "1c5f706db0ed6d55451940f31dc05a6177d05696bc1fa5d853696d04c718b523",+ "b983da8def266bff611c1dbf4e1298cce60de215b4c0a56a049349f9eae4bf94",),("Linux", "x86_64"): ("zig-x86_64-linux-{version}.tar.xz",- "b0d46ffc4587b9e8dd0b524ee5bc4da1e67f28bba55e7c534cec64af2f2d7a74",- "08241893d9dad32a3d0e71937d6f659e8fba4598ca29b8c9eaa75ee31c9edb4c",- "e75b3cba834758312b1ac4c1fcf10301851bc05ca53386ed6956c84fcd48ec77",+ "1cbe9df9f27e6b78d14ccbca43b6703a404ef79ef1c463de901d7f088d4e2026",+ "7c61539af19fa4082c94848f1c2b57b89e76dc6cfd5bd4c57764c3caf8f82272",+ "9f3dc17f2e18a697d8e1a1a81eb0479b82e108ddbafd6fa6c9f325a635b8528b",),("Windows", "x86_64"): ("zig-x86_64-windows-{version}.zip",- "2a8f1a34402076ab7931e4535bd379b20c83fc263d1387cb3f70cb2e397f9ebe",- "ba08d13e71268f7305887293bf6726f2effa0b6b3b9b4169be45f34cc7730c73",- "364e24705f60cc8a7433c8002ebf0d9dd0be40a4b0a183447112795afe35813d",+ "b5663f69581dcf391293fbf16c06cb80d81d806545ce618b4d0bab7f0eb8c428",+ "f54b14f02a4d7d8ac62a94a0663486eb166bba3745d85b466238c1b93e723d46",+ "d259bdc19c8e407a1653d4474d36429523a828f5cf89c7b10909bea073cafae8",),}MIRRORS = (diff --git a/src/agent_stream.zig b/src/agent_stream.zigindex 42c16555..670eaee4 100644--- a/src/agent_stream.zig+++ b/src/agent_stream.zig@@ -192,7 +192,7 @@ pub fn postStreamWithClient(self: *Agent, client: *std.http.Client, body: []cons// 429/5xx before any body: a retryable throttle — request() backs// off and retries (surfaced in the trace as a "retry" note).- const status_code = @intFromEnum(response.head.status);+ const status_code = @backingInt(response.head.status);if (status_code == 429 or status_code >= 500) {http.captureRetryAfter(&response); // #retry-after: honor the provider's requested backoff// Drain a snippet for quota classifiers. Do not echo it on the REPLdiff --git a/src/behavior_upload.zig b/src/behavior_upload.zigindex fc6bc2e4..75eaea86 100644--- a/src/behavior_upload.zig+++ b/src/behavior_upload.zig@@ -496,7 +496,7 @@ pub fn postBatch(client: *std.http.Client, url: []const u8, payload: []const u8,.headers = .{ .content_type = .{ .override = "application/json" } },.extra_headers = extra_headers,}) catch return false;- const status = @intFromEnum(response.status);+ const status = @backingInt(response.status);return status >= 200 and status < 300;}diff --git a/src/cancel_source.zig b/src/cancel_source.zigindex 0e6fd4e0..c5b0cd10 100644--- a/src/cancel_source.zig+++ b/src/cancel_source.zig@@ -34,13 +34,13 @@ var source: std.atomic.Value(u8) = .init(0);/// Raise the flag and remember who did.pub fn cancel(s: Source) void {- source.store(@intFromEnum(s), .release);+ source.store(@backingInt(s), .release);Agent.esc_cancel.store(true, .release);}/// A deadline must not replace an already recorded user cancellation.pub fn cancelIfIdle(s: Source) void {- if (source.cmpxchgStrong(0, @intFromEnum(s), .acq_rel, .acquire) == null)+ if (source.cmpxchgStrong(0, @backingInt(s), .acq_rel, .acquire) == null)Agent.esc_cancel.store(true, .release);}@@ -59,7 +59,7 @@ pub fn clear() void {/// The source of the cancel that just ended a turn; consumed, and traced/// (`interrupted source=…`) so the next false interrupt can be attributed.pub fn take(tracer: ?*Tracer) Source {- const s: Source = @enumFromInt(source.swap(0, .acq_rel));+ const s: Source = @fromBackingInt(@intCast(source.swap(0, .acq_rel)));if (tracer) |tr| {var buf: [48]u8 = undefined;tr.note("turn", note(&buf, s));diff --git a/src/commands_effort.zig b/src/commands_effort.zigindex 45afd506..1ab16acb 100644--- a/src/commands_effort.zig+++ b/src/commands_effort.zig@@ -18,7 +18,7 @@ const reasoning_levels = [_]pickers.PickItem{fn display(root: *Agent, effort: ReasoningEffort) []const u8 {if (er.mimoRoute(root.provider.id, root.provider.model) and effort == .high) return "On";- return reasoning_levels[@intFromEnum(effort)].name;+ return reasoning_levels[@backingInt(effort)].name;}fn normalized(root: *Agent, requested: []const u8) ?ReasoningEffort {@@ -44,7 +44,7 @@ pub fn handle(root: *Agent, arena: std.mem.Allocator, line: []const u8, out: *strows[i] = if (er.mimoRoute(root.provider.id, root.provider.model) and effort == .high).{ .name = "On", .desc = "Enable model reasoning" }else- reasoning_levels[@intFromEnum(effort)];+ reasoning_levels[@backingInt(effort)];if (effort == current) cur = i;}const idx = pickers.listPickerAt(root, arena, out, title, rows[0..levels.len], cur) orelse return true;diff --git a/src/commands_misc.zig b/src/commands_misc.zigindex 7def96e6..e57019de 100644--- a/src/commands_misc.zig+++ b/src/commands_misc.zig@@ -366,7 +366,7 @@ pub fn tryHandle(root: *Agent, keys: *Keys, arena: Allocator, line: []const u8,.response_writer = &aw.writer,.headers = .{ .user_agent = .{ .override = "simple-harness/" ++ harness_version } },}) catch break :lmstudio; // server not running → skip silently- if (@intFromEnum(res.status) != 200) break :lmstudio;+ if (@backingInt(res.status) != 200) break :lmstudio;if (aw.writer.buffered().len > 256 * 1024) break :lmstudio;const parsed = std.json.parseFromSliceLeaky(Value, arena, aw.writer.buffered(), .{ .allocate = .alloc_always }) catch break :lmstudio;if (parsed != .object) break :lmstudio;diff --git a/src/companion_boot.zig b/src/companion_boot.zigindex eb8a22a7..28082af5 100644--- a/src/companion_boot.zig+++ b/src/companion_boot.zig@@ -110,6 +110,6 @@ test "a licensed companion is pinned eager, once, so no discovery round-trip istest "ACP companion startup stays deferred despite JSON stdout discipline" {const positionals = [_][]const u8{"acp"};- const flags: args.Flags = .{ .yolo_flag = true, .positionals = .{ .items = @constCast(&positionals), .capacity = 0 } };+ const flags: args.Flags = .{ .yolo_flag = true, .positionals = .fromOwnedSlice(@constCast(&positionals)) };try std.testing.expect(deferCompanion(flags, true));}diff --git a/src/credential_store.zig b/src/credential_store.zigindex f1ef8d51..0c2a02e9 100644--- a/src/credential_store.zig+++ b/src/credential_store.zig@@ -19,8 +19,8 @@ const Value = std.json.Value;const Allocator = std.mem.Allocator;/// 0600 / 0700 on platforms that have permission bits at all.-pub const private_file: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @enumFromInt(0o600) else .default_file;-pub const private_dir: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @enumFromInt(0o700) else .default_dir;+pub const private_file: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @fromBackingInt(@intCast(0o600)) else .default_file;+pub const private_dir: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @fromBackingInt(@intCast(0o700)) else .default_dir;const max_symlink_hops = 40;diff --git a/src/cube.zig b/src/cube.zigindex dddc38b2..d82073a2 100644--- a/src/cube.zig+++ b/src/cube.zig@@ -42,7 +42,7 @@ fn gatewayFetch(io: Io, gpa: Allocator, arena: Allocator, method: std.http.Metho.user_agent = .{ .override = "simple-harness/" ++ harness_version },},});- return .{ .code = @intFromEnum(res.status), .body = aw.writer.buffered() };+ return .{ .code = @backingInt(res.status), .body = aw.writer.buffered() };}fn gatewayJson(io: Io, gpa: Allocator, arena: Allocator, method: std.http.Method, url: []const u8, key: []const u8, payload: ?[]const u8) !Value {@@ -228,7 +228,7 @@ fn cubePipeProbe(io: Io, gpa: Allocator, arena: Allocator, base: []const u8, ser},.extra_headers = extra[0..n],}) catch return 0;- return @intFromEnum(res.status);+ return @backingInt(res.status);}fn cubeNew(io: Io, gpa: Allocator, arena: Allocator, key: []const u8, out: *Io.Writer, minutes: i64) !void {diff --git a/src/doctor.zig b/src/doctor.zigindex 5f30260e..7d980918 100644--- a/src/doctor.zig+++ b/src/doctor.zig@@ -126,7 +126,7 @@ pub fn run(arena: Allocator, st: State) Allocator.Error![]const Check {pub fn worst(checks: []const Check) Severity {var top: Severity = .info;for (checks) |c| {- if (@intFromEnum(c.severity) > @intFromEnum(top)) top = c.severity;+ if (@backingInt(c.severity) > @backingInt(top)) top = c.severity;}return top;}diff --git a/src/edit_batch.zig b/src/edit_batch.zigindex 321ff61c..2592ab4a 100644--- a/src/edit_batch.zig+++ b/src/edit_batch.zig@@ -222,7 +222,7 @@ test "execBatch uses selected worktree, replace_all, one snapshot, and preservestry selected.dir.writeFile(io, .{.sub_path = "task.sh",.data = "old old\n",- .flags = .{ .permissions = @enumFromInt(0o755) },+ .flags = .{ .permissions = @fromBackingInt(@intCast(0o755)) },});var root_buf: [std.fs.max_path_bytes]u8 = undefined;const root_len = try selected.dir.realPath(io, &root_buf);@@ -316,7 +316,7 @@ test "execBatch and single edit share the same-file write lock" {try tmp.dir.writeFile(io, .{.sub_path = "slow",.data = "#!/bin/sh\ndir=$(dirname \"$0\")\n: > \"$dir/entered\"\nwhile [ ! -e \"$dir/release\" ]; do /bin/sleep 0.01; done\nexit 1\n",- .flags = .{ .permissions = @enumFromInt(0o755) },+ .flags = .{ .permissions = @fromBackingInt(@intCast(0o755)) },});var real_buf: [std.fs.max_path_bytes]u8 = undefined;const real_len = try tmp.dir.realPath(io, &real_buf);diff --git a/src/edit_verify.zig b/src/edit_verify.zigindex 17ec8db4..7b5794d7 100644--- a/src/edit_verify.zig+++ b/src/edit_verify.zig@@ -481,7 +481,7 @@ test "#337: a companion that lies about success returns a LOUD error, never the\\exit 0\\,- .flags = .{ .permissions = @enumFromInt(0o755) },+ .flags = .{ .permissions = @fromBackingInt(@intCast(0o755)) },});const dir = try std.fmt.allocPrint(gpa, ".zig-cache/tmp/{s}", .{&tmp.sub_path});@@ -534,7 +534,7 @@ test "#337: two edits to one file in the same turn both survive" {\\exit 1\\,- .flags = .{ .permissions = @enumFromInt(0o755) },+ .flags = .{ .permissions = @fromBackingInt(@intCast(0o755)) },});var real_buf: [std.fs.max_path_bytes]u8 = undefined;const real_len = try tmp.dir.realPath(io, &real_buf);diff --git a/src/escalation.zig b/src/escalation.zigindex e18055a7..921a1d60 100644--- a/src/escalation.zig+++ b/src/escalation.zig@@ -318,15 +318,15 @@ fn learnedVerdict(rung: Rung, o: Observables, phases: []const Value) Verdict {var g_declined: [std.enums.values(shapes.TaskClass).len]u8 = @splat(0);pub fn priorAttemptFailed(tc: shapes.TaskClass) bool {- return g_declined[@intFromEnum(tc)] > 0;+ return g_declined[@backingInt(tc)] > 0;}pub fn declineCount(tc: shapes.TaskClass) u8 {- return g_declined[@intFromEnum(tc)];+ return g_declined[@backingInt(tc)];}pub fn noteDeclined(tc: shapes.TaskClass) void {- const i = @intFromEnum(tc);+ const i = @backingInt(tc);if (g_declined[i] < 255) g_declined[i] += 1;}diff --git a/src/failure_evidence.zig b/src/failure_evidence.zigindex 2dd0b5d4..d171c777 100644--- a/src/failure_evidence.zig+++ b/src/failure_evidence.zig@@ -38,13 +38,13 @@ var g_len: [n_classes]usize = @splat(0);pub fn note(tc: TaskClass, text: []const u8) void {const trimmed = std.mem.trim(u8, text, " \t\r\n");const head = util.utf8Prefix(trimmed, evidence_cap);- const slot = &g_evidence[@intFromEnum(tc)];+ const slot = &g_evidence[@backingInt(tc)];for (slot[0..head.len], head) |*d, s| d.* = if (s == '\n' or s == '\r' or s == '\t') ' ' else s;- g_len[@intFromEnum(tc)] = head.len;+ g_len[@backingInt(tc)] = head.len;}pub fn evidence(tc: TaskClass) []const u8 {- return g_evidence[@intFromEnum(tc)][0..g_len[@intFromEnum(tc)]];+ return g_evidence[@backingInt(tc)][0..g_len[@backingInt(tc)]];}/// Session reset — escalation.resetSession forwards here so one call clearsdiff --git a/src/fleet.zig b/src/fleet.zigindex bf9b0598..3221871c 100644--- a/src/fleet.zig+++ b/src/fleet.zig@@ -376,7 +376,7 @@ fn eliteGetTask(client: *std.http.Client, url: []const u8, aw: *Io.Writer.Alloca.response_writer = &aw.writer,.headers = .{ .user_agent = .{ .override = "simple-harness" } },}) catch return;- ok.* = @intFromEnum(res.status) == 200;+ ok.* = @backingInt(res.status) == 200;}/// Select-arm deadline: bounds a best-effort HTTP GET (mirrors flushDeadline).diff --git a/src/html_view.zig b/src/html_view.zigindex 481458ea..dac1d513 100644--- a/src/html_view.zig+++ b/src/html_view.zig@@ -70,11 +70,11 @@ pub fn write(io: Io, a: Allocator, home: []const u8, html: []const u8) ![]consttry Io.Dir.cwd().createDirPath(io, dir);// Windows inherits the user profile ACL; Zig does not implement POSIX chmod there.if (@import("builtin").os.tag != .windows)- try Io.Dir.cwd().setFilePermissions(io, dir, @enumFromInt(0o700), .{});+ try Io.Dir.cwd().setFilePermissions(io, dir, @fromBackingInt(@intCast(0o700)), .{});var random: [16]u8 = undefined;io.random(&random);const path = try std.fmt.allocPrint(scratch.allocator(), "{s}/{s}.html", .{ dir, std.fmt.bytesToHex(random, .lower) });- try @import("credential_store.zig").replaceFile(io, Io.Dir.cwd(), path, html, @enumFromInt(0o600));+ try @import("credential_store.zig").replaceFile(io, Io.Dir.cwd(), path, html, @fromBackingInt(@intCast(0o600)));return try a.dupe(u8, path);}diff --git a/src/http.zig b/src/http.zigindex 84568f57..61fdc418 100644--- a/src/http.zig+++ b/src/http.zig@@ -153,7 +153,7 @@ fn post(gpa: Allocator, client: *std.http.Client, provider: Provider, body: []covar response: std.http.Client.Response = undefined;try sendHeadTask(&req, body, &response);- const code = @intFromEnum(response.head.status);+ const code = @backingInt(response.head.status);if (code == 429 or code >= 500) {// Drain a snippet for quota classifiers, then poison: the connection// still holds unread body bytes.diff --git a/src/http2_buffered.zig b/src/http2_buffered.zigindex 54343d42..2ef846eb 100644--- a/src/http2_buffered.zig+++ b/src/http2_buffered.zig@@ -153,7 +153,7 @@ const Exchange = struct {};try req.sendBodiless();var response = try req.receiveHead(&.{});- self.status = @intFromEnum(response.head.status);+ self.status = @backingInt(response.head.status);if (self.status != 200) {if (redirects(self.status)) {if (response.head.location) |location|@@ -178,7 +178,7 @@ const Exchange = struct {}var response: std.http.Client.Response = undefined;try @import("http.zig").sendHeadTask(&req, self.body, &response);- self.status = @intFromEnum(response.head.status);+ self.status = @backingInt(response.head.status);if (self.status != 200) {// Error bodies may contain private details. Close without reading.if (req.connection) |conn| conn.closing = true;diff --git a/src/http2_pool.zig b/src/http2_pool.zigindex e26bc034..d79f10c5 100644--- a/src/http2_pool.zig+++ b/src/http2_pool.zig@@ -153,7 +153,7 @@ fn countWindowUpdates(bytes: []const u8) usize {while (i + 9 <= bytes.len) {const len = (@as(usize, bytes[i]) << 16) | (@as(usize, bytes[i + 1]) << 8) | bytes[i + 2];if (i + 9 + len > bytes.len) break;- if (bytes[i + 3] == @intFromEnum(frame.Type.window_update)) n += 1;+ if (bytes[i + 3] == @backingInt(frame.Type.window_update)) n += 1;i += 9 + len;}return n;diff --git a/src/job_capture.zig b/src/job_capture.zigindex 68a248f3..7eeebd34 100644--- a/src/job_capture.zig+++ b/src/job_capture.zig@@ -178,7 +178,7 @@ pub fn reported(io: Io, dir: []const u8) bool {/// the newest `keep` bytes of a larger burst and returns true when it skipped/// older ones.pub fn readNew(io: Io, gpa: Allocator, capture: *Capture, which: Stream, keep: usize, out: *std.ArrayList(u8)) bool {- const i = @intFromEnum(which);+ const i = @backingInt(which);const f = capture.readers[i] orelse blk: {var buf: [std.fs.max_path_bytes]u8 = undefined;const opened = Io.Dir.cwd().openFile(io, capture.path(&buf, @tagName(which)), .{ .mode = .read_write }) catch return false;diff --git a/src/job_registry_stop.zig b/src/job_registry_stop.zigindex 20bd2e6b..3310cb63 100644--- a/src/job_registry_stop.zig+++ b/src/job_registry_stop.zig@@ -92,7 +92,7 @@ pub const Native = struct {try std.posix.kill(-pid, if (sig == .term) .TERM else .KILL);}pub fn groupGone(self: Native, pid: i32) ?bool {- std.posix.kill(-pid, @enumFromInt(0)) catch |err| switch (err) {+ std.posix.kill(-pid, @fromBackingInt(@intCast(0))) catch |err| switch (err) {error.ProcessNotFound => return true,// Darwin can report EPERM for a zombie-only group. This is not// absence evidence: require the independent process inventory.diff --git a/src/keys_cli.zig b/src/keys_cli.zigindex f76198e4..3d2a880a 100644--- a/src/keys_cli.zig+++ b/src/keys_cli.zig@@ -63,7 +63,7 @@ pub fn fetchOpenAIModels(io: Io, gpa: Allocator, arena: Allocator, models_url: [.response_writer = &aw.writer,.extra_headers = &extra,}) catch return list.items;- if (@intFromEnum(res.status) != 200) return list.items;+ if (@backingInt(res.status) != 200) return list.items;const v = std.json.parseFromSliceLeaky(Value, arena, aw.writer.buffered(), .{ .allocate = .alloc_always }) catch return list.items;if (v != .object) return list.items;const data = v.object.get("data") orelse return list.items;diff --git a/src/kimi_catalog.zig b/src/kimi_catalog.zigindex 5a547af5..3810321c 100644--- a/src/kimi_catalog.zig+++ b/src/kimi_catalog.zig@@ -131,7 +131,7 @@ pub fn fetch(io: Io, gpa: Allocator, arena: Allocator, home: []const u8, access:.headers = .{ .user_agent = .{ .override = user_agent } },.extra_headers = &extra,}) catch return .{};- if (@intFromEnum(response.status) != 200) return .{};+ if (@backingInt(response.status) != 200) return .{};const rows = parseModels(arena, aw.writer.buffered()) orelsereturn .{ .source = "baked fallback — invalid live catalog" };return .{ .rows = rows, .source = "live account catalog" };diff --git a/src/kimi_identity.zig b/src/kimi_identity.zigindex c75a8239..699759e5 100644--- a/src/kimi_identity.zig+++ b/src/kimi_identity.zig@@ -23,8 +23,8 @@ var device_model_buf: [128]u8 = undefined;var os_version_buf: [128]u8 = undefined;var host_fields_ready = false;-const private_file_permissions: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @enumFromInt(0o600) else .default_file;-const private_dir_permissions: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @enumFromInt(0o700) else .default_dir;+const private_file_permissions: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @fromBackingInt(@intCast(0o600)) else .default_file;+const private_dir_permissions: Io.File.Permissions = if (Io.File.Permissions.has_executable_bit) @fromBackingInt(@intCast(0o700)) else .default_dir;/// Node `os.arch()` names. kimi-code puts these in `X-Msh-Device-Model`.pub fn nodeArch(tag: std.Target.Cpu.Arch) []const u8 {diff --git a/src/learn_delete.zig b/src/learn_delete.zigindex 58c767f6..68ad99d7 100644--- a/src/learn_delete.zig+++ b/src/learn_delete.zig@@ -35,7 +35,7 @@ fn deleteRequest(client: *std.http.Client, url: []const u8, token: []const u8) u.method = .DELETE,.extra_headers = &headers,}) catch return 0;- return @intFromEnum(response.status);+ return @backingInt(response.status);}/// One DELETE plus every byte it touches, in heap state the caller does notdiff --git a/src/learning_privacy.zig b/src/learning_privacy.zigindex 3bcbc505..079f7425 100644--- a/src/learning_privacy.zig+++ b/src/learning_privacy.zig@@ -41,7 +41,7 @@ pub const Mode = enum(u8) {/// an explicit per-artifact approval, and `--learning-privacy local`,/// `GRAFF_LEARNING_PRIVACY=local`, `/privacy local`, `GRAFF_FLEET=off`, or/// `--no-telemetry` each turn contribution off.-var mode_value: std.atomic.Value(u8) = .init(@intFromEnum(Mode.aggregate));+var mode_value: std.atomic.Value(u8) = .init(@backingInt(Mode.aggregate));var approvals_mu: Io.Mutex = .init;const max_approved_templates = 64;var approved_hashes: [max_approved_templates][32]u8 = undefined;@@ -64,7 +64,7 @@ pub const default_mode: Mode = .aggregate;pub fn init(cli_mode: ?Mode, env_value: ?[]const u8) void {const selected = cli_mode orelse if (env_value) |value| parse(value) orelse .local else default_mode;- mode_value.store(@intFromEnum(selected), .release);+ mode_value.store(@backingInt(selected), .release);// Startup is single-threaded. Artifact approvals never persist between// processes, and a repo-controlled file cannot silently grant them.approved_len = 0;@@ -72,13 +72,13 @@ pub fn init(cli_mode: ?Mode, env_value: ?[]const u8) void {}pub fn current() Mode {- return @enumFromInt(mode_value.load(.acquire));+ return @fromBackingInt(@intCast(mode_value.load(.acquire)));}pub fn setMode(io: Io, mode: Mode) void {approvals_mu.lockUncancelable(io);defer approvals_mu.unlock(io);- mode_value.store(@intFromEnum(mode), .release);+ mode_value.store(@backingInt(mode), .release);// A mode change invalidates content approvals. Raising the ceiling must// still ask for each artifact; lowering it revokes them immediately.approved_len = 0;@@ -86,11 +86,11 @@ pub fn setMode(io: Io, mode: Mode) void {}pub fn allowsAggregate() bool {- return @intFromEnum(current()) >= @intFromEnum(Mode.aggregate);+ return @backingInt(current()) >= @backingInt(Mode.aggregate);}pub fn allowsTemplateReview() bool {- return @intFromEnum(current()) >= @intFromEnum(Mode.templates);+ return @backingInt(current()) >= @backingInt(Mode.templates);}pub fn allowsExamples() bool {diff --git a/src/mcp_apps.zig b/src/mcp_apps.zigindex 4d99dc46..2e4407f0 100644--- a/src/mcp_apps.zig+++ b/src/mcp_apps.zig@@ -74,12 +74,12 @@ pub fn snapshot(io: Io, a: Allocator, home: []const u8, server: *rpc.Server, uriconst html = try std.mem.concat(a, u8, &.{ template[0..split], encoded, template[split + marker.len ..] });const dir = try std.fmt.allocPrint(a, "{s}/.graff/mcp-apps", .{home});try Io.Dir.cwd().createDirPath(io, dir);- try Io.Dir.cwd().setFilePermissions(io, dir, @enumFromInt(0o700), .{});+ try Io.Dir.cwd().setFilePermissions(io, dir, @fromBackingInt(@intCast(0o700)), .{});var random: [16]u8 = undefined;io.random(&random);const id = std.fmt.bytesToHex(random, .lower);const path = try std.fmt.allocPrint(a, "{s}/{s}.html", .{ dir, id });- try @import("credential_store.zig").replaceFile(io, Io.Dir.cwd(), path, html, @enumFromInt(0o600));+ try @import("credential_store.zig").replaceFile(io, Io.Dir.cwd(), path, html, @fromBackingInt(@intCast(0o600)));return path;}diff --git a/src/mcp_catalog.zig b/src/mcp_catalog.zigindex 8034b32f..528ff2d7 100644--- a/src/mcp_catalog.zig+++ b/src/mcp_catalog.zig@@ -219,7 +219,7 @@ fn fetchJson(io: Io, gpa: Allocator, arena: Allocator, url: []const u8) !Value {.response_writer = &body.writer,.extra_headers = &headers,});- if (@intFromEnum(res.status) < 200 or @intFromEnum(res.status) >= 300) return error.HttpFailure;+ if (@backingInt(res.status) < 200 or @backingInt(res.status) >= 300) return error.HttpFailure;return std.json.parseFromSliceLeaky(Value, arena, body.writer.buffered(), .{ .allocate = .alloc_always });}diff --git a/src/mcp_http.zig b/src/mcp_http.zigindex 5bc679c6..28c442e1 100644--- a/src/mcp_http.zig+++ b/src/mcp_http.zig@@ -196,7 +196,7 @@ fn httpPostUnwatched(http: *HttpTransport, body: []const u8, meta: RequestMeta,try req.connection.?.flush();var response = try req.receiveHead(&.{});- const status = @intFromEnum(response.head.status);+ const status = @backingInt(response.head.status);if (status == 401 or status == 403) {if (req.connection) |connection| connection.closing = true;return error.McpAuthenticationRequired;@@ -261,7 +261,7 @@ fn resumeStream(http: *HttpTransport, meta: RequestMeta, id: i64) !?[]u8 {}try req.sendBodiless();var response = try req.receiveHead(&.{});- const status = @intFromEnum(response.head.status);+ const status = @backingInt(response.head.status);if (status < 200 or status >= 300) {if (req.connection) |connection| connection.closing = true;return null;@@ -395,7 +395,7 @@ fn probeUnwatched(http: *HttpTransport, body: []const u8, meta: RequestMeta) !Prtry req.connection.?.flush();var response = try req.receiveHead(&.{});- const status = @intFromEnum(response.head.status);+ const status = @backingInt(response.head.status);// Auth failures aren't a version signal either way — surface them exactly// like `post` does so the existing OAuth flow still triggers.if (status == 401 or status == 403) {diff --git a/src/mcp_oauth.zig b/src/mcp_oauth.zigindex 75d6e68d..c9ccf85f 100644--- a/src/mcp_oauth.zig+++ b/src/mcp_oauth.zig@@ -101,7 +101,7 @@ fn fetchJson(io: Io, gpa: Allocator, arena: Allocator, url: []const u8) !std.jso.redirect_behavior = .not_allowed,.extra_headers = &headers,});- if (@intFromEnum(res.status) < 200 or @intFromEnum(res.status) >= 300) return error.OAuthHttpFailure;+ if (@backingInt(res.status) < 200 or @backingInt(res.status) >= 300) return error.OAuthHttpFailure;return jsonObject(writer.buffered(), arena);}@@ -121,7 +121,7 @@ fn postJson(io: Io, gpa: Allocator, arena: Allocator, url: []const u8, payload:.headers = .{ .content_type = .{ .override = "application/json" } },.extra_headers = &headers,});- if (@intFromEnum(res.status) < 200 or @intFromEnum(res.status) >= 300) return error.OAuthHttpFailure;+ if (@backingInt(res.status) < 200 or @backingInt(res.status) >= 300) return error.OAuthHttpFailure;return jsonObject(writer.buffered(), arena);}@@ -141,7 +141,7 @@ fn postForm(io: Io, gpa: Allocator, arena: Allocator, url: []const u8, payload:.headers = .{ .content_type = .{ .override = "application/x-www-form-urlencoded" } },.extra_headers = &headers,});- if (@intFromEnum(res.status) < 200 or @intFromEnum(res.status) >= 300) return error.OAuthHttpFailure;+ if (@backingInt(res.status) < 200 or @backingInt(res.status) >= 300) return error.OAuthHttpFailure;return jsonObject(writer.buffered(), arena);}@@ -370,7 +370,7 @@ fn writeCredentials(io: Io, arena: Allocator, home: []const u8, resource_url: []var aw: Io.Writer.Allocating = .init(arena);var stringify: std.json.Stringify = .{ .writer = &aw.writer };try stringify.write(Value{ .object = obj });- const user_only: Io.Dir.Permissions = @enumFromInt(0o600);+ const user_only: Io.Dir.Permissions = @fromBackingInt(@intCast(0o600));// Atomic: this file is the only copy of the client_secret + refresh token,// so a truncate-in-place that dies mid-write logs the user out of the MCP// server with nothing left to recover from.diff --git a/src/models_cache.zig b/src/models_cache.zigindex 14cc864e..f2f3f26d 100644--- a/src/models_cache.zig+++ b/src/models_cache.zig@@ -245,7 +245,7 @@ fn fetchCodexSnapshot(io: Io, gpa: Allocator, arena: Allocator, token: []const u.response_writer = &aw.writer,.extra_headers = &headers,}) catch return null;- if (@intFromEnum(res.status) != 200) return null;+ if (@backingInt(res.status) != 200) return null;return parseCodexSnapshot(arena, aw.writer.buffered());}@@ -348,7 +348,7 @@ fn fetchModelsDev(io: Io, gpa: Allocator, arena: Allocator) ?Value {.response_writer = &aw.writer,.extra_headers = &extra,}) catch return null;- if (@intFromEnum(res.status) != 200) return null;+ if (@backingInt(res.status) != 200) return null;const v = std.json.parseFromSliceLeaky(Value, arena, aw.writer.buffered(), .{ .allocate = .alloc_always }) catch return null;if (v != .object) return null;return v;diff --git a/src/oauth_chatgpt_jwt.zig b/src/oauth_chatgpt_jwt.zigindex cf21aab2..263c7859 100644--- a/src/oauth_chatgpt_jwt.zig+++ b/src/oauth_chatgpt_jwt.zig@@ -57,7 +57,7 @@ pub fn verifyWithKey(arena: Allocator, token: []const u8, n_b64: []const u8, e_bswitch (n.len) {inline 256, 384, 512 => |len| {if (sig.len != len) return error.BadSignature;- rsa.PKCS1v1_5Signature.verify(len, sig[0..len].*, token[0..dot2], key, Sha256) catch return error.BadSignature;+ rsa.PKCS1v1_5Signature.verify(len, sig[0..len], token[0..dot2], key, Sha256) catch return error.BadSignature;},else => return error.UnknownSigningKey,}diff --git a/src/orchestration_policy_tests.zig b/src/orchestration_policy_tests.zigindex 6a7d0cfd..39ca81bb 100644--- a/src/orchestration_policy_tests.zig+++ b/src/orchestration_policy_tests.zig@@ -294,7 +294,7 @@ test "rows: the pending stratum survives the arena the decision was made in" {test "rows: a model-authored stratum cannot turn a row into a megabyte" {rows.clearPending();defer rows.clearPending();- // Built with @splat: Zig 0.17.0-dev (what CI pins) rejects the `"m" ** N`+ // Built with @splat: Zig Zig 0.17 (what CI pins) rejects the `"m" ** N`// repeat form, and @splat over an array compiles on both compilers.const huge: [4096]u8 = @splat('m');rows.setPending(.{ .task_class = .other, .budget_band = .b15, .stratum = &huge }, .R0, .bootstrap, 0);diff --git a/src/pricing_db.zig b/src/pricing_db.zigindex d6f2cd9a..de9991b7 100644--- a/src/pricing_db.zig+++ b/src/pricing_db.zig@@ -443,7 +443,7 @@ fn fetch(io: Io, gpa: Allocator, arena: Allocator) ?[]const u8 {.response_writer = &aw.writer,.extra_headers = &extra,}) catch return null;- if (@intFromEnum(res.status) != 200) return null;+ if (@backingInt(res.status) != 200) return null;const body = aw.writer.buffered();return if (body.len == 0 or body.len > max_bytes) null else body;}diff --git a/src/proc_identity.zig b/src/proc_identity.zigindex f8c158c8..e275fc23 100644--- a/src/proc_identity.zig+++ b/src/proc_identity.zig@@ -135,7 +135,7 @@ pub fn probe(io: Io, pid: i32) Probe {fn probePidOnly(io: Io, pid: i32) Probe {_ = io;if (builtin.os.tag == .windows) return .unknown;- std.posix.kill(@intCast(pid), @enumFromInt(0)) catch |err| switch (err) {+ std.posix.kill(@intCast(pid), @fromBackingInt(@intCast(0))) catch |err| switch (err) {error.ProcessNotFound => return .gone,// PermissionDenied means alive and owned by someone else.else => return .unknown,diff --git a/src/remote_client.zig b/src/remote_client.zigindex 095d373d..c8c188ff 100644--- a/src/remote_client.zig+++ b/src/remote_client.zig@@ -48,7 +48,7 @@ const Client = struct {.user_agent = .{ .override = "simple-harness/" ++ harness_version },},});- return .{ .code = @intFromEnum(res.status), .body = aw.writer.buffered() };+ return .{ .code = @backingInt(res.status), .body = aw.writer.buffered() };}/// Non-2xx is fatal with the gateway's message: every subcommand here isdiff --git a/src/remote_control.zig b/src/remote_control.zigindex 4f3ab8a5..d7e498c7 100644--- a/src/remote_control.zig+++ b/src/remote_control.zig@@ -268,7 +268,7 @@ fn runCommand(self: *State, arena: Allocator, cmd: Command) void {serve.serveLog(io, "remote-control: create failed ({t})", .{err});return sendResult(self, client, arena, cmd.id, null, 500, "{\"error\":\"failed to create session\"}");};- return sendResult(self, client, arena, cmd.id, null, @intFromEnum(made.status), made.body);+ return sendResult(self, client, arena, cmd.id, null, @backingInt(made.status), made.body);}const sid = cmd.session_id orelse return sendResult(self, client, arena, cmd.id, null, 400, "{\"error\":\"session_id required\"}");if (std.mem.eql(u8, cmd.kind, "close")) return spawn(self, .close, null, cmd.id, sid, "", null);diff --git a/src/remote_upload.zig b/src/remote_upload.zigindex 5737e892..71137a85 100644--- a/src/remote_upload.zig+++ b/src/remote_upload.zig@@ -50,7 +50,7 @@ pub fn post(link: Link, arena: Allocator, path: []const u8, payload: []const u8).user_agent = .{ .override = "simple-harness/" ++ harness_version },},});- return .{ .code = @intFromEnum(res.status), .body = aw.writer.buffered() };+ return .{ .code = @backingInt(res.status), .body = aw.writer.buffered() };}/// The gateway's error message out of a non-2xx body, or the raw body.diff --git a/src/session_fingerprint.zig b/src/session_fingerprint.zigindex 5c833dbd..71dfef00 100644--- a/src/session_fingerprint.zig+++ b/src/session_fingerprint.zig@@ -38,7 +38,7 @@ pub const Fingerprint = struct {/// formatted. Object fields are hashed in insertion order, which is the/// order they are serialized in.pub fn json(self: *Fingerprint, v: Value) void {- self.h.update(&[_]u8{@intFromEnum(std.meta.activeTag(v))});+ self.h.update(&[_]u8{@backingInt(std.meta.activeTag(v))});switch (v) {.null => {},.bool => |b| self.flag(b),diff --git a/src/shapes.zig b/src/shapes.zigindex 778c221f..d03452a5 100644--- a/src/shapes.zig+++ b/src/shapes.zig@@ -185,7 +185,7 @@ test "canonicalSlot: exact, first-word, and miss" {test "canonicalSlot: a word longer than the scratch buffer cannot match or overflow" {// Built with @splat rather than the `"a" ** 200` repeat operator: Zig- // 0.17.0-dev (what CI pins) rejects that form with "binary operator '*' has+ // Zig 0.17 (what CI pins) rejects that form with "binary operator '*' has// whitespace on one side, but not the other", while 0.16 accepts it. @splat// over an array is already used elsewhere in this tree and compiles on both.const long: [200]u8 = @splat('a');diff --git a/src/telemetry.zig b/src/telemetry.zigindex b425f08a..3caff885 100644--- a/src/telemetry.zig+++ b/src/telemetry.zig@@ -229,7 +229,7 @@ pub const Telemetry = struct {// asserts on exactly what will be sent: oversized proposes returned// above, so the utf8Prefix cap below can no longer truncate a genome.// The backend independently recomputes and rejects mismatches.- if (builtin.mode == .Debug and std.mem.eql(u8, signal, "propose") and admitted_text.len > 0 and prompt_sha.len > 0) {+ if (builtin.mode == .debug and std.mem.eql(u8, signal, "propose") and admitted_text.len > 0 and prompt_sha.len > 0) {const fp = scoring.promptFingerprint(admitted_text);std.debug.assert(std.mem.eql(u8, &fp, prompt_sha));}@@ -402,7 +402,7 @@ pub const Telemetry = struct {.headers = .{ .content_type = .{ .override = "application/json" } },.extra_headers = extra_headers,}) catch return false;- const status = @intFromEnum(response.status);+ const status = @backingInt(response.status);return status >= 200 and status < 300;}diff --git a/src/term.zig b/src/term.zigindex d769b28c..d66f9402 100644--- a/src/term.zig+++ b/src/term.zig@@ -222,8 +222,8 @@ pub const tty = struct {raw.lflag.ISIG = false;raw.lflag.IEXTEN = false; // so Ctrl-V (0x16) reaches us, not the tty's lnext}- raw.cc[@intFromEnum(std.posix.V.MIN)] = if (blocking) 1 else 0;- raw.cc[@intFromEnum(std.posix.V.TIME)] = 0;+ raw.cc[@backingInt(std.posix.V.MIN)] = if (blocking) 1 else 0;+ raw.cc[@backingInt(std.posix.V.TIME)] = 0;var job_control = JobControlGuard.init(.output);defer job_control.deinit();std.posix.tcsetattr(fd, .NOW, raw) catch return null;diff --git a/src/tool_balance.zig b/src/tool_balance.zigindex b0135d2a..a47f4d38 100644--- a/src/tool_balance.zig+++ b/src/tool_balance.zig@@ -40,7 +40,7 @@ pub const Class = enum {}};-const class_count = @as(usize, @intFromEnum(Class.other)) + 1; // `other` must stay LAST (std.meta.fields is deprecated in this std)+const class_count = @as(usize, @backingInt(Class.other)) + 1; // `other` must stay LAST (std.meta.fields is deprecated in this std)var g_counts: [class_count]u64 = @splat(0);var g_refused: u64 = 0;var g_errors: u64 = 0;@@ -112,7 +112,7 @@ pub fn skewClass(snap: *const Snapshot) ?Class {/// result so the model hears it, not just /tools) — null otherwise.pub fn record(gpa: Allocator, call: tools.ToolCall, is_error: bool) ?[]u8 {const class = classOf(call);- bump(&g_counts[@intFromEnum(class)]);+ bump(&g_counts[@backingInt(class)]);if (is_error) bump(&g_errors);if (!isSuite(class)) return null;var snap = snapshot();@@ -120,7 +120,7 @@ pub fn record(gpa: Allocator, call: tools.ToolCall, is_error: bool) ?[]u8 {g_last_skew.store(0, .release);return null;};- const marker: u8 = @intCast(@intFromEnum(top) + 1);+ const marker: u8 = @intCast(@backingInt(top) + 1);if (g_last_skew.swap(marker, .acq_rel) == marker) return null;return std.fmt.allocPrint(gpa, "tool balance: {d}/{d} suite calls were {s} — read (outline-first), search and batch are all available; balance them", .{ snap.get(top), snap.suiteTotal(), top.label() }) catch null;}@@ -138,7 +138,7 @@ pub const Snapshot = struct {errors: u64 = 0,pub fn get(self: *const Snapshot, class: Class) u64 {- return self.counts[@intFromEnum(class)];+ return self.counts[@backingInt(class)];}/// Every read/search the licensed suite owns: pro tools plus zigrep.diff --git a/src/tools.zig b/src/tools.zigindex 314d20a7..c2fa94bf 100644--- a/src/tools.zig+++ b/src/tools.zig@@ -447,7 +447,7 @@ pub fn rawFetch(gpa: Allocator, client: *std.http.Client, url: []const u8) ToolO}const body = w.buffered();if (status) |st| {- const code = @intFromEnum(st);+ const code = @backingInt(st);if (code < 200 or code >= 300) return .{.text = std.fmt.allocPrint(gpa, "HTTP {d} {s}", .{ code, st.phrase() orelse "" }) catch return .{ .is_error = true },.is_error = true,diff --git a/src/update_service.zig b/src/update_service.zigindex bdccde49..810dfa2d 100644--- a/src/update_service.zig+++ b/src/update_service.zig@@ -342,7 +342,7 @@ pub const HttpFetch = struct {.headers = .{ .user_agent = .{ .override = self.user_agent } },.extra_headers = &extra,}) catch return error.Offline;- if (@intFromEnum(res.status) != 200) return error.Offline;+ if (@backingInt(res.status) != 200) return error.Offline;if (aw.writer.buffered().len > self.max_bytes) return error.Malformed;return aw.toOwnedSlice() catch return error.OutOfMemory;}diff --git a/src/vault_client.zig b/src/vault_client.zigindex 03bbcb4b..04d5765c 100644--- a/src/vault_client.zig+++ b/src/vault_client.zig@@ -255,7 +255,7 @@ pub const Http = struct {// connection otherwise leaves the reader waiting for a body..keep_alive = false,});- return .{ .status = @intFromEnum(res.status), .body = aw.writer.buffered() };+ return .{ .status = @backingInt(res.status), .body = aw.writer.buffered() };}};diff --git a/src/vault_crypto.zig b/src/vault_crypto.zigindex b77fbea6..ff34495f 100644--- a/src/vault_crypto.zig+++ b/src/vault_crypto.zig@@ -54,7 +54,7 @@ pub const DeviceKeys = struct {const box_secret = raw[0..X25519.secret_length].*;const seed = raw[X25519.secret_length..].*;return .{- .box = .{ .secret_key = box_secret, .public_key = try X25519.recoverPublicKey(box_secret) },+ .box = .{ .secret_key = box_secret, .public_key = X25519.recoverPublicKey(box_secret) },.sign = try Ed25519.KeyPair.generateDeterministic(seed),};}diff --git a/src/version_status.zig b/src/version_status.zigindex 1f5128f8..463c9b87 100644--- a/src/version_status.zig+++ b/src/version_status.zig@@ -145,7 +145,7 @@ pub fn fetchLatestReleaseTag(io: Io, gpa: Allocator, arena: Allocator, running_v.headers = .{ .user_agent = .{ .override = user_agent } },.extra_headers = &extra,}) catch return null;- if (@intFromEnum(res.status) != 200 or aw.writer.buffered().len > 64 * 1024) return null;+ if (@backingInt(res.status) != 200 or aw.writer.buffered().len > 64 * 1024) return null;const parsed = std.json.parseFromSliceLeaky(Value, arena, aw.writer.buffered(), .{ .allocate = .alloc_always }) catch return null;if (parsed != .object) return null;const tag = parsed.object.get("tag_name") orelse return null;diff --git a/src/workspace_switch.zig b/src/workspace_switch.zigindex 3a9331fa..2e9de01f 100644--- a/src/workspace_switch.zig+++ b/src/workspace_switch.zig@@ -154,7 +154,7 @@ pub fn resolve(arena: Allocator, entries: []const Entry, want: []const u8, currevar hits: std.ArrayList(Entry) = .empty;for (entries) |e| {const rank = matchRank(io, e, needle) orelse continue;- if (best == null or @intFromEnum(rank) > @intFromEnum(best.?)) {+ if (best == null or @backingInt(rank) > @backingInt(best.?)) {best = rank;hits.clearRetainingCapacity();hits.append(arena, e) catch {};diff --git a/src/ws.zig b/src/ws.zigindex 54839878..265726b3 100644--- a/src/ws.zig+++ b/src/ws.zig@@ -184,7 +184,7 @@ pub const WsClient = struct {while (true) {const h = try r.takeArray(2);const fin = (h[0] & 0x80) != 0;- const op: Opcode = @enumFromInt(@as(u4, @truncate(h[0] & 0x0f)));+ const op: Opcode = @fromBackingInt(@intCast(@as(u4, @truncate(h[0] & 0x0f))));const masked = (h[1] & 0x80) != 0;var len: u64 = @as(u64, h[1] & 0x7f);if (len == 126) {@@ -266,7 +266,7 @@ pub const WsClient = struct {fn sendFrame(self: *WsClient, op: Opcode, payload: []const u8) Error!void {var hdr: [14]u8 = undefined;- hdr[0] = 0x80 | @as(u8, @intFromEnum(op)); // FIN + opcode+ hdr[0] = 0x80 | @as(u8, @backingInt(op)); // FIN + opcodevar n: usize = 2;if (payload.len < 126) {hdr[1] = 0x80 | @as(u8, @intCast(payload.len));