mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-10 21:33:54 -04:00
cdp: implement webMCP domain
This commit is contained in:
6 files changed
+658
-10
No files matched your search
@@ -54,6 +54,8 @@ const Allocator = std.mem.Allocator;
|
||||
// that is shared across all Sessions (tabs) within that connection. This ensures
|
||||
// proper isolation between different CDP clients while allowing a single client
|
||||
// to receive events from all its tabs.
|
||||
const ModelContextTool = @import("browser/webapi/ModelContext.zig").Tool;
|
||||
|
||||
const Notification = @This();
|
||||
// Every event type (which are hard-coded), has a list of Listeners.
|
||||
// When the event happens, we dispatch to those listener.
|
||||
@@ -88,6 +90,8 @@ const EventListeners = struct {
|
||||
javascript_dialog_opening: List = .{},
|
||||
console_message: List = .{},
|
||||
runtime_console_message: List = .{},
|
||||
model_context_tool_added: List = .{},
|
||||
model_context_tool_removed: List = .{},
|
||||
};
|
||||
|
||||
const Events = union(enum) {
|
||||
@@ -111,6 +115,8 @@ const Events = union(enum) {
|
||||
javascript_dialog_opening: *const JavascriptDialogOpening,
|
||||
console_message: *const ConsoleMessage,
|
||||
runtime_console_message: *const ConsoleMessage,
|
||||
model_context_tool_added: *const ModelContextToolEvent,
|
||||
model_context_tool_removed: *const ModelContextToolEvent,
|
||||
};
|
||||
const EventType = std.meta.FieldEnum(Events);
|
||||
|
||||
@@ -224,6 +230,11 @@ pub const JavascriptDialogOpening = struct {
|
||||
response: *DialogResponse,
|
||||
};
|
||||
|
||||
pub const ModelContextToolEvent = struct {
|
||||
frame: *Frame,
|
||||
tool: *const ModelContextTool,
|
||||
};
|
||||
|
||||
pub const DialogResponse = struct {
|
||||
accept: bool = false,
|
||||
// Set when the CDP client sent a `promptText` with `accept: true`. Memory
|
||||
|
||||
Reference in new issue
Block a user