mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 17:46:32 -04:00
script: optimize hint allocation and inline helper
Calculate the exact size needed for hint slots in schema.zig to avoid overallocating. Also inline the single-use helper isDefaultTrueBool in command.zig.
This commit is contained in:
@@ -284,16 +284,12 @@ fn formatToolCall(tc: Command.ToolCall, writer: *std.Io.Writer) std.Io.Writer.Er
|
||||
}
|
||||
}
|
||||
|
||||
fn isDefaultTrueBool(s: *const schema.SchemaInfo, key: []const u8, v: std.json.Value) bool {
|
||||
return v == .bool and v.bool and s.isFieldDefaultTrue(key);
|
||||
}
|
||||
|
||||
/// Args that the recorder must NOT emit:
|
||||
/// - `backendNodeId`: ephemeral identifier, never replayable.
|
||||
/// - boolean fields whose value equals the schema default (cosmetic).
|
||||
fn skipForFormat(s: *const schema.SchemaInfo, key: []const u8, v: std.json.Value) bool {
|
||||
if (std.mem.eql(u8, key, "backendNodeId")) return true;
|
||||
return isDefaultTrueBool(s, key, v);
|
||||
return v == .bool and v.bool and s.isFieldDefaultTrue(key);
|
||||
}
|
||||
|
||||
fn formatString(writer: *std.Io.Writer, s: []const u8) std.Io.Writer.Error!void {
|
||||
|
||||
Reference in New Issue
Block a user