Skip to content

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

Python

Merge release updates with pending source changes

justrach4e08fe15f9a1
diff --cc src/pricing.zig
index 43b81d54,af8c4b67..70ddc0aa
--- a/src/pricing.zig
+++ b/src/pricing.zig
@@@ -293,9 -287,10 +293,13 @@@ pub const model_table = [_]ModelInfo
.{ .provider = "kimi", .name = "kimi-for-coding", .context = 262_144, .protocol = .kimi, .supports_reasoning = true },
.{ .provider = "kimi", .name = "kimi-for-coding-highspeed", .context = 262_144, .protocol = .kimi, .supports_reasoning = true },
.{ .provider = "moonshot", .name = "kimi-latest", .context = 131_072 },
- .{ .provider = "moonshot", .name = "kimi-k3", .context = 1_048_576, .supports_reasoning = true, .support_efforts = &.{ "low", "high", "max" }, .default_effort = "high" },
++
+ .{ .provider = "moonshot", .name = "kimi-k2.7-code", .context = 262_144, .supports_reasoning = true },
+ .{ .provider = "moonshot", .name = "kimi-k2.6", .context = 262_144, .supports_reasoning = true },
+ // Moonshot platform K3 (api.moonshot.ai, model id `kimi-k3`). Distinct from
+ // Kimi Code's native `k3` row: `--model kimi-k3` with only MOONSHOT_API_KEY
+ // must not rewrite onto the coding-plan login.
+ .{ .provider = "moonshot", .name = "kimi-k3", .context = 1_048_576, .supports_reasoning = true, .support_efforts = &.{ "low", "high", "max" }, .default_effort = "max" },
.{ .provider = "xai", .name = "grok-4.6", .context = 500_000, .supports_reasoning = true },
.{ .provider = "xai", .name = "grok-4.3", .context = 1_000_000 },
.{ .provider = "xai", .name = "grok-build", .context = 256_000 },
@@@ -499,18 -494,16 +503,24 @@@ pub fn familyAliasEquals(provider_id: [
/// `keys` is main.zig's Keys (anytype to keep provider wiring out of this
/// module) — anything with `get(provider_id) ?[]const u8`.
pub fn resolveModelName(keys: anytype, query: []const u8) ?[]const u8 {
+ // `<provider>/<model>` pins the provider (startup's explicitProvider splits
+ // on '/'), so resolve the remainder against that provider's own rows first.
+ // openrouter-style slugs keep working: "openrouter/anthropic/claude-x"
+ // strips only the leading provider id.
+ if (std.mem.indexOfScalar(u8, query, '/')) |slash| {
+ const rest = query[slash + 1 ..];
+ if (rest.len > 0 and providerModelInTable(query[0..slash], rest)) return rest;
+ }
+ // #377: `kimi-k3` is Kimi Code's family spelling of `k3`. Moonshot's
+ // platform id is also `kimi-k3`. A keyed kimi login keeps the rewrite; a
+ // moonshot-only key keeps the Moonshot row (exact match below).
+ const kimi_keyed = keys.get("kimi") != null;
+ const moonshot_keyed = keys.get("moonshot") != null;
+ if (kimi_keyed or !moonshot_keyed) {
+ if (familyAliasEquals("kimi", "k3", query)) return "k3";
+ }
for (models()) |m| if (std.mem.eql(u8, m.name, query)) return m.name;
for (models()) |m| if (modelAliasEquals(m.name, query)) return m.name;
- // #377: family-prefixed spelling of a provider's own row (`kimi-k3` → kimi's
- // `k3`) — resolves even when no gateway catalog supplies the prefixed name.
for (models()) |m| if (familyAliasEquals(m.provider, m.name, query)) return m.name;
var qbuf: [128]u8 = undefined;
const qnorm = normalizeModelAlias(&qbuf, query);
diff --cc src/pricing_tests.zig
index f2358b9f,6b159c8e..eac53cb9
--- a/src/pricing_tests.zig
+++ b/src/pricing_tests.zig
@@@ -44,11 -44,8 +44,6 @@@ test "resolveModelName exact aliases an
test "resolveModelName (#377): family-prefixed spelling resolves to the provider's native row" {
const keys = provider_mod.Keys{ .values = @splat(null) };
- try std.testing.expectEqualStrings("kimi-k3", pricing.resolveModelName(keys, "kimi-k3").?);
- const saved = pricing.active_model_table;
- defer pricing.active_model_table = saved;
- // Exercise the family alias without an exact-name catalog entry.
- pricing.active_model_table = &.{.{ .provider = "kimi", .name = "k3", .context = 1_048_576 }};
- // Works from the COMPILED table alone — no gateway catalog cache needed,
- // so a fresh machine with only a kimi login can type `--model kimi-k3`.
try std.testing.expectEqualStrings("k3", pricing.resolveModelName(keys, "kimi-k3").?);
try std.testing.expect(pricing.familyAliasEquals("kimi", "k3", "kimi-k3"));
try std.testing.expect(pricing.familyAliasEquals("kimi", "k3", "kimi_k3"));