xonecas.io
79113
Ma

mini-coding-agent / commit bce96fa

feat: send the correct user agent instead of zigs

xonecas2026-10-04 bce96fa6f4f6380140b86f324f5d143c9873eaac parent 319801e

4 files changed

AGENTS.md+2−7
@@ -30,11 +30,6 @@ templates to copy:
3030 for the low-level work: the four wire protocols, streaming reassembly, diff
3131 capture, UTF-8 and base64 handling, session durability. Consult its structure
3232 and its comments when porting those layers.
33-- `../zig-agent-kanso/` — an experimental one-shot Zig port. The idiom reference
34- for current Zig: the allocator wiring, `std.http.Client` for SSE streaming,
35- the tree-sitter module integration, `build.zig.zon` dependency pinning. It is
36- a starting point for language technique, not for correctness or completeness —
37- it has known gaps in the provider layer and it swallows errors.
3833
3934 ## Direction
4035
@@ -119,8 +114,8 @@ largest fragility. Do not reintroduce it.
119114
120115 ## Verification
121116
122-Verify against the real provider. Do not stand up mock servers, fixture
123-endpoints, or replay files; they stall and prove nothing. Use the
117+Verify against the real provider. **Do not stand up mock servers, fixture
118+endpoints, or replay files**; they stall and prove nothing. Use the
124119 `OPENCODE_API_KEY` environment variable and a scratch `XDG_CONFIG_HOME` with a
125120 `mini-coding-agent/config.json` that declares the provider under test.
126121
ISSUES.md+3−1
@@ -1,6 +1,6 @@
11 # Issues from QA/Live use
22
3-- Pause doesn't work, agent keeps working through the pause, with the UI saying "paused - ...".
3+- ~~No user-agent is sent, this is explicit against Opencode Go and many other providers rules. Start sending `mini-coding-agent/VERSION`~~
44 - Audit statusline states, I never see "waiting for provider". Seems that we don't have that much granularity
55 - `authFile` in config is a fragment of mini-coder's functionality that we don't have, why was it ported without thinking?
66 - Agents use markdown tables in their replies, and usually with terrible whitespace, can we format them for readability?
@@ -16,3 +16,5 @@
1616 - Read tool bodies aren't useful. Instead we should show a single line body, with the read tool call arguments and the count of lines read.
1717 Users can already see the full path in the tool header. If it's an image we show the path twice, thats is not needed, let's just show the
1818 image metadata in the single line body to match the new behaviour suggested here.
19+- Add to the banner a second line, that shows the count of AGENTS.md files loaded and the SKILL.md files loaded.
20+- When we start a new session, print a blank line, the banner, and then the "new session" label but dimmed.
build.zig+5−0
@@ -1,4 +1,5 @@
11 const std = @import("std");
2+const zon = @import("build.zig.zon");
23
34 pub fn build(b: *std.Build) void {
45 const target = b.standardTargetOptions(.{});
@@ -14,6 +15,10 @@ pub fn build(b: *std.Build) void {
1415 });
1516 b.installArtifact(exe);
1617
18+ const options = b.addOptions();
19+ options.addOption([]const u8, "version", zon.version);
20+ exe.root_module.addOptions("build_options", options);
21+
1722 const tree_sitter = b.dependency("tree_sitter", .{ .target = target, .optimize = optimize });
1823 exe.root_module.addImport("tree-sitter", tree_sitter.module("tree_sitter"));
1924
src/http.zig+5−0
@@ -2,6 +2,10 @@
22
33 const std = @import("std");
44 const platform = @import("platform.zig");
5+const build_options = @import("build_options");
6+
7+/// Providers require a product user-agent; the client default is the std one.
8+pub const user_agent = "mini-coding-agent/" ++ build_options.version;
59
610 pub const Header = struct { name: []const u8, value: []const u8 };
711
@@ -46,6 +50,7 @@ pub fn postSse(
4650 var req = client.request(.POST, uri, .{
4751 .redirect_behavior = .unhandled,
4852 .extra_headers = hdrs.items,
53+ .headers = .{ .user_agent = .{ .override = user_agent } },
4954 }) catch return error.RequestFailed;
5055 defer req.deinit();