omowright 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -22
- package/TOOLS.md +6 -6
- package/dist/agent-tabs.d.ts +56 -0
- package/dist/aria-hidden.d.ts +1 -0
- package/dist/aside/cli-binary.d.ts +7 -0
- package/dist/aside/cli-contract.d.ts +9 -0
- package/dist/aside/errors.d.ts +8 -0
- package/dist/aside/line-transport.d.ts +11 -0
- package/dist/aside/mcp-transport.d.ts +11 -0
- package/dist/aside/onboard.d.ts +76 -0
- package/dist/aside/session-types.d.ts +68 -0
- package/dist/aside/session.d.ts +20 -0
- package/{bin/omowright-cloak.mjs → dist/bin/omowright-cloak.js} +28 -31
- package/dist/bridge-schemas.d.ts +326 -0
- package/dist/bridge-transport.d.ts +144 -0
- package/dist/browser-context.d.ts +4024 -0
- package/dist/browser-process.d.ts +10 -0
- package/dist/bsk/browser-signals.d.ts +23 -0
- package/dist/bsk/browsers.d.ts +46 -0
- package/dist/bsk/connect.d.ts +23 -0
- package/dist/bsk/daemon-info.d.ts +16 -0
- package/dist/bsk/external-extension.d.ts +74 -0
- package/dist/bsk/identify-browser.d.ts +48 -0
- package/dist/bsk/install-cli.d.ts +37 -0
- package/dist/bsk/ipc-client.d.ts +45 -0
- package/dist/bsk/onboard.d.ts +96 -0
- package/dist/bsk/reply-fields.d.ts +3 -0
- package/dist/bsk/screenshot.d.ts +24 -0
- package/dist/bsk/session.d.ts +142 -0
- package/dist/bsk/snapshot.d.ts +16 -0
- package/dist/bsk/targets.d.ts +20 -0
- package/dist/captcha-wait.d.ts +17 -0
- package/dist/captcha.d.ts +46 -0
- package/dist/cdp-errors.d.ts +38 -0
- package/dist/cdp-methods.d.ts +10 -0
- package/dist/cdp-protocol.d.ts +459 -0
- package/dist/chrome-profile.d.ts +77 -0
- package/dist/chrome.d.ts +130 -0
- package/dist/cloak-profile.d.ts +43 -0
- package/dist/connection.d.ts +4024 -0
- package/dist/console-events.d.ts +22 -0
- package/dist/cookies.d.ts +42 -0
- package/dist/core.d.ts +10810 -0
- package/dist/cua.d.ts +56 -0
- package/dist/dialog-policy.d.ts +43 -0
- package/dist/ego/bindings.d.ts +68 -0
- package/dist/ego/cdp-client.d.ts +28 -0
- package/dist/ego/client.d.ts +8 -0
- package/dist/ego/errors.d.ts +7 -0
- package/dist/emulate.d.ts +62 -0
- package/dist/engines.d.ts +59 -0
- package/dist/events.d.ts +93 -0
- package/dist/frames-snapshot.d.ts +58 -0
- package/dist/har.d.ts +88 -0
- package/dist/human-handoff.d.ts +30 -0
- package/{src/index.js → dist/index.d.ts} +11 -55
- package/dist/index.js +39262 -0
- package/dist/injected.d.ts +1 -0
- package/dist/instance-lock.d.ts +5 -0
- package/dist/instances.d.ts +45 -0
- package/dist/internal-capability.d.ts +1 -0
- package/dist/launch-endpoint.d.ts +34 -0
- package/dist/layers.d.ts +31 -0
- package/dist/llm.d.ts +1349 -0
- package/dist/lock-backend-win32-xbcm60vz.js +57 -0
- package/dist/lock-backend-win32.d.ts +3 -0
- package/dist/lock-backend.d.ts +6 -0
- package/dist/native-host-win32.d.ts +38 -0
- package/dist/network-events.d.ts +66 -0
- package/dist/network-snoop.d.ts +56 -0
- package/dist/nul-frames.d.ts +4 -0
- package/dist/open-shadow-query.d.ts +1 -0
- package/dist/owner-only.d.ts +15 -0
- package/dist/page-bundle.js +1587 -0
- package/dist/page-events.d.ts +25 -0
- package/dist/page-routes.d.ts +30 -0
- package/dist/page-setup.d.ts +55 -0
- package/dist/pipe.d.ts +71 -0
- package/dist/process-start-time.d.ts +2 -0
- package/dist/read-property.d.ts +2 -0
- package/dist/routes.d.ts +60 -0
- package/dist/running-browser.d.ts +39 -0
- package/dist/scroll-collect.d.ts +36 -0
- package/dist/serial-emitter.d.ts +5 -0
- package/dist/shared-connections.d.ts +11 -0
- package/dist/snapshot-diff.d.ts +57 -0
- package/dist/text-matching.d.ts +21 -0
- package/dist/trace.d.ts +59 -0
- package/dist/url-match.d.ts +7 -0
- package/dist/viewport.d.ts +26 -0
- package/dist/ws.d.ts +62 -0
- package/package.json +47 -26
- package/presets/agent-events/SKILL.md +1 -1
- package/presets/captcha/SKILL.md +1 -3
- package/presets/chrome/SKILL.md +2 -2
- package/presets/cloak-bridge/SKILL.md +11 -11
- package/presets/network/SKILL.md +15 -13
- package/presets/visual-browse/SKILL.md +14 -10
- package/skills/omowright/SKILL.md +77 -47
- package/skills/omowright/references/aside.md +50 -0
- package/skills/omowright/references/browserskill.md +29 -32
- package/skills/omowright/references/ego.md +24 -0
- package/skills/omowright/references/eval-kernel.md +44 -23
- package/skills/omowright/references/frames-layers-human.md +16 -7
- package/skills/omowright/references/quickstart.md +3 -3
- package/skills/omowright/references/stealth.md +7 -7
- package/src/agent-tabs.js +0 -179
- package/src/aria-hidden.js +0 -47
- package/src/bridge-schemas.js +0 -44
- package/src/bridge-transport.js +0 -83
- package/src/browser-context.js +0 -105
- package/src/browser-process.js +0 -127
- package/src/bsk/browser-signals.js +0 -90
- package/src/bsk/browsers.js +0 -114
- package/src/bsk/connect.js +0 -75
- package/src/bsk/daemon-info.js +0 -100
- package/src/bsk/external-extension.js +0 -110
- package/src/bsk/identify-browser.js +0 -88
- package/src/bsk/install-cli.js +0 -81
- package/src/bsk/ipc-client.js +0 -236
- package/src/bsk/onboard.js +0 -140
- package/src/bsk/screenshot.js +0 -49
- package/src/bsk/session.js +0 -131
- package/src/bsk/snapshot.js +0 -56
- package/src/bsk/targets.js +0 -25
- package/src/captcha-wait.js +0 -79
- package/src/captcha.js +0 -142
- package/src/cdp-errors.js +0 -23
- package/src/cdp-methods.js +0 -69
- package/src/chrome-profile.js +0 -176
- package/src/chrome.js +0 -194
- package/src/cloak-profile.js +0 -266
- package/src/connection.js +0 -234
- package/src/console-events.js +0 -12
- package/src/cookies.js +0 -39
- package/src/core.js +0 -1702
- package/src/cua.js +0 -74
- package/src/dialog-policy.js +0 -80
- package/src/emulate.js +0 -127
- package/src/events.js +0 -111
- package/src/frames-snapshot.js +0 -138
- package/src/har.js +0 -103
- package/src/human-handoff.js +0 -124
- package/src/injected.js +0 -3
- package/src/instance-lock.js +0 -74
- package/src/instances.js +0 -490
- package/src/internal-capability.js +0 -1
- package/src/launch-endpoint.js +0 -185
- package/src/layers.js +0 -138
- package/src/llm.js +0 -201
- package/src/lock-backend-win32.js +0 -54
- package/src/lock-backend.js +0 -81
- package/src/native-host-win32.js +0 -201
- package/src/network-events.js +0 -223
- package/src/network-snoop.js +0 -229
- package/src/nul-frames.js +0 -28
- package/src/open-shadow-query.js +0 -101
- package/src/owner-only.js +0 -196
- package/src/page-bundle.js +0 -1478
- package/src/page-events.js +0 -45
- package/src/page-routes.js +0 -94
- package/src/page-setup.js +0 -239
- package/src/pipe.js +0 -418
- package/src/process-start-time.js +0 -64
- package/src/routes.js +0 -256
- package/src/running-browser.js +0 -85
- package/src/scroll-collect.js +0 -73
- package/src/serial-emitter.js +0 -17
- package/src/shared-connections.js +0 -285
- package/src/snapshot-diff.js +0 -75
- package/src/text-matching.js +0 -101
- package/src/trace.js +0 -183
- package/src/url-match.js +0 -148
- package/src/viewport.js +0 -12
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
export declare const HOST_NAME = "com.omowright.cloakbridge";
|
|
3
|
+
export declare const PROTOCOL = 1;
|
|
4
|
+
export declare const MAX_MESSAGE_BYTES: number;
|
|
5
|
+
export declare const EVENT_NAMES: readonly ["notifications.shown", "notifications.clicked", "notifications.closed", "tabGroups.created", "tabGroups.updated", "tabGroups.moved", "tabs.activated", "windows.focusChanged"];
|
|
6
|
+
export declare const COMMAND_NAMES: readonly ["bookmarks.create", "bookmarks.move", "bookmarks.remove", "history.deleteUrl", "history.deleteRange", "tabGroups.update", "debugger.attach", "debugger.detach"];
|
|
7
|
+
export type EventName = (typeof EVENT_NAMES)[number];
|
|
8
|
+
export type CommandName = (typeof COMMAND_NAMES)[number];
|
|
9
|
+
export declare const MUTATING_COMMANDS: Set<"bookmarks.create" | "bookmarks.move" | "bookmarks.remove" | "history.deleteUrl" | "history.deleteRange" | "tabGroups.update" | "debugger.attach" | "debugger.detach">;
|
|
10
|
+
export declare const isEventName: (value: unknown) => value is EventName;
|
|
11
|
+
export declare const isCommandName: (value: unknown) => value is CommandName;
|
|
12
|
+
export interface BookmarkNode {
|
|
13
|
+
id: string;
|
|
14
|
+
parentId?: string | undefined;
|
|
15
|
+
index?: number | undefined;
|
|
16
|
+
title: string;
|
|
17
|
+
url?: string | undefined;
|
|
18
|
+
dateAdded?: number | undefined;
|
|
19
|
+
dateGroupModified?: number | undefined;
|
|
20
|
+
dateLastUsed?: number | undefined;
|
|
21
|
+
folderType?: string | undefined;
|
|
22
|
+
syncing?: boolean | undefined;
|
|
23
|
+
unmodifiable?: string | undefined;
|
|
24
|
+
type?: "bookmark" | "folder" | "url" | undefined;
|
|
25
|
+
children?: BookmarkNode[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare const payloadSchemas: {
|
|
28
|
+
"notifications.shown": z.ZodObject<{
|
|
29
|
+
notificationId: z.ZodString;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
"notifications.clicked": z.ZodObject<{
|
|
32
|
+
notificationId: z.ZodString;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
"notifications.closed": z.ZodObject<{
|
|
35
|
+
notificationId: z.ZodString;
|
|
36
|
+
byUser: z.ZodBoolean;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
"tabGroups.created": z.ZodObject<{
|
|
39
|
+
group: z.ZodObject<{
|
|
40
|
+
id: z.ZodNumber;
|
|
41
|
+
collapsed: z.ZodBoolean;
|
|
42
|
+
color: z.ZodEnum<{
|
|
43
|
+
grey: "grey";
|
|
44
|
+
blue: "blue";
|
|
45
|
+
red: "red";
|
|
46
|
+
yellow: "yellow";
|
|
47
|
+
green: "green";
|
|
48
|
+
pink: "pink";
|
|
49
|
+
purple: "purple";
|
|
50
|
+
cyan: "cyan";
|
|
51
|
+
orange: "orange";
|
|
52
|
+
}>;
|
|
53
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
windowId: z.ZodNumber;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
"tabGroups.updated": z.ZodObject<{
|
|
58
|
+
group: z.ZodObject<{
|
|
59
|
+
id: z.ZodNumber;
|
|
60
|
+
collapsed: z.ZodBoolean;
|
|
61
|
+
color: z.ZodEnum<{
|
|
62
|
+
grey: "grey";
|
|
63
|
+
blue: "blue";
|
|
64
|
+
red: "red";
|
|
65
|
+
yellow: "yellow";
|
|
66
|
+
green: "green";
|
|
67
|
+
pink: "pink";
|
|
68
|
+
purple: "purple";
|
|
69
|
+
cyan: "cyan";
|
|
70
|
+
orange: "orange";
|
|
71
|
+
}>;
|
|
72
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
windowId: z.ZodNumber;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
"tabGroups.moved": z.ZodObject<{
|
|
77
|
+
group: z.ZodObject<{
|
|
78
|
+
id: z.ZodNumber;
|
|
79
|
+
collapsed: z.ZodBoolean;
|
|
80
|
+
color: z.ZodEnum<{
|
|
81
|
+
grey: "grey";
|
|
82
|
+
blue: "blue";
|
|
83
|
+
red: "red";
|
|
84
|
+
yellow: "yellow";
|
|
85
|
+
green: "green";
|
|
86
|
+
pink: "pink";
|
|
87
|
+
purple: "purple";
|
|
88
|
+
cyan: "cyan";
|
|
89
|
+
orange: "orange";
|
|
90
|
+
}>;
|
|
91
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
92
|
+
windowId: z.ZodNumber;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
"tabs.activated": z.ZodObject<{
|
|
96
|
+
tabId: z.ZodNumber;
|
|
97
|
+
windowId: z.ZodNumber;
|
|
98
|
+
previousTabId: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
"windows.focusChanged": z.ZodObject<{
|
|
101
|
+
windowId: z.ZodNumber;
|
|
102
|
+
}, z.core.$strict>;
|
|
103
|
+
};
|
|
104
|
+
export declare const commandParams: {
|
|
105
|
+
"bookmarks.create": z.ZodObject<{
|
|
106
|
+
details: z.ZodObject<{
|
|
107
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
108
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
title: z.ZodString;
|
|
110
|
+
url: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
}, z.core.$strict>;
|
|
113
|
+
"bookmarks.move": z.ZodObject<{
|
|
114
|
+
details: z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
117
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
"bookmarks.remove": z.ZodObject<{
|
|
121
|
+
details: z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
"history.deleteUrl": z.ZodObject<{
|
|
126
|
+
details: z.ZodObject<{
|
|
127
|
+
url: z.ZodString;
|
|
128
|
+
}, z.core.$strict>;
|
|
129
|
+
}, z.core.$strict>;
|
|
130
|
+
"history.deleteRange": z.ZodObject<{
|
|
131
|
+
details: z.ZodObject<{
|
|
132
|
+
startTime: z.ZodNumber;
|
|
133
|
+
endTime: z.ZodNumber;
|
|
134
|
+
}, z.core.$strict>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
"tabGroups.update": z.ZodObject<{
|
|
137
|
+
details: z.ZodObject<{
|
|
138
|
+
groupId: z.ZodNumber;
|
|
139
|
+
updateProperties: z.ZodObject<{
|
|
140
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
141
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
grey: "grey";
|
|
143
|
+
blue: "blue";
|
|
144
|
+
red: "red";
|
|
145
|
+
yellow: "yellow";
|
|
146
|
+
green: "green";
|
|
147
|
+
pink: "pink";
|
|
148
|
+
purple: "purple";
|
|
149
|
+
cyan: "cyan";
|
|
150
|
+
orange: "orange";
|
|
151
|
+
}>>;
|
|
152
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
}, z.core.$strict>;
|
|
155
|
+
}, z.core.$strict>;
|
|
156
|
+
"debugger.attach": z.ZodObject<{
|
|
157
|
+
details: z.ZodObject<{
|
|
158
|
+
tabId: z.ZodNumber;
|
|
159
|
+
requiredVersion: z.ZodString;
|
|
160
|
+
}, z.core.$strict>;
|
|
161
|
+
}, z.core.$strict>;
|
|
162
|
+
"debugger.detach": z.ZodObject<{
|
|
163
|
+
details: z.ZodObject<{
|
|
164
|
+
tabId: z.ZodNumber;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
}, z.core.$strict>;
|
|
167
|
+
};
|
|
168
|
+
export declare const resultSchemas: {
|
|
169
|
+
"bookmarks.create": z.ZodType<BookmarkNode, unknown, z.core.$ZodTypeInternals<BookmarkNode, unknown>>;
|
|
170
|
+
"bookmarks.move": z.ZodType<BookmarkNode, unknown, z.core.$ZodTypeInternals<BookmarkNode, unknown>>;
|
|
171
|
+
"bookmarks.remove": z.ZodObject<{}, z.core.$strict>;
|
|
172
|
+
"history.deleteUrl": z.ZodObject<{}, z.core.$strict>;
|
|
173
|
+
"history.deleteRange": z.ZodObject<{}, z.core.$strict>;
|
|
174
|
+
"tabGroups.update": z.ZodObject<{
|
|
175
|
+
id: z.ZodNumber;
|
|
176
|
+
collapsed: z.ZodBoolean;
|
|
177
|
+
color: z.ZodEnum<{
|
|
178
|
+
grey: "grey";
|
|
179
|
+
blue: "blue";
|
|
180
|
+
red: "red";
|
|
181
|
+
yellow: "yellow";
|
|
182
|
+
green: "green";
|
|
183
|
+
pink: "pink";
|
|
184
|
+
purple: "purple";
|
|
185
|
+
cyan: "cyan";
|
|
186
|
+
orange: "orange";
|
|
187
|
+
}>;
|
|
188
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
189
|
+
windowId: z.ZodNumber;
|
|
190
|
+
}, z.core.$strict>;
|
|
191
|
+
"debugger.attach": z.ZodObject<{
|
|
192
|
+
tabId: z.ZodNumber;
|
|
193
|
+
attached: z.ZodLiteral<true>;
|
|
194
|
+
requiredVersion: z.ZodString;
|
|
195
|
+
}, z.core.$strict>;
|
|
196
|
+
"debugger.detach": z.ZodObject<{
|
|
197
|
+
tabId: z.ZodNumber;
|
|
198
|
+
detached: z.ZodLiteral<true>;
|
|
199
|
+
}, z.core.$strict>;
|
|
200
|
+
};
|
|
201
|
+
export declare const ExtensionHelloSchema: z.ZodObject<{
|
|
202
|
+
type: z.ZodLiteral<"hello">;
|
|
203
|
+
role: z.ZodLiteral<"extension">;
|
|
204
|
+
connectionId: z.ZodString;
|
|
205
|
+
extensionId: z.ZodString;
|
|
206
|
+
extensionVersion: z.ZodString;
|
|
207
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
208
|
+
"notifications.shown": "notifications.shown";
|
|
209
|
+
"notifications.clicked": "notifications.clicked";
|
|
210
|
+
"notifications.closed": "notifications.closed";
|
|
211
|
+
"tabGroups.created": "tabGroups.created";
|
|
212
|
+
"tabGroups.updated": "tabGroups.updated";
|
|
213
|
+
"tabGroups.moved": "tabGroups.moved";
|
|
214
|
+
"tabs.activated": "tabs.activated";
|
|
215
|
+
"windows.focusChanged": "windows.focusChanged";
|
|
216
|
+
}>>;
|
|
217
|
+
commands: z.ZodArray<z.ZodEnum<{
|
|
218
|
+
"bookmarks.create": "bookmarks.create";
|
|
219
|
+
"bookmarks.move": "bookmarks.move";
|
|
220
|
+
"bookmarks.remove": "bookmarks.remove";
|
|
221
|
+
"history.deleteUrl": "history.deleteUrl";
|
|
222
|
+
"history.deleteRange": "history.deleteRange";
|
|
223
|
+
"tabGroups.update": "tabGroups.update";
|
|
224
|
+
"debugger.attach": "debugger.attach";
|
|
225
|
+
"debugger.detach": "debugger.detach";
|
|
226
|
+
}>>;
|
|
227
|
+
maxMessageBytes: z.ZodNumber;
|
|
228
|
+
protocol: z.ZodLiteral<1>;
|
|
229
|
+
}, z.core.$strict>;
|
|
230
|
+
export declare const HostHelloSchema: z.ZodObject<{
|
|
231
|
+
type: z.ZodLiteral<"hello">;
|
|
232
|
+
role: z.ZodLiteral<"host">;
|
|
233
|
+
connectionId: z.ZodString;
|
|
234
|
+
hostName: z.ZodLiteral<"com.omowright.cloakbridge">;
|
|
235
|
+
hostVersion: z.ZodString;
|
|
236
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
237
|
+
"notifications.shown": "notifications.shown";
|
|
238
|
+
"notifications.clicked": "notifications.clicked";
|
|
239
|
+
"notifications.closed": "notifications.closed";
|
|
240
|
+
"tabGroups.created": "tabGroups.created";
|
|
241
|
+
"tabGroups.updated": "tabGroups.updated";
|
|
242
|
+
"tabGroups.moved": "tabGroups.moved";
|
|
243
|
+
"tabs.activated": "tabs.activated";
|
|
244
|
+
"windows.focusChanged": "windows.focusChanged";
|
|
245
|
+
}>>;
|
|
246
|
+
commands: z.ZodArray<z.ZodEnum<{
|
|
247
|
+
"bookmarks.create": "bookmarks.create";
|
|
248
|
+
"bookmarks.move": "bookmarks.move";
|
|
249
|
+
"bookmarks.remove": "bookmarks.remove";
|
|
250
|
+
"history.deleteUrl": "history.deleteUrl";
|
|
251
|
+
"history.deleteRange": "history.deleteRange";
|
|
252
|
+
"tabGroups.update": "tabGroups.update";
|
|
253
|
+
"debugger.attach": "debugger.attach";
|
|
254
|
+
"debugger.detach": "debugger.detach";
|
|
255
|
+
}>>;
|
|
256
|
+
maxMessageBytes: z.ZodNumber;
|
|
257
|
+
protocol: z.ZodLiteral<1>;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
export declare const EventSchema: z.ZodObject<{
|
|
260
|
+
type: z.ZodLiteral<"event">;
|
|
261
|
+
connectionId: z.ZodString;
|
|
262
|
+
seq: z.ZodNumber;
|
|
263
|
+
occurredAt: z.ZodNumber;
|
|
264
|
+
name: z.ZodEnum<{
|
|
265
|
+
"notifications.shown": "notifications.shown";
|
|
266
|
+
"notifications.clicked": "notifications.clicked";
|
|
267
|
+
"notifications.closed": "notifications.closed";
|
|
268
|
+
"tabGroups.created": "tabGroups.created";
|
|
269
|
+
"tabGroups.updated": "tabGroups.updated";
|
|
270
|
+
"tabGroups.moved": "tabGroups.moved";
|
|
271
|
+
"tabs.activated": "tabs.activated";
|
|
272
|
+
"windows.focusChanged": "windows.focusChanged";
|
|
273
|
+
}>;
|
|
274
|
+
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
275
|
+
protocol: z.ZodLiteral<1>;
|
|
276
|
+
}, z.core.$strict>;
|
|
277
|
+
export declare const CommandSchema: z.ZodObject<{
|
|
278
|
+
type: z.ZodLiteral<"command">;
|
|
279
|
+
requestId: z.ZodString;
|
|
280
|
+
name: z.ZodEnum<{
|
|
281
|
+
"bookmarks.create": "bookmarks.create";
|
|
282
|
+
"bookmarks.move": "bookmarks.move";
|
|
283
|
+
"bookmarks.remove": "bookmarks.remove";
|
|
284
|
+
"history.deleteUrl": "history.deleteUrl";
|
|
285
|
+
"history.deleteRange": "history.deleteRange";
|
|
286
|
+
"tabGroups.update": "tabGroups.update";
|
|
287
|
+
"debugger.attach": "debugger.attach";
|
|
288
|
+
"debugger.detach": "debugger.detach";
|
|
289
|
+
}>;
|
|
290
|
+
params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
291
|
+
deadlineAt: z.ZodOptional<z.ZodNumber>;
|
|
292
|
+
protocol: z.ZodLiteral<1>;
|
|
293
|
+
}, z.core.$strict>;
|
|
294
|
+
export declare const ResponseSchema: z.ZodObject<{
|
|
295
|
+
type: z.ZodLiteral<"response">;
|
|
296
|
+
requestId: z.ZodString;
|
|
297
|
+
name: z.ZodEnum<{
|
|
298
|
+
"bookmarks.create": "bookmarks.create";
|
|
299
|
+
"bookmarks.move": "bookmarks.move";
|
|
300
|
+
"bookmarks.remove": "bookmarks.remove";
|
|
301
|
+
"history.deleteUrl": "history.deleteUrl";
|
|
302
|
+
"history.deleteRange": "history.deleteRange";
|
|
303
|
+
"tabGroups.update": "tabGroups.update";
|
|
304
|
+
"debugger.attach": "debugger.attach";
|
|
305
|
+
"debugger.detach": "debugger.detach";
|
|
306
|
+
protocolError: "protocolError";
|
|
307
|
+
}>;
|
|
308
|
+
ok: z.ZodBoolean;
|
|
309
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
310
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
311
|
+
code: z.ZodEnum<{
|
|
312
|
+
INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
313
|
+
UNKNOWN_COMMAND: "UNKNOWN_COMMAND";
|
|
314
|
+
UNSUPPORTED_COMMAND: "UNSUPPORTED_COMMAND";
|
|
315
|
+
CHROME_ERROR: "CHROME_ERROR";
|
|
316
|
+
DEBUGGER_ERROR: "DEBUGGER_ERROR";
|
|
317
|
+
NATIVE_HOST_DISCONNECTED: "NATIVE_HOST_DISCONNECTED";
|
|
318
|
+
TIMEOUT: "TIMEOUT";
|
|
319
|
+
PAYLOAD_TOO_LARGE: "PAYLOAD_TOO_LARGE";
|
|
320
|
+
INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
321
|
+
}>;
|
|
322
|
+
message: z.ZodString;
|
|
323
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
324
|
+
}, z.core.$strict>>;
|
|
325
|
+
protocol: z.ZodLiteral<1>;
|
|
326
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { ChromeApiOptions, ChromeConnection } from "./chrome.js";
|
|
2
|
+
import { createChromeApi as createStandaloneChromeApi } from "./chrome.js";
|
|
3
|
+
import { EventSchema } from "./bridge-schemas.js";
|
|
4
|
+
import type { CommandName, EventName } from "./bridge-schemas.js";
|
|
5
|
+
export { HOST_NAME, PROTOCOL, MAX_MESSAGE_BYTES, EVENT_NAMES, COMMAND_NAMES, ExtensionHelloSchema, HostHelloSchema, EventSchema, CommandSchema, ResponseSchema, } from "./bridge-schemas.js";
|
|
6
|
+
export type BridgeEvent = ReturnType<typeof EventSchema.parse>;
|
|
7
|
+
/** A protocol message as it goes on the wire: always a JSON object. */
|
|
8
|
+
export type BridgeMessage = Readonly<Record<string, unknown>>;
|
|
9
|
+
export type BridgeChunk = Uint8Array | string;
|
|
10
|
+
export type BridgeEventListener = (payload: Record<string, unknown>) => unknown;
|
|
11
|
+
/** The part of a readable stream (process.stdin by default) the host reads. */
|
|
12
|
+
export interface BridgeInput {
|
|
13
|
+
on(event: "data", listener: (chunk: BridgeChunk) => void): unknown;
|
|
14
|
+
once?(event: "end" | "error", listener: (error?: unknown) => void): unknown;
|
|
15
|
+
removeListener?(event: "data", listener: (chunk: BridgeChunk) => void): unknown;
|
|
16
|
+
}
|
|
17
|
+
/** The part of a writable stream (process.stdout by default) the host writes frames to. */
|
|
18
|
+
export interface BridgeOutput {
|
|
19
|
+
write(chunk: Buffer, callback: (error?: Error | null) => void): boolean;
|
|
20
|
+
once?(event: "error", listener: (error?: unknown) => void): unknown;
|
|
21
|
+
}
|
|
22
|
+
/** The diagnostics sink (process.stderr by default). */
|
|
23
|
+
export interface BridgeDiagnostics {
|
|
24
|
+
write?(text: string): unknown;
|
|
25
|
+
}
|
|
26
|
+
export interface NativeMessagingHostOptions {
|
|
27
|
+
stdin?: BridgeInput | undefined;
|
|
28
|
+
stdout?: BridgeOutput | undefined;
|
|
29
|
+
stderr?: BridgeDiagnostics | undefined;
|
|
30
|
+
/** Required at runtime: 32 characters a-p, the only extension whose hello is accepted. */
|
|
31
|
+
extensionId?: string | undefined;
|
|
32
|
+
hostName?: string | undefined;
|
|
33
|
+
maxMessageBytes?: number | undefined;
|
|
34
|
+
commandTimeoutMs?: number | undefined;
|
|
35
|
+
maxPendingWrites?: number | undefined;
|
|
36
|
+
onEvent?: ((event: BridgeEvent) => unknown) | undefined;
|
|
37
|
+
onDisconnect?: ((error: Error) => unknown) | undefined;
|
|
38
|
+
}
|
|
39
|
+
export interface BridgeRequestOptions {
|
|
40
|
+
signal?: AbortSignal | undefined;
|
|
41
|
+
timeoutMs?: number | undefined;
|
|
42
|
+
}
|
|
43
|
+
export interface InstallNativeMessagingHostOptions {
|
|
44
|
+
hostName?: string | undefined;
|
|
45
|
+
/** Required at runtime: an absolute path to a securely owned executable. */
|
|
46
|
+
hostPath?: string | undefined;
|
|
47
|
+
/** Required at runtime: 32 characters a-p. */
|
|
48
|
+
extensionId?: string | undefined;
|
|
49
|
+
browser?: string | undefined;
|
|
50
|
+
nativeMessagingHostDir?: string | undefined;
|
|
51
|
+
force?: boolean | undefined;
|
|
52
|
+
/** Not supported: any value other than undefined is rejected. */
|
|
53
|
+
endpointPath?: unknown;
|
|
54
|
+
/** win32 only: an HKCU Software NativeMessagingHosts registry key. */
|
|
55
|
+
registryKey?: string | undefined;
|
|
56
|
+
}
|
|
57
|
+
export declare class BridgeUnavailableError extends Error {
|
|
58
|
+
constructor(message?: string);
|
|
59
|
+
}
|
|
60
|
+
export declare class BridgeProtocolError extends Error {
|
|
61
|
+
constructor(message: string);
|
|
62
|
+
}
|
|
63
|
+
export declare function encodeFrame(value: BridgeMessage, maxMessageBytes?: number): Buffer;
|
|
64
|
+
export declare function decodeFrames(buffer: Buffer, maxMessageBytes?: number): {
|
|
65
|
+
frames: unknown[];
|
|
66
|
+
remainder: Buffer;
|
|
67
|
+
};
|
|
68
|
+
export declare function createNativeMessagingHost({ stdin, stdout, stderr, extensionId, hostName, maxMessageBytes, commandTimeoutMs, maxPendingWrites, onEvent, onDisconnect, }?: NativeMessagingHostOptions): {
|
|
69
|
+
readonly isConnected: boolean;
|
|
70
|
+
readonly capabilities: {
|
|
71
|
+
commands: Set<"bookmarks.create" | "bookmarks.move" | "bookmarks.remove" | "history.deleteUrl" | "history.deleteRange" | "tabGroups.update" | "debugger.attach" | "debugger.detach">;
|
|
72
|
+
events: Set<"notifications.shown" | "notifications.clicked" | "notifications.closed" | "tabGroups.created" | "tabGroups.updated" | "tabGroups.moved" | "tabs.activated" | "windows.focusChanged">;
|
|
73
|
+
};
|
|
74
|
+
send: (value: BridgeMessage) => Promise<void>;
|
|
75
|
+
request(name: CommandName, params: unknown, { signal, timeoutMs }?: BridgeRequestOptions): Promise<unknown>;
|
|
76
|
+
on(name: EventName, listener: BridgeEventListener): () => void;
|
|
77
|
+
emitEvent(name: EventName, payload: unknown): Promise<void>;
|
|
78
|
+
close(): void;
|
|
79
|
+
};
|
|
80
|
+
export declare function defaultNativeMessagingHostDir(browser?: string, platform?: NodeJS.Platform): string;
|
|
81
|
+
export declare function installNativeMessagingHost({ hostName, hostPath, extensionId, browser, nativeMessagingHostDir, force, endpointPath, registryKey, }?: InstallNativeMessagingHostOptions): Promise<{
|
|
82
|
+
path: string;
|
|
83
|
+
manifest: unknown;
|
|
84
|
+
registryKey: string;
|
|
85
|
+
} | {
|
|
86
|
+
path: string;
|
|
87
|
+
manifest: unknown;
|
|
88
|
+
}>;
|
|
89
|
+
/** The bridge surface createChromeApi drives: a native messaging host, or anything shaped like one. */
|
|
90
|
+
export interface ChromeBridge {
|
|
91
|
+
readonly isConnected?: boolean | undefined;
|
|
92
|
+
readonly capabilities?: {
|
|
93
|
+
readonly commands?: ReadonlySet<string> | undefined;
|
|
94
|
+
} | undefined;
|
|
95
|
+
request(name: CommandName, params: unknown): Promise<unknown>;
|
|
96
|
+
on?(name: string, listener: BridgeEventListener): () => void;
|
|
97
|
+
}
|
|
98
|
+
export interface BridgeChromeApiOptions extends ChromeApiOptions {
|
|
99
|
+
bridge?: ChromeBridge | undefined;
|
|
100
|
+
}
|
|
101
|
+
export type ChromeEventListener = (...args: unknown[]) => unknown;
|
|
102
|
+
export interface ChromeBridgeEvent {
|
|
103
|
+
addListener(listener: ChromeEventListener): (() => void) | undefined;
|
|
104
|
+
removeListener(listener: ChromeEventListener): void;
|
|
105
|
+
}
|
|
106
|
+
/** chrome.debugger's Debuggee; only tabId is forwarded. */
|
|
107
|
+
export interface ChromeDebuggee {
|
|
108
|
+
readonly tabId?: number | undefined;
|
|
109
|
+
}
|
|
110
|
+
type StandaloneChromeApi = ReturnType<typeof createStandaloneChromeApi>;
|
|
111
|
+
/** The standalone API with the bridge-backed mutations, tabGroups, debugger, and the per-namespace bridge events. */
|
|
112
|
+
export type BridgedChromeApi = Omit<StandaloneChromeApi, "bookmarks" | "history"> & {
|
|
113
|
+
bookmarks: Omit<StandaloneChromeApi["bookmarks"], "create" | "move" | "remove"> & {
|
|
114
|
+
create(details: unknown): Promise<unknown>;
|
|
115
|
+
move(id: unknown, details?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
116
|
+
remove(id: unknown): Promise<unknown>;
|
|
117
|
+
};
|
|
118
|
+
history: Omit<StandaloneChromeApi["history"], "deleteUrl" | "deleteRange"> & {
|
|
119
|
+
deleteUrl(details: unknown): Promise<unknown>;
|
|
120
|
+
deleteRange(details: unknown): Promise<unknown>;
|
|
121
|
+
};
|
|
122
|
+
tabGroups?: {
|
|
123
|
+
update(groupId: number, updateProperties: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
124
|
+
};
|
|
125
|
+
debugger?: {
|
|
126
|
+
attach(target: ChromeDebuggee, requiredVersion: string): Promise<unknown>;
|
|
127
|
+
detach(target: ChromeDebuggee): Promise<unknown>;
|
|
128
|
+
};
|
|
129
|
+
} & {
|
|
130
|
+
[namespace: string]: Record<string, unknown> | undefined;
|
|
131
|
+
};
|
|
132
|
+
export declare function createBridgeClient(options?: NativeMessagingHostOptions): {
|
|
133
|
+
readonly isConnected: boolean;
|
|
134
|
+
readonly capabilities: {
|
|
135
|
+
commands: Set<"bookmarks.create" | "bookmarks.move" | "bookmarks.remove" | "history.deleteUrl" | "history.deleteRange" | "tabGroups.update" | "debugger.attach" | "debugger.detach">;
|
|
136
|
+
events: Set<"notifications.shown" | "notifications.clicked" | "notifications.closed" | "tabGroups.created" | "tabGroups.updated" | "tabGroups.moved" | "tabs.activated" | "windows.focusChanged">;
|
|
137
|
+
};
|
|
138
|
+
send: (value: BridgeMessage) => Promise<void>;
|
|
139
|
+
request(name: CommandName, params: unknown, { signal, timeoutMs }?: BridgeRequestOptions): Promise<unknown>;
|
|
140
|
+
on(name: EventName, listener: BridgeEventListener): () => void;
|
|
141
|
+
emitEvent(name: EventName, payload: unknown): Promise<void>;
|
|
142
|
+
close(): void;
|
|
143
|
+
};
|
|
144
|
+
export declare function createChromeApi(connection: ChromeConnection, options?: BridgeChromeApiOptions): BridgedChromeApi;
|