mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
mcp: improve event loop and response handling
- Use an allocating writer in `sendResponse` to handle large payloads. - Update the main loop to tick the HTTP client and cap poll timeouts. - Update protocol version and minify tool input schemas.
This commit is contained in:
@@ -12,7 +12,7 @@ app: *App,
|
||||
|
||||
http_client: *HttpClient,
|
||||
notification: *lp.Notification,
|
||||
browser: lp.Browser,
|
||||
browser: *lp.Browser,
|
||||
session: *lp.Session,
|
||||
page: *lp.Page,
|
||||
|
||||
@@ -53,12 +53,12 @@ pub fn deinit(self: *Self) void {
|
||||
self.allocator.destroy(self);
|
||||
}
|
||||
|
||||
pub fn sendResponse(_: *Self, response: anytype) !void {
|
||||
var buffer: [8192]u8 = undefined;
|
||||
var stdout = std.fs.File.stdout().writer(&buffer);
|
||||
try std.json.Stringify.value(response, .{ .emit_null_optional_fields = false }, &stdout.interface);
|
||||
try stdout.interface.writeByte('\n');
|
||||
try stdout.interface.flush();
|
||||
pub fn sendResponse(self: *Self, response: anytype) !void {
|
||||
var aw: std.Io.Writer.Allocating = .init(self.allocator);
|
||||
defer aw.deinit();
|
||||
try std.json.Stringify.value(response, .{ .emit_null_optional_fields = false }, &aw.writer);
|
||||
try aw.writer.writeByte('\n');
|
||||
try std.fs.File.stdout().writeAll(aw.written());
|
||||
}
|
||||
|
||||
pub fn sendResult(self: *Self, id: std.json.Value, result: anytype) !void {
|
||||
|
||||
Reference in New Issue
Block a user