Lightpanda: the headless browser designed for AI and automation
mcp: 0 disables --http-session-timeout, as for serve
Adrià Arrufatc86aeb8e76b0
diff --git a/src/Config.zig b/src/Config.zigindex 630aa5a27..8c0f2b9ee 100644--- a/src/Config.zig+++ b/src/Config.zig@@ -462,7 +462,7 @@ pub const Commands = cli.Builder(.{.{ .name = "port", .type = ?u16 },.{ .name = "host", .type = []const u8, .default = "127.0.0.1" },.{ .name = "cdp_port", .type = ?u16 },- .{ .name = "http_session_timeout", .type = ?u32 },+ .{ .name = "http_session_timeout", .type = u32, .default = 0 },},.shared_options = CommonOptions,},@@ -964,8 +964,7 @@ pub fn maxConnections(self: *const Config) u16 {// Null disables the reaper: sessions then only end on DELETE.pub fn httpSessionTimeout(self: *const Config) ?u64 {return switch (self.mode) {- .serve => |opts| if (opts.http_session_timeout == 0) null else @as(u64, opts.http_session_timeout) * 1000,- .mcp => |opts| if (opts.http_session_timeout) |seconds| @as(u64, seconds) * 1000 else null,+ inline .serve, .mcp => |opts| if (opts.http_session_timeout == 0) null else @as(u64, opts.http_session_timeout) * 1000,else => unreachable,};}@@ -1442,6 +1441,12 @@ test "Config: parseArgs --http-session-timeout" {const config = try parseArgs(arena.allocator(), proc_args);try std.testing.expectEqual(600_000, config.httpSessionTimeout());}+ {+ const argv = [_][*:0]const u8{ "lightpanda", "mcp", "--http-session-timeout", "0" };+ const proc_args: std.process.Args = .{ .vector = &argv };+ const config = try parseArgs(arena.allocator(), proc_args);+ try std.testing.expectEqual(null, config.httpSessionTimeout());+ }}test "Config: parseArgs --dump tells a url from a misspelt format" {diff --git a/src/help.zon b/src/help.zonindex befba30eb..d3b48fbd2 100644--- a/src/help.zon+++ b/src/help.zon@@ -203,7 +203,7 @@\\ Seconds before an idle HTTP session (--port) is closed. A later\\ request with its Mcp-Session-Id gets 404, so the client starts\\ a new session. The default session is never closed.- \\ Defaults to no timeout (sessions live until closed).+ \\ Defaults to 0, which disables it (sessions live until closed).\\ --port <INT>\\ Serve MCP over HTTP on this port instead of stdio. Clients POST\\ JSON-RPC to /mcp; route requests to a session with the