Lightpanda: the headless browser designed for AI and automation
telemetry: record tool calls and the MCP client name
Adrià Arrufat881b082faf2c
diff --git a/src/agent/Agent.zig b/src/agent/Agent.zigindex 9208a7d85..69b202ecc 100644--- a/src/agent/Agent.zig+++ b/src/agent/Agent.zig@@ -576,7 +576,7 @@ fn gotoStart(self: *Agent, url: [:0]const u8) bool {var object: std.json.ObjectMap = .empty;object.put(a, "url", .{ .string = url }) catch return false;const args: std.json.Value = .{ .object = object };- const result = browser_tools.call(a, self.ts.session, &self.ts.registry, "goto", args, .{}) catch |err| {+ const result = browser_tools.call(a, self.ts.session, &self.ts.registry, "goto", args, .{ .source = .user }) catch |err| {self.terminal.printError("could not open {s}: {s}", .{ url, browser_tools.errorMessage(err) });return false;};@@ -1533,7 +1533,7 @@ fn printSlashHelp(self: *Agent, arena: std.mem.Allocator, target: []const u8) vofn runCommand(self: *Agent, arena: std.mem.Allocator, tc: Command.ToolCall) browser_tools.ToolResult {// The terminal can't show an image, but the conversation can.- return browser_tools.call(arena, self.ts.session, &self.ts.registry, tc.name(), tc.args, .{ .inline_image = self.ai_client != null, .record = true, .nav_note = true }) catch |err| .{+ return browser_tools.call(arena, self.ts.session, &self.ts.registry, tc.name(), tc.args, .{ .inline_image = self.ai_client != null, .record = true, .nav_note = true, .source = .user }) catch |err| .{.text = switch (err) {error.OutOfMemory => "out of memory",error.FrameNotLoaded => "no page loaded — run /goto <url> first",@@ -2007,6 +2007,7 @@ fn toolOutcome(self: *Agent, allocator: std.mem.Allocator, tool_name: []const u8.inline_image = true,.record = self.capturing_for_save,.nav_note = true,+ .source = .llm,});selector.* = result.selector;const content = capToolOutput(allocator, tool_name, result.text);diff --git a/src/browser/tools.zig b/src/browser/tools.zigindex ead130539..1b36d0172 100644--- a/src/browser/tools.zig+++ b/src/browser/tools.zig@@ -21,6 +21,7 @@ const lp = @import("lightpanda");const zenai = @import("zenai");const NodeRegistry = @import("../NodeRegistry.zig");+const TelemetryEvent = @import("../telemetry/telemetry.zig").Event;const DOMNode = @import("webapi/Node.zig");const Selector = @import("webapi/selector/Selector.zig");@@ -896,6 +897,7 @@ pub const CallOpts = struct {record: bool = false,/// Scripts parse the text, so only model-facing callers set it.nav_note: bool = false,+ source: TelemetryEvent.Tool.Source,};// An inline screenshot is re-sent on every turn; keep it within what models@@ -910,11 +912,28 @@ pub fn call(tool_name: []const u8,arguments: ?std.json.Value,opts: CallOpts,+) ToolError!ToolResult {+ const start = lp.datetime.milliTimestamp(.awake);+ const maybe_tool = std.meta.stringToEnum(Tool, tool_name);+ const result = callInner(arena, session, registry, maybe_tool, tool_name, arguments, opts);+ const name = if (maybe_tool) |t| @tagName(t) else "?";+ session.browser.app.telemetry.recordToolResult(name, opts.source, result, start);+ return result;+}++fn callInner(+ arena: std.mem.Allocator,+ session: *lp.Session,+ registry: *NodeRegistry,+ maybe_tool: ?Tool,+ tool_name: []const u8,+ arguments: ?std.json.Value,+ opts: CallOpts,) ToolError!ToolResult {// In-band so an LLM that invented a tool name (e.g. OpenAI's internal// `multi_tool_use.parallel` wrapper) learns the name is wrong instead of// retrying it with different arguments.- const tool = std.meta.stringToEnum(Tool, tool_name) orelse return .{+ const tool = maybe_tool orelse return .{.text = try arena.print("Unknown tool: {s}", .{tool_name}),.is_error = true,};@@ -2748,9 +2767,9 @@ test "call: unknown tool name surfaces in-band" {var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);defer arena.deinit();- // Session/registry are never touched on this branch; the name check is- // the first thing `call` does.- const r = try call(arena.allocator(), undefined, undefined, "multi_tool_use.parallel", null, .{});+ // The registry is never touched on this branch; the name check is the+ // first thing `call` does.+ const r = try call(arena.allocator(), testing.test_session, undefined, "multi_tool_use.parallel", null, .{ .source = .user });try std.testing.expect(r.is_error);try std.testing.expectEqualStrings("Unknown tool: multi_tool_use.parallel", r.text);}@@ -2770,12 +2789,12 @@ test "tree and nodeDetails read the node's own frame" {const aa = testing.arena_allocator;const tree_args = try std.json.parseFromSliceLeaky(std.json.Value, aa, try aa.print("{{\"backendNodeId\":{d}}}", .{html_id}), .{});- const tree = try call(aa, page.session, ®istry, "tree", tree_args, .{});+ const tree = try call(aa, page.session, ®istry, "tree", tree_args, .{ .source = .user });try std.testing.expect(std.mem.find(u8, tree.text, "child-label") != null);try std.testing.expect(std.mem.find(u8, tree.text, "parent-") == null);const details_args = try std.json.parseFromSliceLeaky(std.json.Value, aa, try aa.print("{{\"backendNodeId\":{d}}}", .{input_id}), .{});- const details = try call(aa, page.session, ®istry, "nodeDetails", details_args, .{});+ const details = try call(aa, page.session, ®istry, "nodeDetails", details_args, .{ .source = .user });try std.testing.expect(std.mem.find(u8, details.text, "child-label") != null);}@@ -2796,12 +2815,12 @@ test "goto: a navigation stuck waiting for a connection is an error" {const args = try std.json.parseFromSliceLeaky(std.json.Value, aa,\\{"url":"http://localhost:9582/src/browser/tests/mcp_actions.html","timeout":300}, .{});- try std.testing.expectError(error.NavigationTimeout, call(aa, session, ®istry, "goto", args, .{}));+ try std.testing.expectError(error.NavigationTimeout, call(aa, session, ®istry, "goto", args, .{ .source = .user }));for (held.items) |conn| network.releaseConnection(conn);held.clearRetainingCapacity();- const r = try call(aa, session, ®istry, "goto", args, .{});+ const r = try call(aa, session, ®istry, "goto", args, .{ .source = .user });try std.testing.expectEqualStrings("Navigated. HTTP 200 OK.", r.text);}@@ -2816,7 +2835,7 @@ test "tools: goto flags an error status instead of reporting success" {const args = try std.json.parseFromSliceLeaky(std.json.Value, aa,\\{"url":"http://localhost:9582/status/429"}, .{});- const r = try call(aa, session, ®istry, "goto", args, .{ .nav_note = true });+ const r = try call(aa, session, ®istry, "goto", args, .{ .nav_note = true, .source = .user });try std.testing.expectEqualStrings("HTTP 429 Too Many Requests: this is likely an error or rate-limit page, not the requested content.\n\nNavigated. HTTP 429 Too Many Requests.", r.text);}@@ -2831,13 +2850,13 @@ test "tools: a read tool navigating by url flags an error status" {const args = try std.json.parseFromSliceLeaky(std.json.Value, aa,\\{"url":"http://localhost:9582/status/404"}, .{});- const r = try call(aa, session, ®istry, "markdown", args, .{ .nav_note = true });+ const r = try call(aa, session, ®istry, "markdown", args, .{ .nav_note = true, .source = .user });try std.testing.expect(std.mem.startsWith(u8, r.text, "HTTP 404 Not Found: this is likely an error"));const reload = try std.json.parseFromSliceLeaky(std.json.Value, aa,\\{"url":"http://localhost:9582/status/403"}, .{});- const s = try call(aa, session, ®istry, "markdown", reload, .{});+ const s = try call(aa, session, ®istry, "markdown", reload, .{ .source = .user });try std.testing.expect(std.mem.indexOf(u8, s.text, "rate-limit") == null);}@@ -2852,7 +2871,7 @@ test "tools: a bot challenge is named" {const args = try std.json.parseFromSliceLeaky(std.json.Value, aa,\\{"url":"http://localhost:9582/challenge/vercel"}, .{});- const r = try call(aa, session, ®istry, "tree", args, .{ .nav_note = true });+ const r = try call(aa, session, ®istry, "tree", args, .{ .nav_note = true, .source = .user });try std.testing.expect(std.mem.startsWith(u8, r.text, "Blocked by a vercel bot challenge (HTTP 429 Too Many Requests)"));}@@ -3185,6 +3204,6 @@ test "markdown: a same-url page whose navigation failed is navigated again" {const args = try std.json.parseFromSliceLeaky(std.json.Value, aa,\\{"url":"http://localhost:1/"}, .{});- try std.testing.expect((try call(aa, session, ®istry, "goto", args, .{})).is_error);- try std.testing.expect((try call(aa, session, ®istry, "markdown", args, .{})).is_error);+ try std.testing.expect((try call(aa, session, ®istry, "goto", args, .{ .source = .user })).is_error);+ try std.testing.expect((try call(aa, session, ®istry, "markdown", args, .{ .source = .user })).is_error);}diff --git a/src/mcp/Server.zig b/src/mcp/Server.zigindex 78ce30836..92c05d7c0 100644--- a/src/mcp/Server.zig+++ b/src/mcp/Server.zig@@ -177,6 +177,9 @@ pub fn sendResult(self: *Self, id: std.json.Value, result: anytype) !void {pub fn handleInitialize(self: *Self, req: protocol.Request) !void {const id = req.id orelse return;+ if (protocol.clientName(req.params)) |name| {+ self.app.telemetry.record(.{ .mcp_client = .{ .name = .init(name) } });+ }try self.sendResult(id, protocol.InitializeResult{.protocolVersion = @tagName(protocol.Version.negotiate(req.params)),.capabilities = .{diff --git a/src/mcp/protocol.zig b/src/mcp/protocol.zigindex 0ecd3e4af..03f81156a 100644--- a/src/mcp/protocol.zig+++ b/src/mcp/protocol.zig@@ -66,6 +66,22 @@ const InitializeParams = struct {clientInfo: Implementation,};+/// `clientInfo.name` from `initialize` params, or null when absent or malformed.+pub fn clientName(params: ?std.json.Value) ?[]const u8 {+ const obj = switch (params orelse return null) {+ .object => |o| o,+ else => return null,+ };+ const info = switch (obj.get("clientInfo") orelse return null) {+ .object => |o| o,+ else => return null,+ };+ return switch (info.get("name") orelse return null) {+ .string => |s| s,+ else => null,+ };+}+const Capabilities = struct {experimental: ?std.json.Value = null,roots: ?RootsCapability = null,@@ -279,6 +295,8 @@ test "MCP.protocol - request parsing" {try testing.expectString("2024-11-05", init_params.value.protocolVersion);try testing.expectString("test-client", init_params.value.clientInfo.name);try testing.expectString("1.0.0", init_params.value.clientInfo.version);+ try testing.expectString("test-client", clientName(req.params).?);+ try testing.expect(clientName(null) == null);}test "MCP.protocol - ping request parsing" {diff --git a/src/mcp/tools.zig b/src/mcp/tools.zigindex d118103a5..5d723d6e3 100644--- a/src/mcp/tools.zig+++ b/src/mcp/tools.zig@@ -148,12 +148,15 @@ pub fn handleCall(server: *Server, arena: std.mem.Allocator, req: protocol.Reque};if (std.meta.stringToEnum(ExtraTool, call_params.name)) |tool| {- return switch (tool) {+ const start = lp.datetime.milliTimestamp(.awake);+ const result = switch (tool) {.save => handleSave(server, arena, id, call_params.arguments),.session_new => handleSessionNew(server, arena, id, call_params.arguments),.session_list => handleSessionList(server, arena, id),.session_close => handleSessionClose(server, arena, id, call_params.arguments),};+ server.app.telemetry.recordToolResult(@tagName(tool), .mcp, result, start);+ return result;}return dispatchBrowserTool(server, arena, id, call_params.name, call_params.arguments);@@ -171,7 +174,7 @@ fn dispatchBrowserTool(};const active = server.active_session;- const result = browser_tools.call(arena, active.session, &active.registry, name, arguments, .{ .inline_image = true, .nav_note = true }) catch |err| {+ const result = browser_tools.call(arena, active.session, &active.registry, name, arguments, .{ .inline_image = true, .nav_note = true, .source = .mcp }) catch |err| {// evaluate/extract surface failures in-band so the LLM can self-correct;// other tools' operational failures are protocol-level.if (surfacesErrorInBand(tool)) {diff --git a/src/script/Runtime.zig b/src/script/Runtime.zigindex 4ddda0837..d9316fe8f 100644--- a/src/script/Runtime.zig+++ b/src/script/Runtime.zig@@ -75,6 +75,8 @@ const PendingGoto = struct {/// `run_timer` reading (ms) past which the navigation is abandoned.deadline_ms: u64,until: lp.Config.WaitUntil,+ /// `datetime.milliTimestamp(.awake)` at start, for telemetry.+ started_ms: u64,fn reset(self: *PendingGoto) void {v8.v8__Global__Reset(&self.resolver);@@ -501,13 +503,16 @@ fn invokeGoto(// startGoto is browser-side work; run it under the browser's isolate.// Settle the resolver only after the block: a `return` inside it runs// script-isolate work before the deferred exit.- const maybe_started: ?browser_tools.StartedGoto = blk: {+ const started_ms = lp.datetime.milliTimestamp(.awake);+ const maybe_started: browser_tools.ToolError!browser_tools.StartedGoto = blk: {self.session.browser.env.isolate.enter();defer self.session.browser.env.isolate.exit();- break :blk browser_tools.startGoto(arena, self.session, self.registry, args, receiver_frame_id) catch null;+ break :blk browser_tools.startGoto(arena, self.session, self.registry, args, receiver_frame_id);};- const started = maybe_started orelse+ const started = maybe_started catch |err| {+ self.app.telemetry.recordTool("goto", .script, @errorName(err), started_ms);return self.rejectResolver(context, resolver, "navigation failed");+ };var pending: PendingGoto = .{.frame_id = started.frame_id,@@ -515,6 +520,7 @@ fn invokeGoto(.receiver = undefined,.deadline_ms = @as(u64, @intCast(self.run_timer.untilNow(lp.io, .boot).toMilliseconds())) + started.timeout_ms,.until = started.until,+ .started_ms = started_ms,};v8.v8__Global__New(self.env.isolate.handle, resolver, &pending.resolver);v8.v8__Global__New(self.env.isolate.handle, this, &pending.receiver);@@ -606,16 +612,23 @@ const Outcome = enum { loaded, failed, timed_out };/// Resolve or reject one pending goto's Promise and free its Globals.fn settlePending(self: *Runtime, context: *const v8.Context, pending: *PendingGoto, outcome: Outcome) void {const resolver: *const v8.PromiseResolver = @ptrCast(v8.v8__Global__Get(&pending.resolver, self.env.isolate.handle));+ var result: [:0]const u8 = switch (outcome) {+ .loaded => "ok",+ .failed => "NavigationFailed",+ .timed_out => "NavigationTimeout",+ };switch (outcome) {.loaded => done: {const frame = self.session.findFrameByFrameId(pending.frame_id);if (frame == null or frame.?._last_navigate_error != null) {self.rejectResolver(context, resolver, "navigation failed");+ result = "NavigationFailed";break :done;}const this: *const v8.Object = @ptrCast(v8.v8__Global__Get(&pending.receiver, self.env.isolate.handle));self.bindFrameId(context, this, pending.frame_id) catch {self.rejectResolver(context, resolver, "internal: page bind failed");+ result = "InternalError";break :done;};self.resolveResolver(context, resolver, @ptrCast(this));@@ -623,6 +636,7 @@ fn settlePending(self: *Runtime, context: *const v8.Context, pending: *PendingGo.failed => self.rejectResolver(context, resolver, "navigation failed"),.timed_out => self.rejectResolver(context, resolver, "navigation timed out"),}+ self.app.telemetry.recordTool("goto", .script, result, pending.started_ms);pending.reset();}@@ -631,6 +645,7 @@ fn failAllPending(self: *Runtime, context: *const v8.Context, message: []const ufor (self.pending_gotos.items) |*pending| {const resolver: *const v8.PromiseResolver = @ptrCast(v8.v8__Global__Get(&pending.resolver, self.env.isolate.handle));self.rejectResolver(context, resolver, message);+ self.app.telemetry.recordTool("goto", .script, "Cancelled", pending.started_ms);pending.reset();}self.pending_gotos.clearRetainingCapacity();@@ -714,7 +729,7 @@ fn callTool(self.session.browser.env.isolate.enter();defer self.session.browser.env.isolate.exit();- const result = browser_tools.call(arena, self.session, self.registry, @tagName(tool), args, .{}) catch |err| switch (err) {+ const result = browser_tools.call(arena, self.session, self.registry, @tagName(tool), args, .{ .source = .script }) catch |err| switch (err) {error.OutOfMemory => return error.OutOfMemory,error.FrameNotLoaded => return .{ .fail = "no page loaded - run page.goto(url) first" },else => return .{ .fail = arena.print("{s} failed: {s}", .{ @tagName(tool), @errorName(err) }) catch return error.OutOfMemory },diff --git a/src/server/cdp/domains/lp.zig b/src/server/cdp/domains/lp.zigindex 1e01737c1..a7c160dfc 100644--- a/src/server/cdp/domains/lp.zig+++ b/src/server/cdp/domains/lp.zig@@ -51,24 +51,27 @@ pub fn processMessage(cmd: *CDP.Command) !void {version,}, cmd.input.action) orelse return error.UnknownMethod;- switch (action) {- .dump => return dump(cmd),- .getMarkdown => return getMarkdown(cmd),- .getSemanticTree => return getSemanticTree(cmd),- .getInteractiveElements => return getInteractiveElements(cmd),- .getNodeDetails => return getNodeDetails(cmd),- .getStructuredData => return getStructuredData(cmd),- .getContentSignal => return getContentSignal(cmd),- .detectForms => return detectForms(cmd),- .clickNode => return clickNode(cmd),- .fillNode => return fillNode(cmd),- .scrollNode => return scrollNode(cmd),- .waitForSelector => return waitForSelector(cmd),- .handleJavaScriptDialog => return handleJavaScriptDialog(cmd),- .configureCDP => return configureCDP(cmd),- .configureLoading => return configureLoading(cmd),- .version => return version(cmd),- }+ const start = lp.datetime.milliTimestamp(.awake);+ const result = switch (action) {+ .dump => dump(cmd),+ .getMarkdown => getMarkdown(cmd),+ .getSemanticTree => getSemanticTree(cmd),+ .getInteractiveElements => getInteractiveElements(cmd),+ .getNodeDetails => getNodeDetails(cmd),+ .getStructuredData => getStructuredData(cmd),+ .getContentSignal => getContentSignal(cmd),+ .detectForms => detectForms(cmd),+ .clickNode => clickNode(cmd),+ .fillNode => fillNode(cmd),+ .scrollNode => scrollNode(cmd),+ .waitForSelector => waitForSelector(cmd),+ .handleJavaScriptDialog => handleJavaScriptDialog(cmd),+ .configureCDP => configureCDP(cmd),+ .configureLoading => configureLoading(cmd),+ .version => version(cmd),+ };+ cmd.cdp.app.telemetry.recordToolResult(@tagName(action), .cdp, result, start);+ return result;}fn version(cmd: *CDP.Command) !void {diff --git a/src/telemetry/lightpanda.zig b/src/telemetry/lightpanda.zigindex b698b2649..efc9fa588 100644--- a/src/telemetry/lightpanda.zig+++ b/src/telemetry/lightpanda.zig@@ -312,6 +312,23 @@ const EventRow = struct {try writer.write(l.provider);try writer.write(l.model);},+ .tool => |t| {+ try writer.write("T");+ try writer.write(t.name);+ try writer.write(switch (t.source) {+ .llm => "L",+ .user => "U",+ .script => "S",+ .mcp => "M",+ .cdp => "C",+ });+ try writer.write(t.outcome);+ try writer.write(t.duration_ms);+ },+ .mcp_client => |c| {+ try writer.write("C");+ try writer.write(c.name);+ },}try writer.endArray();}@@ -363,13 +380,25 @@ test "Telemetry: event row wire format" {.expected = "[\"B\",42]",},.{- .event = .{ .llm = .{ .provider = "anthropic", .model = .wrap("claude") } },+ .event = .{ .llm = .{ .provider = "anthropic", .model = .init("claude") } },.expected = "[\"L\",\"anthropic\",\"claude\"]",},.{.event = .{ .llm = .{ .provider = "nollm", .model = null } },.expected = "[\"L\",\"nollm\",null]",},+ .{+ .event = .{ .tool = .{ .name = "click", .source = .llm, .outcome = "ok", .duration_ms = 12 } },+ .expected = "[\"T\",\"click\",\"L\",\"ok\",12]",+ },+ .{+ .event = .{ .tool = .{ .name = "goto", .source = .script, .outcome = "NavigationTimeout", .duration_ms = 0 } },+ .expected = "[\"T\",\"goto\",\"S\",\"NavigationTimeout\",0]",+ },+ .{+ .event = .{ .mcp_client = .{ .name = .init("a-very-long-mcp-client-name-over-32-bytes") } },+ .expected = "[\"C\",\"a-very-long-mcp-client-name-over\"]",+ },};for (cases) |case| {diff --git a/src/telemetry/telemetry.zig b/src/telemetry/telemetry.zigindex 53cc582fa..a4fe3ffb3 100644--- a/src/telemetry/telemetry.zig+++ b/src/telemetry/telemetry.zig@@ -59,6 +59,29 @@ fn TelemetryT(comptime P: type) type {};}+ /// `start_ms` is a `datetime.milliTimestamp(.awake)` taken before the call.+ pub fn recordTool(self: *Self, name: [:0]const u8, source: Event.Tool.Source, outcome: [:0]const u8, start_ms: u64) void {+ if (self.disabled) {+ return;+ }+ const elapsed = lp.datetime.milliTimestamp(.awake) -| start_ms;+ self.record(.{ .tool = .{+ .name = name,+ .source = source,+ .outcome = outcome,+ .duration_ms = std.math.lossyCast(u32, elapsed),+ } });+ }++ /// "ok", "is_error" for a `ToolResult` that failed in-band, or the error name.+ pub fn recordToolResult(self: *Self, name: [:0]const u8, source: Event.Tool.Source, result: anytype, start_ms: u64) void {+ const outcome: [:0]const u8 = if (result) |r| blk: {+ if (@TypeOf(r) == void) break :blk "ok";+ break :blk if (r.is_error) "is_error" else "ok";+ } else |err| @errorName(err);+ self.recordTool(name, source, outcome, start_ms);+ }+pub fn llm_init(_: *Self, provider: [:0]const u8, model: ?[]const u8) Event.LLM {return Event.LLM.init(provider, model);}@@ -106,6 +129,8 @@ pub const Event = union(enum) {navigate: Navigate,buffer_overflow: BufferOverflow,llm: LLM,+ tool: Tool,+ mcp_client: McpClient,pub const Navigate = struct {tls: bool,@@ -120,35 +145,44 @@ pub const Event = union(enum) {const LLM = struct {provider: [:0]const u8,- model: ?Model,+ model: ?InlineString,++ pub fn init(provider: [:0]const u8, _model: ?[]const u8) LLM {+ return .{+ .provider = provider,+ .model = if (_model) |m| .init(m) else null,+ };+ }+ };- const Model = struct {- len: u8,- buffer: [32]u8,+ pub const Tool = struct {+ // Only ever a @tagName or @errorName: static memory that outlives the+ // queue, and never a caller-supplied string.+ name: [:0]const u8,+ source: Source,+ outcome: [:0]const u8,+ duration_ms: u32,- pub fn wrap(_s: ?[]const u8) ?Model {- if (_s == null) return null;+ pub const Source = enum { llm, user, script, mcp, cdp };+ };- const l = @min(_s.?.len, 32);- var m: Model = .{- .len = l,- .buffer = undefined,- };- @memcpy(m.buffer[0..l], _s.?[0..l]);+ pub const McpClient = struct {+ name: InlineString,+ };- return m;- }+ pub const InlineString = struct {+ len: u8,+ buffer: [32]u8,- pub fn jsonStringify(self: *const Model, writer: anytype) !void {- try writer.write(self.buffer[0..self.len]);- }- };+ pub fn init(s: []const u8) InlineString {+ const l = @min(s.len, 32);+ var m: InlineString = .{ .len = l, .buffer = undefined };+ @memcpy(m.buffer[0..l], s[0..l]);+ return m;+ }- pub fn init(provider: [:0]const u8, _model: ?[]const u8) LLM {- return .{- .provider = provider,- .model = Model.wrap(_model),- };+ pub fn jsonStringify(self: *const InlineString, writer: anytype) !void {+ try writer.write(self.buffer[0..self.len]);}};};