agent: fold the browser quartet onto lp.ToolSession

Agent held the same Browser/Session/Notification/registry fields and
teardown order as mcp/Server.zig, plus its own "enableConsoleCapture
after every newSession" for /reset. ToolSession.restartSession() owns
that now; init is written in terms of it.

Claude-Session: https://claude.ai/code/session_01M6WGk8wZSE28efFQkYT9SK
This commit is contained in:
Adrià Arrufat committed 2026-08-27 16:40:53 +02:00
1 parent dadbae121c
commit 0865f4e337
2 files changed
+29 -38

No files matched your search

+6
View File
@@ -46,6 +46,12 @@ pub fn init(self: *ToolSession, app: *App) !void {
try self.browser.init(app, .{}, null);
errdefer self.browser.deinit();
try self.restartSession();
}
/// Replace the session with a fresh one on the same browser: page, cookies,
/// storage and history gone. The old `session` pointer is invalid afterwards.
pub fn restartSession(self: *ToolSession) !void {
self.session = try self.browser.newSession(self.notification);
try self.session.enableConsoleCapture();
}