Skip to content

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

Python

Merge branch 'feat/ws-steer-protocol' into feat/chat-gpt-new

justrach766bf8d5923c
diff --cc src/agent_ws_steer.zig
index b0c4af41,110b33ab..6224074f
--- a/src/agent_ws_steer.zig
+++ b/src/agent_ws_steer.zig
@@@ -20,14 -43,36 +43,39 @@@ pub fn modelSupports(model: []const u8
return std.mem.startsWith(u8, model, "gpt-6");
}
+ /// Set by a `steering_not_supported` failure: the rest of the session
+ /// supersedes the reply instead (steer_now), as for models without steering.
+ pub var g_unsupported = false;
+
+ /// GPT-6 on the routes that implement steering (Platform OpenAI and Codex).
+ /// Other sockets serving GPT-6 names supersede the reply instead.
+ pub fn active(provider_id: []const u8, model: []const u8) bool {
+ if (g_unsupported or !modelSupports(model)) return false;
+ return std.mem.eql(u8, provider_id, "codex") or std.mem.eql(u8, provider_id, "openai");
+ }
+
+ /// The root's own turn request on a steering route: the requests a typed
+ /// follow-up can steer (not a compaction, title or child call).
+ pub fn rootTurnOnSteeringRoute(self: anytype) bool {
+ if (self.sub or self.call_kind != .root or self.compaction_request or self.server_compaction_request) return false;
+ return active(self.provider.id, self.provider.model);
+ }
+
+ /// This request steers: a root turn on a steering route whose body carries no
+ /// server-compaction directive (the two exclude each other; see
+ /// agent_server_compact.directive). Any other request supersedes the reply.
+ pub fn steers(self: anytype) bool {
+ return rootTurnOnSteeringRoute(self) and @import("agent_server_compact.zig").directive(self) == null;
+ }
+
/// Who actually serves a Responses WebSocket. Platform OpenAI only for GPT-6
/// (mid-turn `response.steer`); GPT-5.6 stays HTTP SSE. Codex/xAI/gateway
-/// keep their existing sockets. 426 still latches SSE.
+/// keep their existing sockets. The ChatGPT plan route (ADR 0221) serves one
+/// for every model it lists; its HTTP path refuses previous_response_id, so
+/// the socket is what chains. 426 still latches SSE.
pub fn providerHasWs(id: []const u8, model: []const u8) bool {
if (std.mem.eql(u8, id, "codex") or std.mem.eql(u8, id, "xai") or std.mem.eql(u8, id, "codegraff")) return true;
+ if (std.mem.eql(u8, id, "chatgpt-new")) return true;
return std.mem.eql(u8, id, "openai") and modelSupports(model);
}