@getmateo/protocol 0.17.1 → 0.19.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/daemon-auth.d.ts +32 -0
- package/dist/daemon-auth.js +2 -0
- package/dist/generated/validation/ws-outbound-schema-metadata.d.ts +499 -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 +94305 -92873
- package/dist/mateo-tool-presentation/catalog.d.ts +1 -0
- package/dist/mateo-tool-presentation/catalog.js +1 -0
- package/dist/messages.d.ts +1283 -154
- package/dist/messages.js +33 -2
- package/dist/plugin-browser-consent-copy.d.ts +211 -0
- package/dist/plugin-browser-consent-copy.js +118 -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 +255 -37
- package/package.json +7 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const BrowserAutomationHostCapabilitySchema: z.ZodObject<{
|
|
3
|
-
supportedCommands: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("type" | "select" | "fill" | "logs" | "list_tabs" | "new_tab" | "snapshot" | "click" | "wait" | "keypress" | "navigate" | "back" | "forward" | "reload" | "screenshot" | "
|
|
3
|
+
supportedCommands: z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<("type" | "upload" | "select" | "fill" | "logs" | "list_tabs" | "new_tab" | "snapshot" | "click" | "wait" | "keypress" | "navigate" | "back" | "forward" | "reload" | "screenshot" | "hover" | "drag" | "evaluate" | "scroll" | "resize" | "close_tab" | "list_downloads")[], string[]>>;
|
|
4
4
|
hostKind: z.ZodDefault<z.ZodString>;
|
|
5
5
|
}, z.core.$loose>;
|
|
6
6
|
export type BrowserAutomationHostCapability = z.infer<typeof BrowserAutomationHostCapabilitySchema>;
|
|
@@ -11,9 +11,11 @@ export declare const BrowserAutomationErrorCodeSchema: z.ZodEnum<{
|
|
|
11
11
|
browser_stale_ref: "browser_stale_ref";
|
|
12
12
|
browser_unknown_error: "browser_unknown_error";
|
|
13
13
|
}>;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const BROWSER_AUTOMATION_BASE_COMMANDS: readonly ["list_tabs", "new_tab", "snapshot", "click", "fill", "wait", "type", "keypress", "navigate", "back", "forward", "reload", "screenshot", "upload", "select", "hover", "drag", "logs", "evaluate", "scroll", "resize", "close_tab"];
|
|
15
|
+
export declare const BROWSER_AUTOMATION_COMMAND_NAMES: readonly ["list_tabs", "new_tab", "snapshot", "click", "fill", "wait", "type", "keypress", "navigate", "back", "forward", "reload", "screenshot", "upload", "select", "hover", "drag", "logs", "evaluate", "scroll", "resize", "close_tab", "list_downloads"];
|
|
15
16
|
export declare const BrowserAutomationCommandNameSchema: z.ZodEnum<{
|
|
16
17
|
type: "type";
|
|
18
|
+
upload: "upload";
|
|
17
19
|
select: "select";
|
|
18
20
|
fill: "fill";
|
|
19
21
|
logs: "logs";
|
|
@@ -28,19 +30,23 @@ export declare const BrowserAutomationCommandNameSchema: z.ZodEnum<{
|
|
|
28
30
|
forward: "forward";
|
|
29
31
|
reload: "reload";
|
|
30
32
|
screenshot: "screenshot";
|
|
31
|
-
upload: "upload";
|
|
32
33
|
hover: "hover";
|
|
33
34
|
drag: "drag";
|
|
34
35
|
evaluate: "evaluate";
|
|
35
36
|
scroll: "scroll";
|
|
36
37
|
resize: "resize";
|
|
37
38
|
close_tab: "close_tab";
|
|
39
|
+
list_downloads: "list_downloads";
|
|
38
40
|
}>;
|
|
39
41
|
export declare const BrowserAutomationBrowserIdSchema: z.ZodString;
|
|
40
42
|
export declare const BrowserAutomationListTabsCommandSchema: z.ZodObject<{
|
|
41
43
|
command: z.ZodLiteral<"list_tabs">;
|
|
42
44
|
args: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
43
45
|
}, z.core.$strip>;
|
|
46
|
+
export declare const BrowserAutomationListDownloadsCommandSchema: z.ZodObject<{
|
|
47
|
+
command: z.ZodLiteral<"list_downloads">;
|
|
48
|
+
args: z.ZodObject<{}, z.core.$strict>;
|
|
49
|
+
}, z.core.$strip>;
|
|
44
50
|
export declare const BrowserAutomationNewTabCommandSchema: z.ZodObject<{
|
|
45
51
|
command: z.ZodLiteral<"new_tab">;
|
|
46
52
|
args: z.ZodDefault<z.ZodObject<{
|
|
@@ -209,6 +215,9 @@ export declare const BrowserAutomationCloseTabCommandSchema: z.ZodObject<{
|
|
|
209
215
|
export declare const BrowserAutomationCommandSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
210
216
|
command: z.ZodLiteral<"list_tabs">;
|
|
211
217
|
args: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
218
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
219
|
+
command: z.ZodLiteral<"list_downloads">;
|
|
220
|
+
args: z.ZodObject<{}, z.core.$strict>;
|
|
212
221
|
}, z.core.$strip>, z.ZodObject<{
|
|
213
222
|
command: z.ZodLiteral<"new_tab">;
|
|
214
223
|
args: z.ZodDefault<z.ZodObject<{
|
|
@@ -377,6 +386,65 @@ export declare const BrowserAutomationListTabsResultSchema: z.ZodObject<{
|
|
|
377
386
|
canGoForward: z.ZodOptional<z.ZodBoolean>;
|
|
378
387
|
}, z.core.$strip>>;
|
|
379
388
|
}, z.core.$strip>;
|
|
389
|
+
export declare const BrowserDownloadReceiptSchema: z.ZodObject<{
|
|
390
|
+
id: z.ZodString;
|
|
391
|
+
browserId: z.ZodNullable<z.ZodString>;
|
|
392
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
393
|
+
serverId: z.ZodNullable<z.ZodString>;
|
|
394
|
+
status: z.ZodEnum<{
|
|
395
|
+
completed: "completed";
|
|
396
|
+
failed: "failed";
|
|
397
|
+
cancelled: "cancelled";
|
|
398
|
+
}>;
|
|
399
|
+
path: z.ZodNullable<z.ZodString>;
|
|
400
|
+
url: z.ZodString;
|
|
401
|
+
filename: z.ZodString;
|
|
402
|
+
bytes: z.ZodNumber;
|
|
403
|
+
mimeType: z.ZodString;
|
|
404
|
+
finishedAt: z.ZodString;
|
|
405
|
+
error: z.ZodOptional<z.ZodString>;
|
|
406
|
+
}, z.core.$strip>;
|
|
407
|
+
export type BrowserDownloadReceipt = z.infer<typeof BrowserDownloadReceiptSchema>;
|
|
408
|
+
export declare const BROWSER_DOWNLOAD_LIST_LIMIT = 50;
|
|
409
|
+
export declare const BrowserDownloadListSchema: z.ZodArray<z.ZodObject<{
|
|
410
|
+
id: z.ZodString;
|
|
411
|
+
browserId: z.ZodNullable<z.ZodString>;
|
|
412
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
413
|
+
serverId: z.ZodNullable<z.ZodString>;
|
|
414
|
+
status: z.ZodEnum<{
|
|
415
|
+
completed: "completed";
|
|
416
|
+
failed: "failed";
|
|
417
|
+
cancelled: "cancelled";
|
|
418
|
+
}>;
|
|
419
|
+
path: z.ZodNullable<z.ZodString>;
|
|
420
|
+
url: z.ZodString;
|
|
421
|
+
filename: z.ZodString;
|
|
422
|
+
bytes: z.ZodNumber;
|
|
423
|
+
mimeType: z.ZodString;
|
|
424
|
+
finishedAt: z.ZodString;
|
|
425
|
+
error: z.ZodOptional<z.ZodString>;
|
|
426
|
+
}, z.core.$strip>>;
|
|
427
|
+
export declare const BrowserAutomationListDownloadsResultSchema: z.ZodObject<{
|
|
428
|
+
command: z.ZodLiteral<"list_downloads">;
|
|
429
|
+
downloads: z.ZodArray<z.ZodObject<{
|
|
430
|
+
id: z.ZodString;
|
|
431
|
+
browserId: z.ZodNullable<z.ZodString>;
|
|
432
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
433
|
+
serverId: z.ZodNullable<z.ZodString>;
|
|
434
|
+
status: z.ZodEnum<{
|
|
435
|
+
completed: "completed";
|
|
436
|
+
failed: "failed";
|
|
437
|
+
cancelled: "cancelled";
|
|
438
|
+
}>;
|
|
439
|
+
path: z.ZodNullable<z.ZodString>;
|
|
440
|
+
url: z.ZodString;
|
|
441
|
+
filename: z.ZodString;
|
|
442
|
+
bytes: z.ZodNumber;
|
|
443
|
+
mimeType: z.ZodString;
|
|
444
|
+
finishedAt: z.ZodString;
|
|
445
|
+
error: z.ZodOptional<z.ZodString>;
|
|
446
|
+
}, z.core.$strip>>;
|
|
447
|
+
}, z.core.$strip>;
|
|
380
448
|
export declare const BrowserAutomationNewTabResultSchema: z.ZodObject<{
|
|
381
449
|
command: z.ZodLiteral<"new_tab">;
|
|
382
450
|
browserId: z.ZodString;
|
|
@@ -569,6 +637,26 @@ export declare const BrowserAutomationResultSchema: z.ZodDiscriminatedUnion<[z.Z
|
|
|
569
637
|
canGoBack: z.ZodOptional<z.ZodBoolean>;
|
|
570
638
|
canGoForward: z.ZodOptional<z.ZodBoolean>;
|
|
571
639
|
}, z.core.$strip>>;
|
|
640
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
641
|
+
command: z.ZodLiteral<"list_downloads">;
|
|
642
|
+
downloads: z.ZodArray<z.ZodObject<{
|
|
643
|
+
id: z.ZodString;
|
|
644
|
+
browserId: z.ZodNullable<z.ZodString>;
|
|
645
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
646
|
+
serverId: z.ZodNullable<z.ZodString>;
|
|
647
|
+
status: z.ZodEnum<{
|
|
648
|
+
completed: "completed";
|
|
649
|
+
failed: "failed";
|
|
650
|
+
cancelled: "cancelled";
|
|
651
|
+
}>;
|
|
652
|
+
path: z.ZodNullable<z.ZodString>;
|
|
653
|
+
url: z.ZodString;
|
|
654
|
+
filename: z.ZodString;
|
|
655
|
+
bytes: z.ZodNumber;
|
|
656
|
+
mimeType: z.ZodString;
|
|
657
|
+
finishedAt: z.ZodString;
|
|
658
|
+
error: z.ZodOptional<z.ZodString>;
|
|
659
|
+
}, z.core.$strip>>;
|
|
572
660
|
}, z.core.$strip>, z.ZodObject<{
|
|
573
661
|
command: z.ZodLiteral<"new_tab">;
|
|
574
662
|
browserId: z.ZodString;
|
|
@@ -748,6 +836,9 @@ export declare const BrowserAutomationExecuteRequestSchema: z.ZodObject<{
|
|
|
748
836
|
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
749
837
|
command: z.ZodLiteral<"list_tabs">;
|
|
750
838
|
args: z.ZodDefault<z.ZodObject<{}, z.core.$strict>>;
|
|
839
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
840
|
+
command: z.ZodLiteral<"list_downloads">;
|
|
841
|
+
args: z.ZodObject<{}, z.core.$strict>;
|
|
751
842
|
}, z.core.$strip>, z.ZodObject<{
|
|
752
843
|
command: z.ZodLiteral<"new_tab">;
|
|
753
844
|
args: z.ZodDefault<z.ZodObject<{
|
|
@@ -911,6 +1002,26 @@ export declare const BrowserAutomationExecuteResponseSchema: z.ZodObject<{
|
|
|
911
1002
|
canGoBack: z.ZodOptional<z.ZodBoolean>;
|
|
912
1003
|
canGoForward: z.ZodOptional<z.ZodBoolean>;
|
|
913
1004
|
}, z.core.$strip>>;
|
|
1005
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1006
|
+
command: z.ZodLiteral<"list_downloads">;
|
|
1007
|
+
downloads: z.ZodArray<z.ZodObject<{
|
|
1008
|
+
id: z.ZodString;
|
|
1009
|
+
browserId: z.ZodNullable<z.ZodString>;
|
|
1010
|
+
workspaceId: z.ZodNullable<z.ZodString>;
|
|
1011
|
+
serverId: z.ZodNullable<z.ZodString>;
|
|
1012
|
+
status: z.ZodEnum<{
|
|
1013
|
+
completed: "completed";
|
|
1014
|
+
failed: "failed";
|
|
1015
|
+
cancelled: "cancelled";
|
|
1016
|
+
}>;
|
|
1017
|
+
path: z.ZodNullable<z.ZodString>;
|
|
1018
|
+
url: z.ZodString;
|
|
1019
|
+
filename: z.ZodString;
|
|
1020
|
+
bytes: z.ZodNumber;
|
|
1021
|
+
mimeType: z.ZodString;
|
|
1022
|
+
finishedAt: z.ZodString;
|
|
1023
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1024
|
+
}, z.core.$strip>>;
|
|
914
1025
|
}, z.core.$strip>, z.ZodObject<{
|
|
915
1026
|
command: z.ZodLiteral<"new_tab">;
|
|
916
1027
|
browserId: z.ZodString;
|
|
@@ -14,7 +14,9 @@ export const BrowserAutomationErrorCodeSchema = z.enum([
|
|
|
14
14
|
const BROWSER_AUTOMATION_BROWSER_ID_PATTERN = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|\d{13,}-[0-9a-f]+)$/i;
|
|
15
15
|
const BROWSER_AUTOMATION_BROWSER_ID_MESSAGE = "browserId must be a real id returned by browser_new_tab or browser_list_tabs";
|
|
16
16
|
const BROWSER_AUTOMATION_WAIT_CONDITION_MESSAGE = "browser_wait requires exactly one of text or url";
|
|
17
|
-
|
|
17
|
+
// Keep the registration enum sent to existing browser hosts unchanged. Download receipts
|
|
18
|
+
// are negotiated separately on browser.host.register, whose old validator rejects new enum values.
|
|
19
|
+
export const BROWSER_AUTOMATION_BASE_COMMANDS = [
|
|
18
20
|
"list_tabs",
|
|
19
21
|
"new_tab",
|
|
20
22
|
"snapshot",
|
|
@@ -38,6 +40,10 @@ export const BROWSER_AUTOMATION_COMMAND_NAMES = [
|
|
|
38
40
|
"resize",
|
|
39
41
|
"close_tab",
|
|
40
42
|
];
|
|
43
|
+
export const BROWSER_AUTOMATION_COMMAND_NAMES = [
|
|
44
|
+
...BROWSER_AUTOMATION_BASE_COMMANDS,
|
|
45
|
+
"list_downloads",
|
|
46
|
+
];
|
|
41
47
|
export const BrowserAutomationCommandNameSchema = z.enum(BROWSER_AUTOMATION_COMMAND_NAMES);
|
|
42
48
|
export const BrowserAutomationBrowserIdSchema = z
|
|
43
49
|
.string({ error: () => BROWSER_AUTOMATION_BROWSER_ID_MESSAGE })
|
|
@@ -62,6 +68,10 @@ export const BrowserAutomationListTabsCommandSchema = z.object({
|
|
|
62
68
|
command: z.literal("list_tabs"),
|
|
63
69
|
args: z.object({}).strict().default({}),
|
|
64
70
|
});
|
|
71
|
+
export const BrowserAutomationListDownloadsCommandSchema = z.object({
|
|
72
|
+
command: z.literal("list_downloads"),
|
|
73
|
+
args: z.object({}).strict(),
|
|
74
|
+
});
|
|
65
75
|
export const BrowserAutomationNewTabCommandSchema = z.object({
|
|
66
76
|
command: z.literal("new_tab"),
|
|
67
77
|
args: z
|
|
@@ -200,6 +210,7 @@ export const BrowserAutomationCloseTabCommandSchema = z.object({
|
|
|
200
210
|
});
|
|
201
211
|
export const BrowserAutomationCommandSchema = z.discriminatedUnion("command", [
|
|
202
212
|
BrowserAutomationListTabsCommandSchema,
|
|
213
|
+
BrowserAutomationListDownloadsCommandSchema,
|
|
203
214
|
BrowserAutomationNewTabCommandSchema,
|
|
204
215
|
BrowserAutomationSnapshotCommandSchema,
|
|
205
216
|
BrowserAutomationClickCommandSchema,
|
|
@@ -236,6 +247,28 @@ export const BrowserAutomationListTabsResultSchema = z.object({
|
|
|
236
247
|
command: z.literal("list_tabs"),
|
|
237
248
|
tabs: z.array(BrowserAutomationTabInfoSchema),
|
|
238
249
|
});
|
|
250
|
+
export const BrowserDownloadReceiptSchema = z.object({
|
|
251
|
+
id: z.string(),
|
|
252
|
+
browserId: z.string().nullable(),
|
|
253
|
+
workspaceId: z.string().nullable(),
|
|
254
|
+
serverId: z.string().nullable(),
|
|
255
|
+
status: z.enum(["completed", "failed", "cancelled"]),
|
|
256
|
+
path: z.string().nullable(),
|
|
257
|
+
url: z.string(),
|
|
258
|
+
filename: z.string(),
|
|
259
|
+
bytes: z.number().int().nonnegative(),
|
|
260
|
+
mimeType: z.string(),
|
|
261
|
+
finishedAt: z.string(),
|
|
262
|
+
error: z.string().optional(),
|
|
263
|
+
});
|
|
264
|
+
export const BROWSER_DOWNLOAD_LIST_LIMIT = 50;
|
|
265
|
+
export const BrowserDownloadListSchema = z
|
|
266
|
+
.array(BrowserDownloadReceiptSchema)
|
|
267
|
+
.max(BROWSER_DOWNLOAD_LIST_LIMIT);
|
|
268
|
+
export const BrowserAutomationListDownloadsResultSchema = z.object({
|
|
269
|
+
command: z.literal("list_downloads"),
|
|
270
|
+
downloads: BrowserDownloadListSchema,
|
|
271
|
+
});
|
|
239
272
|
export const BrowserAutomationNewTabResultSchema = z.object({
|
|
240
273
|
command: z.literal("new_tab"),
|
|
241
274
|
browserId: BrowserAutomationBrowserIdSchema,
|
|
@@ -397,6 +430,7 @@ export const BrowserAutomationCloseTabResultSchema = z.object({
|
|
|
397
430
|
});
|
|
398
431
|
export const BrowserAutomationResultSchema = z.discriminatedUnion("command", [
|
|
399
432
|
BrowserAutomationListTabsResultSchema,
|
|
433
|
+
BrowserAutomationListDownloadsResultSchema,
|
|
400
434
|
BrowserAutomationNewTabResultSchema,
|
|
401
435
|
BrowserAutomationSnapshotResultSchema,
|
|
402
436
|
BrowserAutomationClickResultSchema,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare function isValidWorkspaceDownloadSubdirectory(value: string): boolean;
|
|
3
|
+
export declare const MAX_BROWSER_DOWNLOAD_RULES = 32;
|
|
4
|
+
export declare const BrowserDownloadRuleSchema: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
workspaceId: z.ZodString;
|
|
7
|
+
directory: z.ZodString;
|
|
8
|
+
extensions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export declare const InstalledBrowserDownloadRuleSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
workspaceId: z.ZodString;
|
|
13
|
+
directory: z.ZodString;
|
|
14
|
+
extensions: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
|
|
15
|
+
pluginId: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export type BrowserDownloadRule = z.infer<typeof BrowserDownloadRuleSchema>;
|
|
18
|
+
export type InstalledBrowserDownloadRule = z.infer<typeof InstalledBrowserDownloadRuleSchema>;
|
|
19
|
+
export declare function compareBrowserDownloadRules(left: InstalledBrowserDownloadRule, right: InstalledBrowserDownloadRule): number;
|
|
20
|
+
export declare function selectBrowserDownloadDirectory(rules: readonly InstalledBrowserDownloadRule[], workspaceId: string, filename: string): string | undefined;
|
|
21
|
+
//# sourceMappingURL=browser-download-rules.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const reservedDeviceName = /^(?:con|prn|aux|nul|clock\$|conin\$|conout\$|(?:com|lpt)[0-9¹²³]) *(?:\.|$)/i;
|
|
3
|
+
export function isValidWorkspaceDownloadSubdirectory(value) {
|
|
4
|
+
return value.split("/").every((part) => {
|
|
5
|
+
if (!part || part !== part.trim() || part.startsWith(".") || part.endsWith("."))
|
|
6
|
+
return false;
|
|
7
|
+
// Windows short names can alias hidden directories, such as GIT~1.
|
|
8
|
+
return !/[<>:"\\|?*\p{Cc}\p{Cf}]|~[0-9]/u.test(part) && !reservedDeviceName.test(part);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export const MAX_BROWSER_DOWNLOAD_RULES = 32;
|
|
12
|
+
export const BrowserDownloadRuleSchema = z.strictObject({
|
|
13
|
+
id: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(128)
|
|
16
|
+
.regex(/^[a-z][a-z0-9-]*$/),
|
|
17
|
+
workspaceId: z.string().min(1).max(512),
|
|
18
|
+
directory: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.max(512)
|
|
22
|
+
.refine(isValidWorkspaceDownloadSubdirectory, "Expected a safe workspace-relative directory"),
|
|
23
|
+
extensions: z
|
|
24
|
+
.array(z.string().regex(/^[a-z0-9]{1,20}$/))
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(32)
|
|
27
|
+
.readonly()
|
|
28
|
+
.optional(),
|
|
29
|
+
});
|
|
30
|
+
export const InstalledBrowserDownloadRuleSchema = BrowserDownloadRuleSchema.extend({
|
|
31
|
+
pluginId: z.string().min(1).max(256),
|
|
32
|
+
});
|
|
33
|
+
function compareId(left, right) {
|
|
34
|
+
if (left === right)
|
|
35
|
+
return 0;
|
|
36
|
+
return left < right ? -1 : 1;
|
|
37
|
+
}
|
|
38
|
+
export function compareBrowserDownloadRules(left, right) {
|
|
39
|
+
return compareId(left.pluginId, right.pluginId) || compareId(left.id, right.id);
|
|
40
|
+
}
|
|
41
|
+
export function selectBrowserDownloadDirectory(rules, workspaceId, filename) {
|
|
42
|
+
const dot = filename.lastIndexOf(".");
|
|
43
|
+
const extension = dot > 0 ? filename.slice(dot + 1).toLowerCase() : "";
|
|
44
|
+
let first;
|
|
45
|
+
for (const rule of rules) {
|
|
46
|
+
if (rule.workspaceId !== workspaceId ||
|
|
47
|
+
(rule.extensions && !rule.extensions.includes(extension)))
|
|
48
|
+
continue;
|
|
49
|
+
if (!first || compareBrowserDownloadRules(rule, first) < 0)
|
|
50
|
+
first = rule;
|
|
51
|
+
}
|
|
52
|
+
return first?.directory;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=browser-download-rules.js.map
|
package/dist/daemon-auth.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export declare const DaemonAuthSessionSchema: z.ZodObject<{
|
|
|
35
35
|
peer: "peer";
|
|
36
36
|
service: "service";
|
|
37
37
|
}>;
|
|
38
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
serverId: z.ZodString;
|
|
40
|
+
label: z.ZodNullable<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>>;
|
|
38
42
|
connectedAt: z.ZodString;
|
|
39
43
|
current: z.ZodBoolean;
|
|
40
44
|
alwaysKept: z.ZodBoolean;
|
|
@@ -89,6 +93,10 @@ export declare const DaemonAuthStatusSchema: z.ZodObject<{
|
|
|
89
93
|
peer: "peer";
|
|
90
94
|
service: "service";
|
|
91
95
|
}>;
|
|
96
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
serverId: z.ZodString;
|
|
98
|
+
label: z.ZodNullable<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>>;
|
|
92
100
|
connectedAt: z.ZodString;
|
|
93
101
|
current: z.ZodBoolean;
|
|
94
102
|
alwaysKept: z.ZodBoolean;
|
|
@@ -179,6 +187,10 @@ export declare const DaemonAuthStatusResponseSchema: z.ZodObject<{
|
|
|
179
187
|
peer: "peer";
|
|
180
188
|
service: "service";
|
|
181
189
|
}>;
|
|
190
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
191
|
+
serverId: z.ZodString;
|
|
192
|
+
label: z.ZodNullable<z.ZodString>;
|
|
193
|
+
}, z.core.$strip>>;
|
|
182
194
|
connectedAt: z.ZodString;
|
|
183
195
|
current: z.ZodBoolean;
|
|
184
196
|
alwaysKept: z.ZodBoolean;
|
|
@@ -240,6 +252,10 @@ export declare const DaemonAuthPasswordSetResponseSchema: z.ZodObject<{
|
|
|
240
252
|
peer: "peer";
|
|
241
253
|
service: "service";
|
|
242
254
|
}>;
|
|
255
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
256
|
+
serverId: z.ZodString;
|
|
257
|
+
label: z.ZodNullable<z.ZodString>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
243
259
|
connectedAt: z.ZodString;
|
|
244
260
|
current: z.ZodBoolean;
|
|
245
261
|
alwaysKept: z.ZodBoolean;
|
|
@@ -302,6 +318,10 @@ export declare const DaemonAuthDeviceRevokeResponseSchema: z.ZodObject<{
|
|
|
302
318
|
peer: "peer";
|
|
303
319
|
service: "service";
|
|
304
320
|
}>;
|
|
321
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
322
|
+
serverId: z.ZodString;
|
|
323
|
+
label: z.ZodNullable<z.ZodString>;
|
|
324
|
+
}, z.core.$strip>>;
|
|
305
325
|
connectedAt: z.ZodString;
|
|
306
326
|
current: z.ZodBoolean;
|
|
307
327
|
alwaysKept: z.ZodBoolean;
|
|
@@ -384,6 +404,10 @@ export declare const DaemonAuthSessionDisconnectResponseSchema: z.ZodObject<{
|
|
|
384
404
|
peer: "peer";
|
|
385
405
|
service: "service";
|
|
386
406
|
}>;
|
|
407
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
408
|
+
serverId: z.ZodString;
|
|
409
|
+
label: z.ZodNullable<z.ZodString>;
|
|
410
|
+
}, z.core.$strip>>;
|
|
387
411
|
connectedAt: z.ZodString;
|
|
388
412
|
current: z.ZodBoolean;
|
|
389
413
|
alwaysKept: z.ZodBoolean;
|
|
@@ -446,6 +470,10 @@ export declare const DaemonAuthStatusSubscribeResponseSchema: z.ZodObject<{
|
|
|
446
470
|
peer: "peer";
|
|
447
471
|
service: "service";
|
|
448
472
|
}>;
|
|
473
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
474
|
+
serverId: z.ZodString;
|
|
475
|
+
label: z.ZodNullable<z.ZodString>;
|
|
476
|
+
}, z.core.$strip>>;
|
|
449
477
|
connectedAt: z.ZodString;
|
|
450
478
|
current: z.ZodBoolean;
|
|
451
479
|
alwaysKept: z.ZodBoolean;
|
|
@@ -508,6 +536,10 @@ export declare const DaemonAuthStatusChangedSchema: z.ZodObject<{
|
|
|
508
536
|
peer: "peer";
|
|
509
537
|
service: "service";
|
|
510
538
|
}>;
|
|
539
|
+
fleetPeer: z.ZodOptional<z.ZodObject<{
|
|
540
|
+
serverId: z.ZodString;
|
|
541
|
+
label: z.ZodNullable<z.ZodString>;
|
|
542
|
+
}, z.core.$strip>>;
|
|
511
543
|
connectedAt: z.ZodString;
|
|
512
544
|
current: z.ZodBoolean;
|
|
513
545
|
alwaysKept: z.ZodBoolean;
|
package/dist/daemon-auth.js
CHANGED
|
@@ -37,6 +37,8 @@ export const DaemonAuthSessionSchema = z.object({
|
|
|
37
37
|
appVersion: z.string().nullable(),
|
|
38
38
|
/** How the session authenticated. */
|
|
39
39
|
credential: z.enum(["none", "password", "localCredential", "device", "peer", "service"]),
|
|
40
|
+
/** Owner-side enrollment identity of the authenticated Fleet peer, never from hello.device. */
|
|
41
|
+
fleetPeer: z.object({ serverId: z.string(), label: z.string().nullable() }).optional(),
|
|
40
42
|
connectedAt: z.string(),
|
|
41
43
|
/** The session that asked; it always stays connected. */
|
|
42
44
|
current: z.boolean(),
|