Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Fix idle-line wake types and stay at the 600-line ceiling after zig fmt

justrachcc40b6ec9628
diff --git a/src/agent.zig b/src/agent.zig
index 9d57487a..3a0b51f7 100644
--- a/src/agent.zig
+++ b/src/agent.zig
@@ -10,7 +10,6 @@ const main_mod = @import("main.zig");
const provider_mod = @import("provider.zig");
const Provider = provider_mod.Provider;
const ReasoningEffort = main_mod.ReasoningEffort;
-
const ws = @import("ws.zig"); // codex Responses WS transport (delta continuation held across a turn)
const mcp = @import("mcp.zig");
const approvals_mod = @import("approvals.zig");
@@ -354,7 +353,9 @@ pub const Agent = struct {
// turn — durable in history, visible as an event. Offset-based:
// an empty channel costs one small stat per step.
peer_channel.deliverInbound(self);
- try @import("subagent_feedback.zig").deliverToAgent(self); job_notify.deliver(self); schedule.deliver(self);
+ try @import("subagent_feedback.zig").deliverToAgent(self);
+ job_notify.deliver(self);
+ schedule.deliver(self);
channel_worker.deliver(self);
// #193: pre-send overflow gate. A single turn's tool-output burst can
// push the input past the model's wall before the between-turns 80%
@@ -398,7 +399,10 @@ pub const Agent = struct {
// Retry empty replies; reconcile plain finals with live work (#745).
if (try bounced_answer.retry(self, final_text, hist_len)) continue;
if (try @import("named_work.zig").handle(self, final_text)) continue;
- if (try pending_work.finish(self, bounced_answer.finish(self, final_text))) |text| if (self.feedback == null or self.feedback.?.tryFinish(self.io)) return review_deadline.finish(text) else continue;
+ if (try pending_work.finish(self, bounced_answer.finish(self, final_text))) |text| {
+ if (self.feedback) |inbox| if (!inbox.tryFinish(self.io)) continue;
+ return review_deadline.finish(text);
+ }
continue;
}
self.empty_completion_retries = 0;
@@ -582,10 +586,6 @@ pub const Agent = struct {
pub const mdWidth = @import("agent_render.zig").mdWidth;
pub const mdSpanEnd = @import("agent_render.zig").mdSpanEnd;
pub const mdFinishLine = @import("agent_render.zig").mdFinishLine;
- // Streamed-markdown table rendering (buffered rows -> aligned columns,
- // word-wrapped to termCols()) lives in agent_table.zig (#123, 600-line
- // goal). Member-aliased so `self.flushTable(...)`/`Agent.isTableSeparator(...)`
- // resolve unchanged regardless of physical file.
pub const flushTable = @import("agent_table.zig").flushTable;
pub const fitWidths = @import("agent_table.zig").fitWidths;
pub const atomEnd = @import("agent_table.zig").atomEnd;
diff --git a/src/subagent_interactive.zig b/src/subagent_interactive.zig
index d65e364a..c724b52a 100644
--- a/src/subagent_interactive.zig
+++ b/src/subagent_interactive.zig
@@ -9,7 +9,7 @@ var requested = std.atomic.Value(bool).init(false);
pub var line_notice = false; // legacy line REPL provenance
pub var yielded = false; // root thread only
-pub fn stealIdleLine(io: std.Io, owner: []const u8, gpa: std.mem.Allocator, buf: *std.ArrayList(u8), idle: bool) !?[]u8 {
+pub fn stealIdleLine(io: std.Io, owner: []const u8, gpa: std.mem.Allocator, buf: anytype, idle: bool) !?[]u8 {
if (!idle or !enabled.load(.acquire) or buf.items.len != 0) return null;
var notice: [512]u8 = undefined;
const text = takeWake(io, owner, &notice) orelse return null;
diff --git a/src/tui_launch.zig b/src/tui_launch.zig
index ca3a4ab6..c75cc2fe 100644
--- a/src/tui_launch.zig
+++ b/src/tui_launch.zig
@@ -4,7 +4,6 @@
const std = @import("std");
const Io = std.Io;
const Allocator = std.mem.Allocator;
-
const args = @import("args.zig");
const agent_mod = @import("agent.zig");
const provider_mod = @import("provider.zig");
@@ -83,7 +82,8 @@ pub fn run(
cwd: []const u8,
yolo: bool,
) !void {
- @import("subagent_interactive.zig").configure(true); defer @import("subagent_interactive.zig").configure(false);
+ @import("subagent_interactive.zig").configure(true);
+ defer @import("subagent_interactive.zig").configure(false);
root.ensureStoredKeys(keys);
providers.ensureModelQueryCatalogs(root, keys.*, "");
try root.ensureRootTools(.anthropic);