@getmateo/protocol 0.17.1 → 0.18.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/dist/browser-automation/capabilities.d.ts +1 -1
- package/dist/browser-automation/rpc-schemas.d.ts +113 -2
- package/dist/browser-automation/rpc-schemas.js +35 -1
- package/dist/browser-download-rules.d.ts +21 -0
- package/dist/browser-download-rules.js +54 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +433 -269
- package/dist/generated/validation/ws-outbound-schema-metadata.js +4 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +8 -0
- package/dist/generated/validation/ws-outbound.aot.js +94801 -93549
- package/dist/mateo-tool-presentation/catalog.d.ts +1 -0
- package/dist/mateo-tool-presentation/catalog.js +1 -0
- package/dist/messages.d.ts +1032 -154
- package/dist/messages.js +25 -2
- package/dist/plugin-browser-consent-copy.d.ts +193 -0
- package/dist/plugin-browser-consent-copy.js +109 -0
- package/dist/plugin-browser-grants.d.ts +48 -0
- package/dist/plugin-browser-grants.js +56 -0
- package/dist/plugin-browser.d.ts +321 -0
- package/dist/plugin-browser.js +109 -0
- package/dist/validation/ws-outbound-envelope.d.ts +189 -37
- package/package.json +7 -2
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare function isPrivateBrowserControlFrame(frame: unknown): boolean;
|
|
3
|
+
export declare const PluginBrowserCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
op: z.ZodLiteral<"listTabs">;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
op: z.ZodLiteral<"navigate">;
|
|
7
|
+
browserId: z.ZodString;
|
|
8
|
+
url: z.ZodString;
|
|
9
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
10
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
11
|
+
browserId: z.ZodString;
|
|
12
|
+
selector: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
13
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
14
|
+
op: z.ZodLiteral<"wait">;
|
|
15
|
+
browserId: z.ZodString;
|
|
16
|
+
text: z.ZodOptional<z.ZodString>;
|
|
17
|
+
url: z.ZodOptional<z.ZodString>;
|
|
18
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
20
|
+
op: z.ZodLiteral<"upload">;
|
|
21
|
+
browserId: z.ZodString;
|
|
22
|
+
selector: z.ZodString;
|
|
23
|
+
filePath: z.ZodString;
|
|
24
|
+
}, z.core.$strict>], "op">;
|
|
25
|
+
export type PluginBrowserCommand = z.infer<typeof PluginBrowserCommandSchema>;
|
|
26
|
+
export declare const PluginBrowserExecuteInputSchema: z.ZodObject<{
|
|
27
|
+
pluginId: z.ZodString;
|
|
28
|
+
installationId: z.ZodUUID;
|
|
29
|
+
workspaceId: z.ZodString;
|
|
30
|
+
serverId: z.ZodString;
|
|
31
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
32
|
+
pluginId: z.ZodString;
|
|
33
|
+
installationId: z.ZodUUID;
|
|
34
|
+
workspaceId: z.ZodString;
|
|
35
|
+
domain: z.ZodString;
|
|
36
|
+
capability: z.ZodEnum<{
|
|
37
|
+
read: "read";
|
|
38
|
+
upload: "upload";
|
|
39
|
+
}>;
|
|
40
|
+
epoch: z.ZodUUID;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
|
+
op: z.ZodLiteral<"listTabs">;
|
|
44
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
45
|
+
op: z.ZodLiteral<"navigate">;
|
|
46
|
+
browserId: z.ZodString;
|
|
47
|
+
url: z.ZodString;
|
|
48
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
49
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
50
|
+
browserId: z.ZodString;
|
|
51
|
+
selector: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
52
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53
|
+
op: z.ZodLiteral<"wait">;
|
|
54
|
+
browserId: z.ZodString;
|
|
55
|
+
text: z.ZodOptional<z.ZodString>;
|
|
56
|
+
url: z.ZodOptional<z.ZodString>;
|
|
57
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
59
|
+
op: z.ZodLiteral<"upload">;
|
|
60
|
+
browserId: z.ZodString;
|
|
61
|
+
selector: z.ZodString;
|
|
62
|
+
filePath: z.ZodString;
|
|
63
|
+
}, z.core.$strict>], "op">;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type PluginBrowserExecuteInput = z.infer<typeof PluginBrowserExecuteInputSchema>;
|
|
66
|
+
export declare const PluginBrowserResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
op: z.ZodLiteral<"listTabs">;
|
|
68
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
69
|
+
browserId: z.ZodString;
|
|
70
|
+
origin: z.ZodString;
|
|
71
|
+
}, z.core.$strict>>;
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
op: z.ZodLiteral<"navigate">;
|
|
74
|
+
origin: z.ZodString;
|
|
75
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
76
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
77
|
+
origin: z.ZodString;
|
|
78
|
+
src: z.ZodString;
|
|
79
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
80
|
+
op: z.ZodLiteral<"wait">;
|
|
81
|
+
origin: z.ZodString;
|
|
82
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
83
|
+
op: z.ZodLiteral<"upload">;
|
|
84
|
+
origin: z.ZodString;
|
|
85
|
+
}, z.core.$strict>], "op">;
|
|
86
|
+
export type PluginBrowserResult = z.infer<typeof PluginBrowserResultSchema>;
|
|
87
|
+
export declare const PluginBrowserErrorCodeSchema: z.ZodEnum<{
|
|
88
|
+
disabled: "disabled";
|
|
89
|
+
unavailable: "unavailable";
|
|
90
|
+
denied: "denied";
|
|
91
|
+
tab_not_found: "tab_not_found";
|
|
92
|
+
invalid_target: "invalid_target";
|
|
93
|
+
invalid_file: "invalid_file";
|
|
94
|
+
timeout: "timeout";
|
|
95
|
+
page_changed: "page_changed";
|
|
96
|
+
plugin_only: "plugin_only";
|
|
97
|
+
workspace_unavailable: "workspace_unavailable";
|
|
98
|
+
}>;
|
|
99
|
+
export type PluginBrowserErrorCode = z.infer<typeof PluginBrowserErrorCodeSchema>;
|
|
100
|
+
export declare const PluginBrowserOutcomeSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
101
|
+
ok: z.ZodLiteral<true>;
|
|
102
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
103
|
+
op: z.ZodLiteral<"listTabs">;
|
|
104
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
105
|
+
browserId: z.ZodString;
|
|
106
|
+
origin: z.ZodString;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
109
|
+
op: z.ZodLiteral<"navigate">;
|
|
110
|
+
origin: z.ZodString;
|
|
111
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
112
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
113
|
+
origin: z.ZodString;
|
|
114
|
+
src: z.ZodString;
|
|
115
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
116
|
+
op: z.ZodLiteral<"wait">;
|
|
117
|
+
origin: z.ZodString;
|
|
118
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
119
|
+
op: z.ZodLiteral<"upload">;
|
|
120
|
+
origin: z.ZodString;
|
|
121
|
+
}, z.core.$strict>], "op">;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
ok: z.ZodLiteral<false>;
|
|
124
|
+
error: z.ZodEnum<{
|
|
125
|
+
disabled: "disabled";
|
|
126
|
+
unavailable: "unavailable";
|
|
127
|
+
denied: "denied";
|
|
128
|
+
tab_not_found: "tab_not_found";
|
|
129
|
+
invalid_target: "invalid_target";
|
|
130
|
+
invalid_file: "invalid_file";
|
|
131
|
+
timeout: "timeout";
|
|
132
|
+
page_changed: "page_changed";
|
|
133
|
+
plugin_only: "plugin_only";
|
|
134
|
+
workspace_unavailable: "workspace_unavailable";
|
|
135
|
+
}>;
|
|
136
|
+
}, z.core.$strict>]>;
|
|
137
|
+
export type PluginBrowserOutcome = z.infer<typeof PluginBrowserOutcomeSchema>;
|
|
138
|
+
export declare const PluginBrowserRequestSchema: z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"plugin.browser.execute.request">;
|
|
140
|
+
requestId: z.ZodString;
|
|
141
|
+
workspaceId: z.ZodString;
|
|
142
|
+
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
143
|
+
op: z.ZodLiteral<"listTabs">;
|
|
144
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
145
|
+
op: z.ZodLiteral<"navigate">;
|
|
146
|
+
browserId: z.ZodString;
|
|
147
|
+
url: z.ZodString;
|
|
148
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
149
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
150
|
+
browserId: z.ZodString;
|
|
151
|
+
selector: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
152
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
153
|
+
op: z.ZodLiteral<"wait">;
|
|
154
|
+
browserId: z.ZodString;
|
|
155
|
+
text: z.ZodOptional<z.ZodString>;
|
|
156
|
+
url: z.ZodOptional<z.ZodString>;
|
|
157
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
159
|
+
op: z.ZodLiteral<"upload">;
|
|
160
|
+
browserId: z.ZodString;
|
|
161
|
+
selector: z.ZodString;
|
|
162
|
+
filePath: z.ZodString;
|
|
163
|
+
}, z.core.$strict>], "op">;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
export declare const PluginBrowserResponseSchema: z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"plugin.browser.execute.response">;
|
|
167
|
+
payload: z.ZodObject<{
|
|
168
|
+
requestId: z.ZodString;
|
|
169
|
+
outcome: z.ZodUnion<readonly [z.ZodObject<{
|
|
170
|
+
ok: z.ZodLiteral<true>;
|
|
171
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
172
|
+
op: z.ZodLiteral<"listTabs">;
|
|
173
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
174
|
+
browserId: z.ZodString;
|
|
175
|
+
origin: z.ZodString;
|
|
176
|
+
}, z.core.$strict>>;
|
|
177
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
178
|
+
op: z.ZodLiteral<"navigate">;
|
|
179
|
+
origin: z.ZodString;
|
|
180
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
181
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
182
|
+
origin: z.ZodString;
|
|
183
|
+
src: z.ZodString;
|
|
184
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
185
|
+
op: z.ZodLiteral<"wait">;
|
|
186
|
+
origin: z.ZodString;
|
|
187
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
188
|
+
op: z.ZodLiteral<"upload">;
|
|
189
|
+
origin: z.ZodString;
|
|
190
|
+
}, z.core.$strict>], "op">;
|
|
191
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
192
|
+
ok: z.ZodLiteral<false>;
|
|
193
|
+
error: z.ZodEnum<{
|
|
194
|
+
disabled: "disabled";
|
|
195
|
+
unavailable: "unavailable";
|
|
196
|
+
denied: "denied";
|
|
197
|
+
tab_not_found: "tab_not_found";
|
|
198
|
+
invalid_target: "invalid_target";
|
|
199
|
+
invalid_file: "invalid_file";
|
|
200
|
+
timeout: "timeout";
|
|
201
|
+
page_changed: "page_changed";
|
|
202
|
+
plugin_only: "plugin_only";
|
|
203
|
+
workspace_unavailable: "workspace_unavailable";
|
|
204
|
+
}>;
|
|
205
|
+
}, z.core.$strict>]>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
export declare const PluginBrowserHostRequestSchema: z.ZodObject<{
|
|
209
|
+
type: z.ZodLiteral<"browser.plugin_host.execute.request">;
|
|
210
|
+
requestId: z.ZodString;
|
|
211
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
212
|
+
input: z.ZodObject<{
|
|
213
|
+
pluginId: z.ZodString;
|
|
214
|
+
installationId: z.ZodUUID;
|
|
215
|
+
workspaceId: z.ZodString;
|
|
216
|
+
serverId: z.ZodString;
|
|
217
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
218
|
+
pluginId: z.ZodString;
|
|
219
|
+
installationId: z.ZodUUID;
|
|
220
|
+
workspaceId: z.ZodString;
|
|
221
|
+
domain: z.ZodString;
|
|
222
|
+
capability: z.ZodEnum<{
|
|
223
|
+
read: "read";
|
|
224
|
+
upload: "upload";
|
|
225
|
+
}>;
|
|
226
|
+
epoch: z.ZodUUID;
|
|
227
|
+
}, z.core.$strip>>;
|
|
228
|
+
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
229
|
+
op: z.ZodLiteral<"listTabs">;
|
|
230
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
231
|
+
op: z.ZodLiteral<"navigate">;
|
|
232
|
+
browserId: z.ZodString;
|
|
233
|
+
url: z.ZodString;
|
|
234
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
236
|
+
browserId: z.ZodString;
|
|
237
|
+
selector: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
238
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
239
|
+
op: z.ZodLiteral<"wait">;
|
|
240
|
+
browserId: z.ZodString;
|
|
241
|
+
text: z.ZodOptional<z.ZodString>;
|
|
242
|
+
url: z.ZodOptional<z.ZodString>;
|
|
243
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
245
|
+
op: z.ZodLiteral<"upload">;
|
|
246
|
+
browserId: z.ZodString;
|
|
247
|
+
selector: z.ZodString;
|
|
248
|
+
filePath: z.ZodString;
|
|
249
|
+
}, z.core.$strict>], "op">;
|
|
250
|
+
}, z.core.$strict>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
export declare const PluginBrowserHostResponseSchema: z.ZodObject<{
|
|
253
|
+
type: z.ZodLiteral<"browser.plugin_host.execute.response">;
|
|
254
|
+
payload: z.ZodObject<{
|
|
255
|
+
requestId: z.ZodString;
|
|
256
|
+
outcome: z.ZodUnion<readonly [z.ZodObject<{
|
|
257
|
+
ok: z.ZodLiteral<true>;
|
|
258
|
+
result: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
259
|
+
op: z.ZodLiteral<"listTabs">;
|
|
260
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
261
|
+
browserId: z.ZodString;
|
|
262
|
+
origin: z.ZodString;
|
|
263
|
+
}, z.core.$strict>>;
|
|
264
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
265
|
+
op: z.ZodLiteral<"navigate">;
|
|
266
|
+
origin: z.ZodString;
|
|
267
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
268
|
+
op: z.ZodLiteral<"readImageSource">;
|
|
269
|
+
origin: z.ZodString;
|
|
270
|
+
src: z.ZodString;
|
|
271
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
272
|
+
op: z.ZodLiteral<"wait">;
|
|
273
|
+
origin: z.ZodString;
|
|
274
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
275
|
+
op: z.ZodLiteral<"upload">;
|
|
276
|
+
origin: z.ZodString;
|
|
277
|
+
}, z.core.$strict>], "op">;
|
|
278
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
279
|
+
ok: z.ZodLiteral<false>;
|
|
280
|
+
error: z.ZodEnum<{
|
|
281
|
+
disabled: "disabled";
|
|
282
|
+
unavailable: "unavailable";
|
|
283
|
+
denied: "denied";
|
|
284
|
+
tab_not_found: "tab_not_found";
|
|
285
|
+
invalid_target: "invalid_target";
|
|
286
|
+
invalid_file: "invalid_file";
|
|
287
|
+
timeout: "timeout";
|
|
288
|
+
page_changed: "page_changed";
|
|
289
|
+
plugin_only: "plugin_only";
|
|
290
|
+
workspace_unavailable: "workspace_unavailable";
|
|
291
|
+
}>;
|
|
292
|
+
}, z.core.$strict>]>;
|
|
293
|
+
}, z.core.$strip>;
|
|
294
|
+
}, z.core.$strip>;
|
|
295
|
+
export declare const PluginBrowserGrantUpdateRequestSchema: z.ZodObject<{
|
|
296
|
+
type: z.ZodLiteral<"browser.plugin_host.set_grants.request">;
|
|
297
|
+
requestId: z.ZodString;
|
|
298
|
+
subscriptionId: z.ZodString;
|
|
299
|
+
snapshot: z.ZodObject<{
|
|
300
|
+
revision: z.ZodNumber;
|
|
301
|
+
grants: z.ZodArray<z.ZodObject<{
|
|
302
|
+
pluginId: z.ZodString;
|
|
303
|
+
installationId: z.ZodUUID;
|
|
304
|
+
workspaceId: z.ZodString;
|
|
305
|
+
domain: z.ZodString;
|
|
306
|
+
capability: z.ZodEnum<{
|
|
307
|
+
read: "read";
|
|
308
|
+
upload: "upload";
|
|
309
|
+
}>;
|
|
310
|
+
epoch: z.ZodUUID;
|
|
311
|
+
}, z.core.$strip>>;
|
|
312
|
+
}, z.core.$strip>;
|
|
313
|
+
}, z.core.$strip>;
|
|
314
|
+
export declare const PluginBrowserGrantUpdateResponseSchema: z.ZodObject<{
|
|
315
|
+
type: z.ZodLiteral<"browser.plugin_host.set_grants.response">;
|
|
316
|
+
payload: z.ZodObject<{
|
|
317
|
+
requestId: z.ZodString;
|
|
318
|
+
accepted: z.ZodBoolean;
|
|
319
|
+
}, z.core.$strip>;
|
|
320
|
+
}, z.core.$strip>;
|
|
321
|
+
//# sourceMappingURL=plugin-browser.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MAX_PLUGIN_BROWSER_GRANTS, PluginBrowserGrantSchema, PluginBrowserGrantSnapshotSchema, } from "./plugin-browser-grants.js";
|
|
3
|
+
// Validation errors can quote unexpected keys. A malformed private operation must not
|
|
4
|
+
// put a selector, file path or signed URL into transport diagnostics on either peer.
|
|
5
|
+
export function isPrivateBrowserControlFrame(frame) {
|
|
6
|
+
if (!frame || typeof frame !== "object" || !("message" in frame))
|
|
7
|
+
return false;
|
|
8
|
+
const message = frame.message;
|
|
9
|
+
return Boolean(message &&
|
|
10
|
+
typeof message === "object" &&
|
|
11
|
+
"type" in message &&
|
|
12
|
+
typeof message.type === "string" &&
|
|
13
|
+
(message.type.startsWith("plugin.browser.") || message.type.startsWith("browser.plugin_host.")));
|
|
14
|
+
}
|
|
15
|
+
const id = z.string().min(1).max(512);
|
|
16
|
+
const url = z.string().min(1).max(16384);
|
|
17
|
+
const selector = z.string().min(1).max(1024);
|
|
18
|
+
export const PluginBrowserCommandSchema = z.discriminatedUnion("op", [
|
|
19
|
+
z.strictObject({ op: z.literal("listTabs") }),
|
|
20
|
+
z.strictObject({ op: z.literal("navigate"), browserId: id, url }),
|
|
21
|
+
z.strictObject({
|
|
22
|
+
op: z.literal("readImageSource"),
|
|
23
|
+
browserId: id,
|
|
24
|
+
selector: z.union([selector, z.array(selector).min(1).max(4)]),
|
|
25
|
+
}),
|
|
26
|
+
z.strictObject({
|
|
27
|
+
op: z.literal("wait"),
|
|
28
|
+
browserId: id,
|
|
29
|
+
text: z.string().min(1).max(1024).optional(),
|
|
30
|
+
url: url.optional(),
|
|
31
|
+
timeoutMs: z.number().int().min(1).max(30000).optional(),
|
|
32
|
+
}),
|
|
33
|
+
z.strictObject({
|
|
34
|
+
op: z.literal("upload"),
|
|
35
|
+
browserId: id,
|
|
36
|
+
selector,
|
|
37
|
+
filePath: z.string().min(1).max(4096),
|
|
38
|
+
}),
|
|
39
|
+
]);
|
|
40
|
+
export const PluginBrowserExecuteInputSchema = z.strictObject({
|
|
41
|
+
pluginId: id,
|
|
42
|
+
installationId: z.uuid(),
|
|
43
|
+
workspaceId: id,
|
|
44
|
+
serverId: id,
|
|
45
|
+
grants: z.array(PluginBrowserGrantSchema).min(1).max(MAX_PLUGIN_BROWSER_GRANTS),
|
|
46
|
+
command: PluginBrowserCommandSchema,
|
|
47
|
+
});
|
|
48
|
+
const origin = z.string().min(1).max(270);
|
|
49
|
+
export const PluginBrowserResultSchema = z.discriminatedUnion("op", [
|
|
50
|
+
z.strictObject({
|
|
51
|
+
op: z.literal("listTabs"),
|
|
52
|
+
tabs: z.array(z.strictObject({ browserId: id, origin })).max(512),
|
|
53
|
+
}),
|
|
54
|
+
z.strictObject({ op: z.literal("navigate"), origin }),
|
|
55
|
+
z.strictObject({ op: z.literal("readImageSource"), origin, src: url }),
|
|
56
|
+
z.strictObject({ op: z.literal("wait"), origin }),
|
|
57
|
+
z.strictObject({ op: z.literal("upload"), origin }),
|
|
58
|
+
]);
|
|
59
|
+
export const PluginBrowserErrorCodeSchema = z.enum([
|
|
60
|
+
"denied",
|
|
61
|
+
"unavailable",
|
|
62
|
+
"tab_not_found",
|
|
63
|
+
"invalid_target",
|
|
64
|
+
"invalid_file",
|
|
65
|
+
"timeout",
|
|
66
|
+
"page_changed",
|
|
67
|
+
"plugin_only",
|
|
68
|
+
"workspace_unavailable",
|
|
69
|
+
"disabled",
|
|
70
|
+
]);
|
|
71
|
+
// zod-aot 0.20.4 emits string cases ("true"/"false") for boolean discriminators.
|
|
72
|
+
// Keep the structural union: the generated validator must accept both boolean branches.
|
|
73
|
+
export const PluginBrowserOutcomeSchema = z.union([
|
|
74
|
+
z.strictObject({ ok: z.literal(true), result: PluginBrowserResultSchema }),
|
|
75
|
+
z.strictObject({ ok: z.literal(false), error: PluginBrowserErrorCodeSchema }),
|
|
76
|
+
]);
|
|
77
|
+
export const PluginBrowserRequestSchema = z.strictObject({
|
|
78
|
+
type: z.literal("plugin.browser.execute.request"),
|
|
79
|
+
requestId: id,
|
|
80
|
+
workspaceId: id,
|
|
81
|
+
command: PluginBrowserCommandSchema,
|
|
82
|
+
});
|
|
83
|
+
export const PluginBrowserResponseSchema = z.object({
|
|
84
|
+
type: z.literal("plugin.browser.execute.response"),
|
|
85
|
+
payload: z.object({ requestId: id, outcome: PluginBrowserOutcomeSchema }),
|
|
86
|
+
});
|
|
87
|
+
// Reverse RPC: the host executor is addressed by its owned registration. The daemon
|
|
88
|
+
// assigns a separate unpredictable ID; plugin request IDs are never forwarded.
|
|
89
|
+
export const PluginBrowserHostRequestSchema = z.object({
|
|
90
|
+
type: z.literal("browser.plugin_host.execute.request"),
|
|
91
|
+
requestId: id,
|
|
92
|
+
subscriptionId: id.optional(),
|
|
93
|
+
input: PluginBrowserExecuteInputSchema,
|
|
94
|
+
});
|
|
95
|
+
export const PluginBrowserHostResponseSchema = z.object({
|
|
96
|
+
type: z.literal("browser.plugin_host.execute.response"),
|
|
97
|
+
payload: z.object({ requestId: id, outcome: PluginBrowserOutcomeSchema }),
|
|
98
|
+
});
|
|
99
|
+
export const PluginBrowserGrantUpdateRequestSchema = z.object({
|
|
100
|
+
type: z.literal("browser.plugin_host.set_grants.request"),
|
|
101
|
+
requestId: id,
|
|
102
|
+
subscriptionId: id,
|
|
103
|
+
snapshot: PluginBrowserGrantSnapshotSchema,
|
|
104
|
+
});
|
|
105
|
+
export const PluginBrowserGrantUpdateResponseSchema = z.object({
|
|
106
|
+
type: z.literal("browser.plugin_host.set_grants.response"),
|
|
107
|
+
payload: z.object({ requestId: id, accepted: z.boolean() }),
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=plugin-browser.js.map
|