From 26cf182b38763201ca310b8084da398dec8b07af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Arrufat?= Date: Sat, 30 May 2026 22:16:18 +0200 Subject: [PATCH] agent: load external stylesheets by default with LLM Enables `load_external_stylesheets` when an LLM client is active, as LLM drivers reason about visibility and computed styles. Updates the help documentation to reflect this change. --- src/agent/Agent.zig | 8 ++++++++ src/help.zon | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/agent/Agent.zig b/src/agent/Agent.zig index a9205bdb..4d7405b1 100644 --- a/src/agent/Agent.zig +++ b/src/agent/Agent.zig @@ -277,6 +277,14 @@ pub fn init(allocator: std.mem.Allocator, app: *App, opts: Config.Agent) !*Agent self.ai_client = if (llm) |l| try initAiClient(allocator, l, opts.base_url) else null; errdefer if (self.ai_client) |c| deinitAiClient(allocator, c); + // An LLM driver reasons about visibility/computed styles, so fetch external + // stylesheets by default. Pure replay and --no-llm keep the cheap fast path. + // The --enable-external-stylesheets flag is already folded into the session + // default, so this only ever turns the feature on. + if (self.ai_client != null) { + self.session.load_external_stylesheets = true; + } + if (will_repl) { self.terminal.attachCompleter(); self.terminal.completion_source = .{ diff --git a/src/help.zon b/src/help.zon index dd620050..44a1bd10 100644 --- a/src/help.zon +++ b/src/help.zon @@ -255,7 +255,7 @@ \\ Fetch external resources so their rules \\ contribute to computed styles (and therefore to visibility checks like \\ display, visibility, opacity, pointer-events). - \\ Defaults to false. + \\ Defaults to false, except in agent mode with an LLM, where it is on. \\ --block-private-networks \\ Block HTTP requests to private/internal IP addresses after DNS \\ resolution.