@dev-anywhere/relay 0.9.0 → 0.9.1
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/assets/web/assets/{fvad-CKXL4ckP.js → fvad-DreiJBJr.js} +1 -1
- package/assets/web/assets/{index-Ba6B8Wrv.js → index-Buv7a7PI.js} +78 -78
- package/assets/web/assets/{jmuxer.min-DxI99rgK.js → jmuxer.min-BMedIzGm.js} +1 -1
- package/assets/web/index.html +1 -1
- package/assets/web/sw.js +1 -1
- package/dist/{chunk-27ZHYXYL.js → chunk-JLLMBFAB.js} +660 -572
- package/dist/chunk-JLLMBFAB.js.map +1 -0
- package/dist/handlers/proxy.d.ts.map +1 -1
- package/dist/health.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/proxy-upgrade-bootstrap.d.ts +13 -0
- package/dist/proxy-upgrade-bootstrap.d.ts.map +1 -0
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-27ZHYXYL.js.map +0 -1
|
@@ -481,18 +481,28 @@ var PreviewScopeSchema = z8.object({
|
|
|
481
481
|
bindingId: IdSchema
|
|
482
482
|
}).strict();
|
|
483
483
|
|
|
484
|
-
// ../../packages/shared/dist/schemas/
|
|
484
|
+
// ../../packages/shared/dist/schemas/proxy-upgrade-bootstrap.js
|
|
485
485
|
import { z as z9 } from "zod";
|
|
486
|
+
var PROXY_UPGRADE_BOOTSTRAP_VERSION = 1;
|
|
487
|
+
var StableVersionSchema = z9.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
|
|
488
|
+
var ProxyUpgradeBootstrapResponseSchema = z9.object({
|
|
489
|
+
bootstrapVersion: z9.literal(PROXY_UPGRADE_BOOTSTRAP_VERSION),
|
|
490
|
+
relayVersion: StableVersionSchema,
|
|
491
|
+
controlProtocolVersion: z9.number().int().positive()
|
|
492
|
+
}).strict();
|
|
493
|
+
|
|
494
|
+
// ../../packages/shared/dist/schemas/web-preview.js
|
|
495
|
+
import { z as z10 } from "zod";
|
|
486
496
|
var WEB_PREVIEW_PATH_MAX_LENGTH = 4096;
|
|
487
497
|
var WEB_PREVIEW_SOURCE_URL_MAX_LENGTH = 4096;
|
|
488
498
|
var WEB_PREVIEW_PUBLIC_URL_MAX_LENGTH = 65536;
|
|
489
499
|
var WEB_PREVIEW_NAME_MAX_LENGTH = 256;
|
|
490
500
|
var WEB_PREVIEW_ERROR_MAX_LENGTH = 4096;
|
|
491
501
|
var WEB_PREVIEW_HTML_ENTRY_MAX_COUNT = 1e3;
|
|
492
|
-
var WebPreviewNameSchema =
|
|
502
|
+
var WebPreviewNameSchema = z10.string().trim().min(1).max(WEB_PREVIEW_NAME_MAX_LENGTH);
|
|
493
503
|
var tunnelProviderValues = ["cloudflare", "cpolar"];
|
|
494
|
-
var TunnelProviderSchema =
|
|
495
|
-
var WebPreviewPathSchema =
|
|
504
|
+
var TunnelProviderSchema = z10.enum(tunnelProviderValues);
|
|
505
|
+
var WebPreviewPathSchema = z10.string().min(1).max(WEB_PREVIEW_PATH_MAX_LENGTH);
|
|
496
506
|
function parseUrlSafely(value) {
|
|
497
507
|
try {
|
|
498
508
|
return new URL(value);
|
|
@@ -500,7 +510,7 @@ function parseUrlSafely(value) {
|
|
|
500
510
|
return null;
|
|
501
511
|
}
|
|
502
512
|
}
|
|
503
|
-
var LoopbackHttpUrlSchema =
|
|
513
|
+
var LoopbackHttpUrlSchema = z10.string().min(1).max(WEB_PREVIEW_SOURCE_URL_MAX_LENGTH).url().refine((value) => {
|
|
504
514
|
const url = parseUrlSafely(value);
|
|
505
515
|
if (!url)
|
|
506
516
|
return false;
|
|
@@ -508,7 +518,7 @@ var LoopbackHttpUrlSchema = z9.string().min(1).max(WEB_PREVIEW_SOURCE_URL_MAX_LE
|
|
|
508
518
|
return false;
|
|
509
519
|
return url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
|
|
510
520
|
}, "Local preview URL must use http:// with a loopback host and no credentials");
|
|
511
|
-
var PublicPreviewUrlSchema =
|
|
521
|
+
var PublicPreviewUrlSchema = z10.string().min(1).max(WEB_PREVIEW_PUBLIC_URL_MAX_LENGTH).url().refine((value) => {
|
|
512
522
|
const url = parseUrlSafely(value);
|
|
513
523
|
if (!url)
|
|
514
524
|
return false;
|
|
@@ -517,45 +527,45 @@ var PublicPreviewUrlSchema = z9.string().min(1).max(WEB_PREVIEW_PUBLIC_URL_MAX_L
|
|
|
517
527
|
var DNS_LABEL_PATTERN = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
518
528
|
var CLOUDFLARE_PUBLIC_HOST_PATTERN = new RegExp(`^${DNS_LABEL_PATTERN}\\.trycloudflare\\.com$`, "i");
|
|
519
529
|
var CPOLAR_PUBLIC_HOST_PATTERN = new RegExp(`^(?:${DNS_LABEL_PATTERN}\\.)+cpolar\\.(?:top|cn|io)$`, "i");
|
|
520
|
-
var WebPreviewTunnelSuggestionsSchema =
|
|
521
|
-
var WebPreviewTunnelStatusSchema =
|
|
522
|
-
|
|
523
|
-
available:
|
|
524
|
-
command:
|
|
525
|
-
version:
|
|
526
|
-
error:
|
|
530
|
+
var WebPreviewTunnelSuggestionsSchema = z10.array(z10.string().min(1).max(WEB_PREVIEW_PATH_MAX_LENGTH)).max(32).optional();
|
|
531
|
+
var WebPreviewTunnelStatusSchema = z10.discriminatedUnion("available", [
|
|
532
|
+
z10.object({
|
|
533
|
+
available: z10.literal(true),
|
|
534
|
+
command: z10.string().min(1).max(WEB_PREVIEW_PATH_MAX_LENGTH),
|
|
535
|
+
version: z10.string().min(1).max(256).optional(),
|
|
536
|
+
error: z10.never().optional(),
|
|
527
537
|
suggestions: WebPreviewTunnelSuggestionsSchema
|
|
528
538
|
}).strict(),
|
|
529
|
-
|
|
530
|
-
available:
|
|
531
|
-
command:
|
|
532
|
-
version:
|
|
533
|
-
error:
|
|
539
|
+
z10.object({
|
|
540
|
+
available: z10.literal(false),
|
|
541
|
+
command: z10.never().optional(),
|
|
542
|
+
version: z10.never().optional(),
|
|
543
|
+
error: z10.string().min(1).max(WEB_PREVIEW_ERROR_MAX_LENGTH),
|
|
534
544
|
suggestions: WebPreviewTunnelSuggestionsSchema
|
|
535
545
|
}).strict()
|
|
536
546
|
]);
|
|
537
|
-
var WebPreviewCapabilitySchema =
|
|
547
|
+
var WebPreviewCapabilitySchema = z10.object({
|
|
538
548
|
cloudflared: WebPreviewTunnelStatusSchema,
|
|
539
549
|
cpolar: WebPreviewTunnelStatusSchema
|
|
540
550
|
}).strict();
|
|
541
|
-
var WebPreviewSourceInputSchema =
|
|
542
|
-
|
|
543
|
-
kind:
|
|
551
|
+
var WebPreviewSourceInputSchema = z10.discriminatedUnion("kind", [
|
|
552
|
+
z10.object({
|
|
553
|
+
kind: z10.literal("local"),
|
|
544
554
|
url: LoopbackHttpUrlSchema
|
|
545
555
|
}).strict(),
|
|
546
|
-
|
|
547
|
-
kind:
|
|
556
|
+
z10.object({
|
|
557
|
+
kind: z10.literal("static"),
|
|
548
558
|
path: WebPreviewPathSchema,
|
|
549
559
|
entryPath: WebPreviewPathSchema
|
|
550
560
|
}).strict()
|
|
551
561
|
]);
|
|
552
|
-
var PreviewSourceSchema =
|
|
553
|
-
|
|
554
|
-
kind:
|
|
562
|
+
var PreviewSourceSchema = z10.discriminatedUnion("kind", [
|
|
563
|
+
z10.object({
|
|
564
|
+
kind: z10.literal("local"),
|
|
555
565
|
url: LoopbackHttpUrlSchema
|
|
556
566
|
}).strict(),
|
|
557
|
-
|
|
558
|
-
kind:
|
|
567
|
+
z10.object({
|
|
568
|
+
kind: z10.literal("static"),
|
|
559
569
|
rootPath: WebPreviewPathSchema,
|
|
560
570
|
entryPath: WebPreviewPathSchema
|
|
561
571
|
}).strict()
|
|
@@ -567,40 +577,40 @@ var previewStateValues = [
|
|
|
567
577
|
"failed",
|
|
568
578
|
"stopping"
|
|
569
579
|
];
|
|
570
|
-
var PreviewStateSchema =
|
|
571
|
-
var PreviewSummaryBaseSchema =
|
|
580
|
+
var PreviewStateSchema = z10.enum(previewStateValues);
|
|
581
|
+
var PreviewSummaryBaseSchema = z10.object({
|
|
572
582
|
previewId: IdSchema,
|
|
573
583
|
name: WebPreviewNameSchema,
|
|
574
584
|
source: PreviewSourceSchema,
|
|
575
585
|
tunnelProvider: TunnelProviderSchema,
|
|
576
|
-
createdAt:
|
|
577
|
-
updatedAt:
|
|
586
|
+
createdAt: z10.number().int().nonnegative(),
|
|
587
|
+
updatedAt: z10.number().int().nonnegative()
|
|
578
588
|
});
|
|
579
589
|
var PreviewSummaryInactiveShape = {
|
|
580
|
-
publicUrl:
|
|
581
|
-
error:
|
|
590
|
+
publicUrl: z10.never().optional(),
|
|
591
|
+
error: z10.never().optional()
|
|
582
592
|
};
|
|
583
|
-
var PreviewSummarySchema =
|
|
593
|
+
var PreviewSummarySchema = z10.discriminatedUnion("state", [
|
|
584
594
|
PreviewSummaryBaseSchema.extend({
|
|
585
|
-
state:
|
|
595
|
+
state: z10.literal("starting"),
|
|
586
596
|
...PreviewSummaryInactiveShape
|
|
587
597
|
}).strict(),
|
|
588
598
|
PreviewSummaryBaseSchema.extend({
|
|
589
|
-
state:
|
|
599
|
+
state: z10.literal("ready"),
|
|
590
600
|
publicUrl: PublicPreviewUrlSchema,
|
|
591
|
-
error:
|
|
601
|
+
error: z10.never().optional()
|
|
592
602
|
}).strict(),
|
|
593
603
|
PreviewSummaryBaseSchema.extend({
|
|
594
|
-
state:
|
|
604
|
+
state: z10.literal("disconnected"),
|
|
595
605
|
...PreviewSummaryInactiveShape
|
|
596
606
|
}).strict(),
|
|
597
607
|
PreviewSummaryBaseSchema.extend({
|
|
598
|
-
state:
|
|
599
|
-
publicUrl:
|
|
600
|
-
error:
|
|
608
|
+
state: z10.literal("failed"),
|
|
609
|
+
publicUrl: z10.never().optional(),
|
|
610
|
+
error: z10.string().min(1).max(WEB_PREVIEW_ERROR_MAX_LENGTH)
|
|
601
611
|
}).strict(),
|
|
602
612
|
PreviewSummaryBaseSchema.extend({
|
|
603
|
-
state:
|
|
613
|
+
state: z10.literal("stopping"),
|
|
604
614
|
...PreviewSummaryInactiveShape
|
|
605
615
|
}).strict()
|
|
606
616
|
]).superRefine((preview, context) => {
|
|
@@ -620,104 +630,104 @@ var PreviewSummarySchema = z9.discriminatedUnion("state", [
|
|
|
620
630
|
});
|
|
621
631
|
}
|
|
622
632
|
});
|
|
623
|
-
var PreviewHtmlEntriesSchema =
|
|
633
|
+
var PreviewHtmlEntriesSchema = z10.array(WebPreviewPathSchema).max(WEB_PREVIEW_HTML_ENTRY_MAX_COUNT);
|
|
624
634
|
|
|
625
635
|
// ../../packages/shared/dist/schemas/device-preview.js
|
|
626
|
-
import { z as
|
|
636
|
+
import { z as z11 } from "zod";
|
|
627
637
|
var DEVICE_PREVIEW_PATH_MAX_LENGTH = 4096;
|
|
628
638
|
var DEVICE_PREVIEW_TEXT_MAX_LENGTH = 4096;
|
|
629
639
|
var DEVICE_PREVIEW_ERROR_MAX_LENGTH = 4096;
|
|
630
640
|
var DEVICE_PREVIEW_NAME_MAX_LENGTH = 256;
|
|
631
641
|
var DEVICE_PREVIEW_VERSION_MAX_LENGTH = 256;
|
|
632
642
|
var DEVICE_PREVIEW_SCREEN_EDGE_MAX = 16384;
|
|
633
|
-
var DevicePreviewNameSchema =
|
|
643
|
+
var DevicePreviewNameSchema = z11.string().trim().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH);
|
|
634
644
|
var devicePreviewStreamFormatValues = ["jpeg", "h264_annex_b"];
|
|
635
|
-
var DevicePreviewStreamFormatSchema =
|
|
645
|
+
var DevicePreviewStreamFormatSchema = z11.enum(devicePreviewStreamFormatValues);
|
|
636
646
|
var devicePreviewPlatformValues = ["ios", "android"];
|
|
637
|
-
var DevicePreviewPlatformSchema =
|
|
638
|
-
var DevicePreviewToolSuggestionsSchema =
|
|
639
|
-
var DevicePreviewToolStatusSchema =
|
|
640
|
-
|
|
641
|
-
supported:
|
|
642
|
-
available:
|
|
643
|
-
interactive:
|
|
644
|
-
command:
|
|
645
|
-
version:
|
|
646
|
-
error:
|
|
647
|
+
var DevicePreviewPlatformSchema = z11.enum(devicePreviewPlatformValues);
|
|
648
|
+
var DevicePreviewToolSuggestionsSchema = z11.array(z11.string().min(1).max(DEVICE_PREVIEW_PATH_MAX_LENGTH)).max(32).optional();
|
|
649
|
+
var DevicePreviewToolStatusSchema = z11.union([
|
|
650
|
+
z11.object({
|
|
651
|
+
supported: z11.literal(false),
|
|
652
|
+
available: z11.literal(false),
|
|
653
|
+
interactive: z11.literal(false),
|
|
654
|
+
command: z11.never().optional(),
|
|
655
|
+
version: z11.never().optional(),
|
|
656
|
+
error: z11.string().min(1).max(DEVICE_PREVIEW_ERROR_MAX_LENGTH),
|
|
647
657
|
suggestions: DevicePreviewToolSuggestionsSchema
|
|
648
658
|
}).strict(),
|
|
649
|
-
|
|
650
|
-
supported:
|
|
651
|
-
available:
|
|
652
|
-
interactive:
|
|
653
|
-
command:
|
|
654
|
-
version:
|
|
655
|
-
error:
|
|
659
|
+
z11.object({
|
|
660
|
+
supported: z11.literal(true),
|
|
661
|
+
available: z11.literal(false),
|
|
662
|
+
interactive: z11.literal(false),
|
|
663
|
+
command: z11.string().min(1).max(DEVICE_PREVIEW_PATH_MAX_LENGTH).optional(),
|
|
664
|
+
version: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH).optional(),
|
|
665
|
+
error: z11.string().min(1).max(DEVICE_PREVIEW_ERROR_MAX_LENGTH),
|
|
656
666
|
suggestions: DevicePreviewToolSuggestionsSchema
|
|
657
667
|
}).strict(),
|
|
658
|
-
|
|
659
|
-
supported:
|
|
660
|
-
available:
|
|
661
|
-
interactive:
|
|
662
|
-
command:
|
|
663
|
-
version:
|
|
664
|
-
error:
|
|
668
|
+
z11.object({
|
|
669
|
+
supported: z11.literal(true),
|
|
670
|
+
available: z11.literal(true),
|
|
671
|
+
interactive: z11.literal(true),
|
|
672
|
+
command: z11.string().min(1).max(DEVICE_PREVIEW_PATH_MAX_LENGTH),
|
|
673
|
+
version: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH).optional(),
|
|
674
|
+
error: z11.never().optional(),
|
|
665
675
|
suggestions: DevicePreviewToolSuggestionsSchema
|
|
666
676
|
}).strict()
|
|
667
677
|
]);
|
|
668
|
-
var DevicePreviewCapabilitySchema =
|
|
678
|
+
var DevicePreviewCapabilitySchema = z11.object({
|
|
669
679
|
ios: DevicePreviewToolStatusSchema,
|
|
670
680
|
android: DevicePreviewToolStatusSchema
|
|
671
681
|
}).strict();
|
|
672
|
-
var DevicePreviewTargetBaseSchema =
|
|
682
|
+
var DevicePreviewTargetBaseSchema = z11.object({
|
|
673
683
|
targetId: IdSchema,
|
|
674
684
|
platform: DevicePreviewPlatformSchema,
|
|
675
|
-
name:
|
|
676
|
-
model:
|
|
677
|
-
osVersion:
|
|
678
|
-
interactive:
|
|
685
|
+
name: z11.string().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH),
|
|
686
|
+
model: z11.string().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH),
|
|
687
|
+
osVersion: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH),
|
|
688
|
+
interactive: z11.boolean()
|
|
679
689
|
});
|
|
680
|
-
var DevicePreviewScreenEdgeSchema =
|
|
681
|
-
var DevicePreviewTargetSchema =
|
|
690
|
+
var DevicePreviewScreenEdgeSchema = z11.number().int().positive().max(DEVICE_PREVIEW_SCREEN_EDGE_MAX);
|
|
691
|
+
var DevicePreviewTargetSchema = z11.union([
|
|
682
692
|
DevicePreviewTargetBaseSchema.extend({
|
|
683
693
|
width: DevicePreviewScreenEdgeSchema,
|
|
684
694
|
height: DevicePreviewScreenEdgeSchema
|
|
685
695
|
}).strict(),
|
|
686
696
|
DevicePreviewTargetBaseSchema.extend({
|
|
687
|
-
width:
|
|
688
|
-
height:
|
|
697
|
+
width: z11.never().optional(),
|
|
698
|
+
height: z11.never().optional()
|
|
689
699
|
}).strict()
|
|
690
700
|
]);
|
|
691
|
-
var DevicePreviewStateSchema =
|
|
692
|
-
var DevicePreviewSummaryBaseSchema =
|
|
701
|
+
var DevicePreviewStateSchema = z11.enum(["ready", "disconnected"]);
|
|
702
|
+
var DevicePreviewSummaryBaseSchema = z11.object({
|
|
693
703
|
previewId: IdSchema,
|
|
694
704
|
name: DevicePreviewNameSchema,
|
|
695
705
|
platform: DevicePreviewPlatformSchema,
|
|
696
706
|
targetId: IdSchema,
|
|
697
|
-
model:
|
|
698
|
-
osVersion:
|
|
699
|
-
interactive:
|
|
700
|
-
createdAt:
|
|
701
|
-
updatedAt:
|
|
707
|
+
model: z11.string().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH),
|
|
708
|
+
osVersion: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH),
|
|
709
|
+
interactive: z11.boolean(),
|
|
710
|
+
createdAt: z11.number().int().nonnegative(),
|
|
711
|
+
updatedAt: z11.number().int().nonnegative()
|
|
702
712
|
});
|
|
703
|
-
var DevicePreviewSummarySchema =
|
|
713
|
+
var DevicePreviewSummarySchema = z11.discriminatedUnion("state", [
|
|
704
714
|
DevicePreviewSummaryBaseSchema.extend({
|
|
705
|
-
state:
|
|
706
|
-
error:
|
|
715
|
+
state: z11.literal("ready"),
|
|
716
|
+
error: z11.never().optional()
|
|
707
717
|
}).strict(),
|
|
708
718
|
DevicePreviewSummaryBaseSchema.extend({
|
|
709
|
-
state:
|
|
710
|
-
error:
|
|
719
|
+
state: z11.literal("disconnected"),
|
|
720
|
+
error: z11.never().optional()
|
|
711
721
|
}).strict()
|
|
712
722
|
]);
|
|
713
|
-
var DevicePreviewJpegStreamProfileSchema =
|
|
714
|
-
format:
|
|
715
|
-
maxFps:
|
|
723
|
+
var DevicePreviewJpegStreamProfileSchema = z11.object({
|
|
724
|
+
format: z11.literal("jpeg"),
|
|
725
|
+
maxFps: z11.number().int().min(1).max(30).optional()
|
|
716
726
|
}).strict();
|
|
717
|
-
var DevicePreviewH264StreamProfileSchema =
|
|
718
|
-
format:
|
|
727
|
+
var DevicePreviewH264StreamProfileSchema = z11.object({
|
|
728
|
+
format: z11.literal("h264_annex_b")
|
|
719
729
|
}).strict();
|
|
720
|
-
var DevicePreviewStreamProfileSchema =
|
|
730
|
+
var DevicePreviewStreamProfileSchema = z11.discriminatedUnion("format", [
|
|
721
731
|
DevicePreviewJpegStreamProfileSchema,
|
|
722
732
|
DevicePreviewH264StreamProfileSchema
|
|
723
733
|
]);
|
|
@@ -728,10 +738,10 @@ var devicePreviewStreamStopReasonValues = [
|
|
|
728
738
|
"relay_shutdown",
|
|
729
739
|
"stream_error"
|
|
730
740
|
];
|
|
731
|
-
var DevicePreviewStreamStopReasonSchema =
|
|
732
|
-
var NormalizedCoordinateSchema =
|
|
741
|
+
var DevicePreviewStreamStopReasonSchema = z11.enum(devicePreviewStreamStopReasonValues);
|
|
742
|
+
var NormalizedCoordinateSchema = z11.number().finite().min(0).max(1);
|
|
733
743
|
var devicePreviewTouchPhaseValues = ["down", "move", "up"];
|
|
734
|
-
var DevicePreviewTouchPhaseSchema =
|
|
744
|
+
var DevicePreviewTouchPhaseSchema = z11.enum(devicePreviewTouchPhaseValues);
|
|
735
745
|
var devicePreviewOrientationValues = [
|
|
736
746
|
"portrait",
|
|
737
747
|
"landscape_left",
|
|
@@ -739,102 +749,102 @@ var devicePreviewOrientationValues = [
|
|
|
739
749
|
"portrait_upside_down",
|
|
740
750
|
"auto"
|
|
741
751
|
];
|
|
742
|
-
var DevicePreviewOrientationSchema =
|
|
743
|
-
var DevicePreviewInputSchema =
|
|
744
|
-
|
|
745
|
-
kind:
|
|
752
|
+
var DevicePreviewOrientationSchema = z11.enum(devicePreviewOrientationValues);
|
|
753
|
+
var DevicePreviewInputSchema = z11.discriminatedUnion("kind", [
|
|
754
|
+
z11.object({
|
|
755
|
+
kind: z11.literal("touch"),
|
|
746
756
|
phase: DevicePreviewTouchPhaseSchema,
|
|
747
757
|
x: NormalizedCoordinateSchema,
|
|
748
758
|
y: NormalizedCoordinateSchema
|
|
749
759
|
}).strict(),
|
|
750
|
-
|
|
751
|
-
kind:
|
|
752
|
-
text:
|
|
760
|
+
z11.object({
|
|
761
|
+
kind: z11.literal("text"),
|
|
762
|
+
text: z11.string().min(1).max(DEVICE_PREVIEW_TEXT_MAX_LENGTH)
|
|
753
763
|
}).strict(),
|
|
754
|
-
|
|
755
|
-
kind:
|
|
756
|
-
button:
|
|
764
|
+
z11.object({
|
|
765
|
+
kind: z11.literal("button"),
|
|
766
|
+
button: z11.enum(["home", "back"])
|
|
757
767
|
}).strict(),
|
|
758
|
-
|
|
759
|
-
kind:
|
|
768
|
+
z11.object({
|
|
769
|
+
kind: z11.literal("orientation"),
|
|
760
770
|
orientation: DevicePreviewOrientationSchema
|
|
761
771
|
}).strict()
|
|
762
772
|
]);
|
|
763
|
-
var DevicePreviewStreamRegisterSchema =
|
|
764
|
-
type:
|
|
773
|
+
var DevicePreviewStreamRegisterSchema = z11.object({
|
|
774
|
+
type: z11.literal("device_preview_stream_register"),
|
|
765
775
|
proxyId: IdSchema,
|
|
766
776
|
connectionId: IdSchema
|
|
767
777
|
}).strict();
|
|
768
|
-
var DevicePreviewStreamRegisterResponseSchema =
|
|
769
|
-
|
|
770
|
-
type:
|
|
771
|
-
success:
|
|
778
|
+
var DevicePreviewStreamRegisterResponseSchema = z11.discriminatedUnion("success", [
|
|
779
|
+
z11.object({
|
|
780
|
+
type: z11.literal("device_preview_stream_register_response"),
|
|
781
|
+
success: z11.literal(true)
|
|
772
782
|
}).strict(),
|
|
773
|
-
|
|
774
|
-
type:
|
|
775
|
-
success:
|
|
776
|
-
error:
|
|
783
|
+
z11.object({
|
|
784
|
+
type: z11.literal("device_preview_stream_register_response"),
|
|
785
|
+
success: z11.literal(false),
|
|
786
|
+
error: z11.string().min(1).max(DEVICE_PREVIEW_ERROR_MAX_LENGTH)
|
|
777
787
|
}).strict()
|
|
778
788
|
]);
|
|
779
|
-
var DevicePreviewStreamFlowBaseSchema =
|
|
780
|
-
type:
|
|
789
|
+
var DevicePreviewStreamFlowBaseSchema = z11.object({
|
|
790
|
+
type: z11.literal("device_preview_stream_flow"),
|
|
781
791
|
streamId: IdSchema
|
|
782
792
|
});
|
|
783
|
-
var DevicePreviewStreamFlowSchema =
|
|
793
|
+
var DevicePreviewStreamFlowSchema = z11.discriminatedUnion("paused", [
|
|
784
794
|
DevicePreviewStreamFlowBaseSchema.extend({
|
|
785
|
-
paused:
|
|
786
|
-
resyncRequired:
|
|
795
|
+
paused: z11.literal(true),
|
|
796
|
+
resyncRequired: z11.literal(false)
|
|
787
797
|
}).strict(),
|
|
788
798
|
DevicePreviewStreamFlowBaseSchema.extend({
|
|
789
|
-
paused:
|
|
790
|
-
resyncRequired:
|
|
799
|
+
paused: z11.literal(false),
|
|
800
|
+
resyncRequired: z11.boolean()
|
|
791
801
|
}).strict()
|
|
792
802
|
]);
|
|
793
|
-
var DevicePreviewStreamServerMessageSchema =
|
|
803
|
+
var DevicePreviewStreamServerMessageSchema = z11.union([
|
|
794
804
|
DevicePreviewStreamRegisterResponseSchema,
|
|
795
805
|
DevicePreviewStreamFlowSchema
|
|
796
806
|
]);
|
|
797
807
|
|
|
798
808
|
// ../../packages/shared/dist/schemas/voice-stream.js
|
|
799
|
-
import { z as
|
|
800
|
-
var VoiceAsrAudioEncodingSchema =
|
|
801
|
-
var VoiceAsrStartMessageSchema =
|
|
802
|
-
type:
|
|
803
|
-
sessionId:
|
|
804
|
-
attemptId:
|
|
805
|
-
sampleRate:
|
|
809
|
+
import { z as z12 } from "zod";
|
|
810
|
+
var VoiceAsrAudioEncodingSchema = z12.enum(["pcm_s16le", "mulaw"]);
|
|
811
|
+
var VoiceAsrStartMessageSchema = z12.object({
|
|
812
|
+
type: z12.literal("start"),
|
|
813
|
+
sessionId: z12.string().min(1),
|
|
814
|
+
attemptId: z12.string().min(1),
|
|
815
|
+
sampleRate: z12.number().int().positive(),
|
|
806
816
|
encoding: VoiceAsrAudioEncodingSchema
|
|
807
817
|
});
|
|
808
|
-
var VoiceAsrStopMessageSchema =
|
|
809
|
-
type:
|
|
810
|
-
attemptId:
|
|
818
|
+
var VoiceAsrStopMessageSchema = z12.object({
|
|
819
|
+
type: z12.literal("stop"),
|
|
820
|
+
attemptId: z12.string().min(1)
|
|
811
821
|
});
|
|
812
|
-
var VoiceAsrClientMessageSchema =
|
|
822
|
+
var VoiceAsrClientMessageSchema = z12.discriminatedUnion("type", [
|
|
813
823
|
VoiceAsrStartMessageSchema,
|
|
814
824
|
VoiceAsrStopMessageSchema
|
|
815
825
|
]);
|
|
816
|
-
var VoiceAsrServerMessageSchema =
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
type:
|
|
820
|
-
attemptId:
|
|
821
|
-
encodedBytes:
|
|
822
|
-
pcmBytes:
|
|
823
|
-
chunks:
|
|
826
|
+
var VoiceAsrServerMessageSchema = z12.discriminatedUnion("type", [
|
|
827
|
+
z12.object({ type: z12.literal("ready"), attemptId: z12.string().min(1) }),
|
|
828
|
+
z12.object({
|
|
829
|
+
type: z12.literal("audio_ack"),
|
|
830
|
+
attemptId: z12.string().min(1),
|
|
831
|
+
encodedBytes: z12.number().int().nonnegative(),
|
|
832
|
+
pcmBytes: z12.number().int().nonnegative(),
|
|
833
|
+
chunks: z12.number().int().nonnegative()
|
|
824
834
|
}),
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
type:
|
|
829
|
-
attemptId:
|
|
830
|
-
code:
|
|
831
|
-
reason:
|
|
835
|
+
z12.object({ type: z12.literal("partial"), attemptId: z12.string().min(1), text: z12.string() }),
|
|
836
|
+
z12.object({ type: z12.literal("final"), attemptId: z12.string().min(1), text: z12.string() }),
|
|
837
|
+
z12.object({
|
|
838
|
+
type: z12.literal("closed"),
|
|
839
|
+
attemptId: z12.string().min(1),
|
|
840
|
+
code: z12.number().int().optional(),
|
|
841
|
+
reason: z12.string().optional()
|
|
832
842
|
}),
|
|
833
|
-
|
|
834
|
-
type:
|
|
835
|
-
attemptId:
|
|
836
|
-
error:
|
|
837
|
-
errorCode:
|
|
843
|
+
z12.object({
|
|
844
|
+
type: z12.literal("error"),
|
|
845
|
+
attemptId: z12.string().min(1),
|
|
846
|
+
error: z12.string().optional(),
|
|
847
|
+
errorCode: z12.string().optional()
|
|
838
848
|
})
|
|
839
849
|
]);
|
|
840
850
|
|
|
@@ -844,7 +854,7 @@ function serializeControl(msg) {
|
|
|
844
854
|
}
|
|
845
855
|
|
|
846
856
|
// ../../packages/shared/dist/schemas/relay-control.js
|
|
847
|
-
import { z as
|
|
857
|
+
import { z as z13 } from "zod";
|
|
848
858
|
|
|
849
859
|
// ../../packages/shared/dist/constants/relay-errors.js
|
|
850
860
|
var RelayErrorCode = {
|
|
@@ -881,95 +891,95 @@ var ControlErrorCode = {
|
|
|
881
891
|
|
|
882
892
|
// ../../packages/shared/dist/schemas/relay-control.js
|
|
883
893
|
var RELAY_CONTROL_PROTOCOL_VERSION = 1;
|
|
884
|
-
var ProxyInfoSchema =
|
|
894
|
+
var ProxyInfoSchema = z13.object({
|
|
885
895
|
proxyId: IdSchema,
|
|
886
|
-
name:
|
|
887
|
-
version:
|
|
888
|
-
online:
|
|
889
|
-
sessions:
|
|
896
|
+
name: z13.string().optional(),
|
|
897
|
+
version: z13.string().min(1).max(64),
|
|
898
|
+
online: z13.boolean(),
|
|
899
|
+
sessions: z13.array(z13.string())
|
|
890
900
|
});
|
|
891
|
-
var RelayClientInfoSchema =
|
|
901
|
+
var RelayClientInfoSchema = z13.object({
|
|
892
902
|
clientId: IdSchema,
|
|
893
903
|
proxyId: IdSchema.optional(),
|
|
894
|
-
connectedAt:
|
|
895
|
-
current:
|
|
896
|
-
userAgent:
|
|
897
|
-
platform:
|
|
898
|
-
maxTouchPoints:
|
|
899
|
-
browserName:
|
|
900
|
-
osName:
|
|
901
|
-
deviceKind:
|
|
902
|
-
remoteAddress:
|
|
904
|
+
connectedAt: z13.number().int().nonnegative(),
|
|
905
|
+
current: z13.boolean().optional(),
|
|
906
|
+
userAgent: z13.string().optional(),
|
|
907
|
+
platform: z13.string().optional(),
|
|
908
|
+
maxTouchPoints: z13.number().int().nonnegative().optional(),
|
|
909
|
+
browserName: z13.string().min(1),
|
|
910
|
+
osName: z13.string().min(1),
|
|
911
|
+
deviceKind: z13.enum(["desktop", "tablet", "phone", "unknown"]),
|
|
912
|
+
remoteAddress: z13.string().optional()
|
|
903
913
|
});
|
|
904
|
-
var AgentCliAvailabilitySchema =
|
|
905
|
-
available:
|
|
906
|
-
command:
|
|
907
|
-
error:
|
|
908
|
-
suggestions:
|
|
914
|
+
var AgentCliAvailabilitySchema = z13.object({
|
|
915
|
+
available: z13.boolean(),
|
|
916
|
+
command: z13.string().optional(),
|
|
917
|
+
error: z13.string().optional(),
|
|
918
|
+
suggestions: z13.array(z13.string()).optional()
|
|
909
919
|
});
|
|
910
|
-
var AgentCliStatusSchema =
|
|
920
|
+
var AgentCliStatusSchema = z13.object({
|
|
911
921
|
claude: AgentCliAvailabilitySchema,
|
|
912
922
|
codex: AgentCliAvailabilitySchema,
|
|
913
923
|
kimi: AgentCliAvailabilitySchema
|
|
914
924
|
});
|
|
915
|
-
var DirEntrySchema =
|
|
916
|
-
var FileTreeGroupSchema =
|
|
917
|
-
path:
|
|
918
|
-
entries:
|
|
925
|
+
var DirEntrySchema = z13.object({ name: z13.string(), isDir: z13.boolean() });
|
|
926
|
+
var FileTreeGroupSchema = z13.object({
|
|
927
|
+
path: z13.string(),
|
|
928
|
+
entries: z13.array(DirEntrySchema)
|
|
919
929
|
});
|
|
920
|
-
var CommandEntrySchema =
|
|
921
|
-
name:
|
|
922
|
-
description:
|
|
923
|
-
argumentHint:
|
|
924
|
-
source:
|
|
930
|
+
var CommandEntrySchema = z13.object({
|
|
931
|
+
name: z13.string(),
|
|
932
|
+
description: z13.string(),
|
|
933
|
+
argumentHint: z13.string().optional(),
|
|
934
|
+
source: z13.string()
|
|
925
935
|
});
|
|
926
|
-
var HistorySessionSchema =
|
|
927
|
-
id:
|
|
928
|
-
title:
|
|
929
|
-
projectDir:
|
|
930
|
-
updatedAt:
|
|
931
|
-
provider:
|
|
932
|
-
preferredMode:
|
|
936
|
+
var HistorySessionSchema = z13.object({
|
|
937
|
+
id: z13.string(),
|
|
938
|
+
title: z13.string(),
|
|
939
|
+
projectDir: z13.string(),
|
|
940
|
+
updatedAt: z13.number(),
|
|
941
|
+
provider: z13.enum(providerValues),
|
|
942
|
+
preferredMode: z13.enum(sessionModeValues).optional()
|
|
933
943
|
});
|
|
934
944
|
var SessionHistoryPositionShape = {
|
|
935
|
-
timestamp:
|
|
936
|
-
cursor:
|
|
945
|
+
timestamp: z13.number().optional(),
|
|
946
|
+
cursor: z13.string().optional()
|
|
937
947
|
};
|
|
938
|
-
var SessionHistoryMessageSchema =
|
|
939
|
-
|
|
940
|
-
role:
|
|
941
|
-
text:
|
|
948
|
+
var SessionHistoryMessageSchema = z13.discriminatedUnion("role", [
|
|
949
|
+
z13.object({
|
|
950
|
+
role: z13.enum(["user", "assistant", "system"]),
|
|
951
|
+
text: z13.string(),
|
|
942
952
|
...SessionHistoryPositionShape
|
|
943
953
|
}),
|
|
944
|
-
|
|
945
|
-
role:
|
|
946
|
-
text:
|
|
954
|
+
z13.object({
|
|
955
|
+
role: z13.literal("activity"),
|
|
956
|
+
text: z13.string(),
|
|
947
957
|
toolId: IdSchema,
|
|
948
|
-
toolName:
|
|
949
|
-
parameters:
|
|
950
|
-
status:
|
|
958
|
+
toolName: z13.string(),
|
|
959
|
+
parameters: z13.record(z13.string(), z13.unknown()).optional(),
|
|
960
|
+
status: z13.enum(["running", "done", "error"]),
|
|
951
961
|
...SessionHistoryPositionShape
|
|
952
962
|
})
|
|
953
963
|
]);
|
|
954
964
|
var RequestIdShape = { requestId: IdSchema.optional() };
|
|
955
965
|
var RequiredRequestIdShape = { requestId: IdSchema };
|
|
956
|
-
var ControlErrorCodeSchema =
|
|
966
|
+
var ControlErrorCodeSchema = z13.enum(Object.values(ControlErrorCode));
|
|
957
967
|
var RequestErrorShape = {
|
|
958
|
-
error:
|
|
968
|
+
error: z13.string().optional(),
|
|
959
969
|
errorCode: ControlErrorCodeSchema.optional()
|
|
960
970
|
};
|
|
961
971
|
var RequiredRequestErrorShape = {
|
|
962
|
-
error:
|
|
972
|
+
error: z13.string().min(1),
|
|
963
973
|
errorCode: ControlErrorCodeSchema
|
|
964
974
|
};
|
|
965
|
-
var RemoteFileDispositionSchema =
|
|
966
|
-
var RemoteFileUploadKindSchema =
|
|
975
|
+
var RemoteFileDispositionSchema = z13.enum(["inline", "download"]);
|
|
976
|
+
var RemoteFileUploadKindSchema = z13.enum(["clipboard_image", "file"]);
|
|
967
977
|
function control(type, shape, directions) {
|
|
968
978
|
return {
|
|
969
979
|
type,
|
|
970
980
|
directions: new Set(Array.isArray(directions) ? directions : directions ? [directions] : []),
|
|
971
|
-
schema:
|
|
972
|
-
type:
|
|
981
|
+
schema: z13.object({
|
|
982
|
+
type: z13.literal(type),
|
|
973
983
|
...shape ?? {}
|
|
974
984
|
})
|
|
975
985
|
};
|
|
@@ -978,8 +988,8 @@ function strictControl(type, shape, directions) {
|
|
|
978
988
|
return {
|
|
979
989
|
type,
|
|
980
990
|
directions: new Set(Array.isArray(directions) ? directions : directions ? [directions] : []),
|
|
981
|
-
schema:
|
|
982
|
-
type:
|
|
991
|
+
schema: z13.object({
|
|
992
|
+
type: z13.literal(type),
|
|
983
993
|
...shape
|
|
984
994
|
}).strict()
|
|
985
995
|
};
|
|
@@ -991,300 +1001,300 @@ function controlSchema(type, schema, directions) {
|
|
|
991
1001
|
schema
|
|
992
1002
|
};
|
|
993
1003
|
}
|
|
994
|
-
var ProxySelectResponseSchema =
|
|
995
|
-
|
|
996
|
-
type:
|
|
1004
|
+
var ProxySelectResponseSchema = z13.discriminatedUnion("success", [
|
|
1005
|
+
z13.object({
|
|
1006
|
+
type: z13.literal("proxy_select_response"),
|
|
997
1007
|
...RequestIdShape,
|
|
998
|
-
success:
|
|
1008
|
+
success: z13.literal(true),
|
|
999
1009
|
proxyId: IdSchema,
|
|
1000
1010
|
bindingId: IdSchema
|
|
1001
1011
|
}).strict(),
|
|
1002
|
-
|
|
1003
|
-
type:
|
|
1012
|
+
z13.object({
|
|
1013
|
+
type: z13.literal("proxy_select_response"),
|
|
1004
1014
|
...RequestIdShape,
|
|
1005
|
-
success:
|
|
1015
|
+
success: z13.literal(false),
|
|
1006
1016
|
...RequestErrorShape
|
|
1007
1017
|
}).strict()
|
|
1008
1018
|
]);
|
|
1009
|
-
var ClientRegisterResponseSchema =
|
|
1010
|
-
|
|
1011
|
-
type:
|
|
1012
|
-
protocolVersion:
|
|
1013
|
-
status:
|
|
1019
|
+
var ClientRegisterResponseSchema = z13.discriminatedUnion("status", [
|
|
1020
|
+
z13.object({
|
|
1021
|
+
type: z13.literal("client_register_response"),
|
|
1022
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1023
|
+
status: z13.literal("restored"),
|
|
1014
1024
|
proxyId: IdSchema,
|
|
1015
1025
|
bindingId: IdSchema
|
|
1016
1026
|
}).strict(),
|
|
1017
|
-
|
|
1018
|
-
type:
|
|
1019
|
-
protocolVersion:
|
|
1020
|
-
status:
|
|
1027
|
+
z13.object({
|
|
1028
|
+
type: z13.literal("client_register_response"),
|
|
1029
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1030
|
+
status: z13.literal("proxy_offline"),
|
|
1021
1031
|
proxyId: IdSchema,
|
|
1022
1032
|
bindingId: IdSchema
|
|
1023
1033
|
}).strict(),
|
|
1024
|
-
|
|
1025
|
-
type:
|
|
1026
|
-
protocolVersion:
|
|
1027
|
-
status:
|
|
1034
|
+
z13.object({
|
|
1035
|
+
type: z13.literal("client_register_response"),
|
|
1036
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1037
|
+
status: z13.literal("new")
|
|
1028
1038
|
}).strict()
|
|
1029
1039
|
]);
|
|
1030
|
-
var PreviewCreateResponseSchema =
|
|
1031
|
-
|
|
1032
|
-
type:
|
|
1040
|
+
var PreviewCreateResponseSchema = z13.discriminatedUnion("accepted", [
|
|
1041
|
+
z13.object({
|
|
1042
|
+
type: z13.literal("preview_create_response"),
|
|
1033
1043
|
...RequiredRequestIdShape,
|
|
1034
1044
|
scope: PreviewScopeSchema,
|
|
1035
1045
|
operationId: IdSchema,
|
|
1036
|
-
accepted:
|
|
1046
|
+
accepted: z13.literal(true),
|
|
1037
1047
|
previewId: IdSchema
|
|
1038
1048
|
}).strict(),
|
|
1039
|
-
|
|
1040
|
-
type:
|
|
1049
|
+
z13.object({
|
|
1050
|
+
type: z13.literal("preview_create_response"),
|
|
1041
1051
|
...RequiredRequestIdShape,
|
|
1042
1052
|
scope: PreviewScopeSchema,
|
|
1043
1053
|
operationId: IdSchema,
|
|
1044
|
-
accepted:
|
|
1054
|
+
accepted: z13.literal(false),
|
|
1045
1055
|
...RequiredRequestErrorShape
|
|
1046
1056
|
}).strict()
|
|
1047
1057
|
]);
|
|
1048
|
-
var DevicePreviewCreateResponseSchema =
|
|
1049
|
-
|
|
1050
|
-
type:
|
|
1058
|
+
var DevicePreviewCreateResponseSchema = z13.discriminatedUnion("accepted", [
|
|
1059
|
+
z13.object({
|
|
1060
|
+
type: z13.literal("device_preview_create_response"),
|
|
1051
1061
|
...RequiredRequestIdShape,
|
|
1052
1062
|
scope: PreviewScopeSchema,
|
|
1053
1063
|
operationId: IdSchema,
|
|
1054
|
-
accepted:
|
|
1064
|
+
accepted: z13.literal(true),
|
|
1055
1065
|
previewId: IdSchema
|
|
1056
1066
|
}).strict(),
|
|
1057
|
-
|
|
1058
|
-
type:
|
|
1067
|
+
z13.object({
|
|
1068
|
+
type: z13.literal("device_preview_create_response"),
|
|
1059
1069
|
...RequiredRequestIdShape,
|
|
1060
1070
|
scope: PreviewScopeSchema,
|
|
1061
1071
|
operationId: IdSchema,
|
|
1062
|
-
accepted:
|
|
1072
|
+
accepted: z13.literal(false),
|
|
1063
1073
|
...RequiredRequestErrorShape
|
|
1064
1074
|
}).strict()
|
|
1065
1075
|
]);
|
|
1066
|
-
var PreviewCapabilityResponseSchema =
|
|
1067
|
-
|
|
1068
|
-
type:
|
|
1076
|
+
var PreviewCapabilityResponseSchema = z13.discriminatedUnion("success", [
|
|
1077
|
+
z13.object({
|
|
1078
|
+
type: z13.literal("preview_capability_response"),
|
|
1069
1079
|
...RequiredRequestIdShape,
|
|
1070
1080
|
scope: PreviewScopeSchema,
|
|
1071
|
-
success:
|
|
1081
|
+
success: z13.literal(true),
|
|
1072
1082
|
capability: WebPreviewCapabilitySchema
|
|
1073
1083
|
}).strict(),
|
|
1074
|
-
|
|
1075
|
-
type:
|
|
1084
|
+
z13.object({
|
|
1085
|
+
type: z13.literal("preview_capability_response"),
|
|
1076
1086
|
...RequiredRequestIdShape,
|
|
1077
1087
|
scope: PreviewScopeSchema,
|
|
1078
|
-
success:
|
|
1088
|
+
success: z13.literal(false),
|
|
1079
1089
|
...RequiredRequestErrorShape
|
|
1080
1090
|
}).strict()
|
|
1081
1091
|
]);
|
|
1082
|
-
var DevicePreviewCapabilityResponseSchema =
|
|
1083
|
-
|
|
1084
|
-
type:
|
|
1092
|
+
var DevicePreviewCapabilityResponseSchema = z13.discriminatedUnion("success", [
|
|
1093
|
+
z13.object({
|
|
1094
|
+
type: z13.literal("device_preview_capability_response"),
|
|
1085
1095
|
...RequiredRequestIdShape,
|
|
1086
1096
|
scope: PreviewScopeSchema,
|
|
1087
|
-
success:
|
|
1097
|
+
success: z13.literal(true),
|
|
1088
1098
|
capability: DevicePreviewCapabilitySchema
|
|
1089
1099
|
}).strict(),
|
|
1090
|
-
|
|
1091
|
-
type:
|
|
1100
|
+
z13.object({
|
|
1101
|
+
type: z13.literal("device_preview_capability_response"),
|
|
1092
1102
|
...RequiredRequestIdShape,
|
|
1093
1103
|
scope: PreviewScopeSchema,
|
|
1094
|
-
success:
|
|
1104
|
+
success: z13.literal(false),
|
|
1095
1105
|
...RequiredRequestErrorShape
|
|
1096
1106
|
}).strict()
|
|
1097
1107
|
]);
|
|
1098
|
-
var ProxyInfoRequestSchema =
|
|
1099
|
-
type:
|
|
1108
|
+
var ProxyInfoRequestSchema = z13.object({
|
|
1109
|
+
type: z13.literal("proxy_info_request"),
|
|
1100
1110
|
...RequestIdShape
|
|
1101
1111
|
}).strict();
|
|
1102
|
-
var ProxyInfoResponseSchema =
|
|
1103
|
-
type:
|
|
1112
|
+
var ProxyInfoResponseSchema = z13.object({
|
|
1113
|
+
type: z13.literal("proxy_info"),
|
|
1104
1114
|
...RequestIdShape,
|
|
1105
|
-
homePath:
|
|
1115
|
+
homePath: z13.string(),
|
|
1106
1116
|
agentCli: AgentCliStatusSchema
|
|
1107
1117
|
}).strict();
|
|
1108
|
-
var PreviewStaticInspectResponseSchema =
|
|
1109
|
-
|
|
1110
|
-
type:
|
|
1118
|
+
var PreviewStaticInspectResponseSchema = z13.discriminatedUnion("success", [
|
|
1119
|
+
z13.object({
|
|
1120
|
+
type: z13.literal("preview_static_inspect_response"),
|
|
1111
1121
|
...RequiredRequestIdShape,
|
|
1112
1122
|
scope: PreviewScopeSchema,
|
|
1113
|
-
success:
|
|
1123
|
+
success: z13.literal(true),
|
|
1114
1124
|
entryPath: WebPreviewPathSchema.optional(),
|
|
1115
1125
|
htmlEntries: PreviewHtmlEntriesSchema
|
|
1116
1126
|
}).strict(),
|
|
1117
|
-
|
|
1118
|
-
type:
|
|
1127
|
+
z13.object({
|
|
1128
|
+
type: z13.literal("preview_static_inspect_response"),
|
|
1119
1129
|
...RequiredRequestIdShape,
|
|
1120
1130
|
scope: PreviewScopeSchema,
|
|
1121
|
-
success:
|
|
1131
|
+
success: z13.literal(false),
|
|
1122
1132
|
...RequiredRequestErrorShape
|
|
1123
1133
|
}).strict()
|
|
1124
1134
|
]);
|
|
1125
|
-
var PreviewRenameResponseSchema =
|
|
1126
|
-
|
|
1127
|
-
type:
|
|
1135
|
+
var PreviewRenameResponseSchema = z13.discriminatedUnion("success", [
|
|
1136
|
+
z13.object({
|
|
1137
|
+
type: z13.literal("preview_rename_response"),
|
|
1128
1138
|
...RequiredRequestIdShape,
|
|
1129
1139
|
scope: PreviewScopeSchema,
|
|
1130
1140
|
operationId: IdSchema,
|
|
1131
1141
|
previewId: IdSchema,
|
|
1132
|
-
success:
|
|
1142
|
+
success: z13.literal(true)
|
|
1133
1143
|
}).strict(),
|
|
1134
|
-
|
|
1135
|
-
type:
|
|
1144
|
+
z13.object({
|
|
1145
|
+
type: z13.literal("preview_rename_response"),
|
|
1136
1146
|
...RequiredRequestIdShape,
|
|
1137
1147
|
scope: PreviewScopeSchema,
|
|
1138
1148
|
operationId: IdSchema,
|
|
1139
1149
|
previewId: IdSchema,
|
|
1140
|
-
success:
|
|
1150
|
+
success: z13.literal(false),
|
|
1141
1151
|
...RequiredRequestErrorShape
|
|
1142
1152
|
}).strict()
|
|
1143
1153
|
]);
|
|
1144
|
-
var PreviewReconnectResponseSchema =
|
|
1145
|
-
|
|
1146
|
-
type:
|
|
1154
|
+
var PreviewReconnectResponseSchema = z13.discriminatedUnion("success", [
|
|
1155
|
+
z13.object({
|
|
1156
|
+
type: z13.literal("preview_reconnect_response"),
|
|
1147
1157
|
...RequiredRequestIdShape,
|
|
1148
1158
|
scope: PreviewScopeSchema,
|
|
1149
1159
|
operationId: IdSchema,
|
|
1150
1160
|
previewId: IdSchema,
|
|
1151
|
-
success:
|
|
1161
|
+
success: z13.literal(true)
|
|
1152
1162
|
}).strict(),
|
|
1153
|
-
|
|
1154
|
-
type:
|
|
1163
|
+
z13.object({
|
|
1164
|
+
type: z13.literal("preview_reconnect_response"),
|
|
1155
1165
|
...RequiredRequestIdShape,
|
|
1156
1166
|
scope: PreviewScopeSchema,
|
|
1157
1167
|
operationId: IdSchema,
|
|
1158
1168
|
previewId: IdSchema,
|
|
1159
|
-
success:
|
|
1169
|
+
success: z13.literal(false),
|
|
1160
1170
|
...RequiredRequestErrorShape
|
|
1161
1171
|
}).strict()
|
|
1162
1172
|
]);
|
|
1163
|
-
var PreviewCloseResponseSchema =
|
|
1164
|
-
|
|
1165
|
-
type:
|
|
1173
|
+
var PreviewCloseResponseSchema = z13.discriminatedUnion("success", [
|
|
1174
|
+
z13.object({
|
|
1175
|
+
type: z13.literal("preview_close_response"),
|
|
1166
1176
|
...RequiredRequestIdShape,
|
|
1167
1177
|
scope: PreviewScopeSchema,
|
|
1168
1178
|
operationId: IdSchema,
|
|
1169
1179
|
previewId: IdSchema,
|
|
1170
|
-
success:
|
|
1180
|
+
success: z13.literal(true)
|
|
1171
1181
|
}).strict(),
|
|
1172
|
-
|
|
1173
|
-
type:
|
|
1182
|
+
z13.object({
|
|
1183
|
+
type: z13.literal("preview_close_response"),
|
|
1174
1184
|
...RequiredRequestIdShape,
|
|
1175
1185
|
scope: PreviewScopeSchema,
|
|
1176
1186
|
operationId: IdSchema,
|
|
1177
1187
|
previewId: IdSchema,
|
|
1178
|
-
success:
|
|
1188
|
+
success: z13.literal(false),
|
|
1179
1189
|
...RequiredRequestErrorShape
|
|
1180
1190
|
}).strict()
|
|
1181
1191
|
]);
|
|
1182
|
-
var DevicePreviewTargetsResponseSchema =
|
|
1183
|
-
|
|
1184
|
-
type:
|
|
1192
|
+
var DevicePreviewTargetsResponseSchema = z13.discriminatedUnion("success", [
|
|
1193
|
+
z13.object({
|
|
1194
|
+
type: z13.literal("device_preview_targets_response"),
|
|
1185
1195
|
...RequiredRequestIdShape,
|
|
1186
1196
|
scope: PreviewScopeSchema,
|
|
1187
|
-
success:
|
|
1188
|
-
targets:
|
|
1197
|
+
success: z13.literal(true),
|
|
1198
|
+
targets: z13.array(DevicePreviewTargetSchema).max(1024)
|
|
1189
1199
|
}).strict(),
|
|
1190
|
-
|
|
1191
|
-
type:
|
|
1200
|
+
z13.object({
|
|
1201
|
+
type: z13.literal("device_preview_targets_response"),
|
|
1192
1202
|
...RequiredRequestIdShape,
|
|
1193
1203
|
scope: PreviewScopeSchema,
|
|
1194
|
-
success:
|
|
1204
|
+
success: z13.literal(false),
|
|
1195
1205
|
...RequiredRequestErrorShape
|
|
1196
1206
|
}).strict()
|
|
1197
1207
|
]);
|
|
1198
|
-
var DevicePreviewRenameResponseSchema =
|
|
1199
|
-
|
|
1200
|
-
type:
|
|
1208
|
+
var DevicePreviewRenameResponseSchema = z13.discriminatedUnion("success", [
|
|
1209
|
+
z13.object({
|
|
1210
|
+
type: z13.literal("device_preview_rename_response"),
|
|
1201
1211
|
...RequiredRequestIdShape,
|
|
1202
1212
|
scope: PreviewScopeSchema,
|
|
1203
1213
|
operationId: IdSchema,
|
|
1204
1214
|
previewId: IdSchema,
|
|
1205
|
-
success:
|
|
1215
|
+
success: z13.literal(true)
|
|
1206
1216
|
}).strict(),
|
|
1207
|
-
|
|
1208
|
-
type:
|
|
1217
|
+
z13.object({
|
|
1218
|
+
type: z13.literal("device_preview_rename_response"),
|
|
1209
1219
|
...RequiredRequestIdShape,
|
|
1210
1220
|
scope: PreviewScopeSchema,
|
|
1211
1221
|
operationId: IdSchema,
|
|
1212
1222
|
previewId: IdSchema,
|
|
1213
|
-
success:
|
|
1223
|
+
success: z13.literal(false),
|
|
1214
1224
|
...RequiredRequestErrorShape
|
|
1215
1225
|
}).strict()
|
|
1216
1226
|
]);
|
|
1217
|
-
var DevicePreviewReconnectResponseSchema =
|
|
1218
|
-
|
|
1219
|
-
type:
|
|
1227
|
+
var DevicePreviewReconnectResponseSchema = z13.discriminatedUnion("success", [
|
|
1228
|
+
z13.object({
|
|
1229
|
+
type: z13.literal("device_preview_reconnect_response"),
|
|
1220
1230
|
...RequiredRequestIdShape,
|
|
1221
1231
|
scope: PreviewScopeSchema,
|
|
1222
1232
|
operationId: IdSchema,
|
|
1223
1233
|
previewId: IdSchema,
|
|
1224
|
-
success:
|
|
1234
|
+
success: z13.literal(true)
|
|
1225
1235
|
}).strict(),
|
|
1226
|
-
|
|
1227
|
-
type:
|
|
1236
|
+
z13.object({
|
|
1237
|
+
type: z13.literal("device_preview_reconnect_response"),
|
|
1228
1238
|
...RequiredRequestIdShape,
|
|
1229
1239
|
scope: PreviewScopeSchema,
|
|
1230
1240
|
operationId: IdSchema,
|
|
1231
1241
|
previewId: IdSchema,
|
|
1232
|
-
success:
|
|
1242
|
+
success: z13.literal(false),
|
|
1233
1243
|
...RequiredRequestErrorShape
|
|
1234
1244
|
}).strict()
|
|
1235
1245
|
]);
|
|
1236
|
-
var DevicePreviewCloseResponseSchema =
|
|
1237
|
-
|
|
1238
|
-
type:
|
|
1246
|
+
var DevicePreviewCloseResponseSchema = z13.discriminatedUnion("success", [
|
|
1247
|
+
z13.object({
|
|
1248
|
+
type: z13.literal("device_preview_close_response"),
|
|
1239
1249
|
...RequiredRequestIdShape,
|
|
1240
1250
|
scope: PreviewScopeSchema,
|
|
1241
1251
|
operationId: IdSchema,
|
|
1242
1252
|
previewId: IdSchema,
|
|
1243
|
-
success:
|
|
1253
|
+
success: z13.literal(true)
|
|
1244
1254
|
}).strict(),
|
|
1245
|
-
|
|
1246
|
-
type:
|
|
1255
|
+
z13.object({
|
|
1256
|
+
type: z13.literal("device_preview_close_response"),
|
|
1247
1257
|
...RequiredRequestIdShape,
|
|
1248
1258
|
scope: PreviewScopeSchema,
|
|
1249
1259
|
operationId: IdSchema,
|
|
1250
1260
|
previewId: IdSchema,
|
|
1251
|
-
success:
|
|
1261
|
+
success: z13.literal(false),
|
|
1252
1262
|
...RequiredRequestErrorShape
|
|
1253
1263
|
}).strict()
|
|
1254
1264
|
]);
|
|
1255
|
-
var DevicePreviewStreamUrlResponseSchema =
|
|
1256
|
-
|
|
1257
|
-
type:
|
|
1265
|
+
var DevicePreviewStreamUrlResponseSchema = z13.discriminatedUnion("success", [
|
|
1266
|
+
z13.object({
|
|
1267
|
+
type: z13.literal("device_preview_stream_url_response"),
|
|
1258
1268
|
...RequiredRequestIdShape,
|
|
1259
1269
|
scope: PreviewScopeSchema,
|
|
1260
1270
|
previewId: IdSchema,
|
|
1261
|
-
success:
|
|
1262
|
-
url:
|
|
1271
|
+
success: z13.literal(true),
|
|
1272
|
+
url: z13.string().min(1).max(4096),
|
|
1263
1273
|
leaseId: IdSchema,
|
|
1264
|
-
expiresAt:
|
|
1265
|
-
controlMode:
|
|
1274
|
+
expiresAt: z13.number().int().nonnegative(),
|
|
1275
|
+
controlMode: z13.enum(["controller", "view_only"])
|
|
1266
1276
|
}).strict(),
|
|
1267
|
-
|
|
1268
|
-
type:
|
|
1277
|
+
z13.object({
|
|
1278
|
+
type: z13.literal("device_preview_stream_url_response"),
|
|
1269
1279
|
...RequiredRequestIdShape,
|
|
1270
1280
|
scope: PreviewScopeSchema,
|
|
1271
1281
|
previewId: IdSchema,
|
|
1272
|
-
success:
|
|
1282
|
+
success: z13.literal(false),
|
|
1273
1283
|
...RequiredRequestErrorShape
|
|
1274
1284
|
}).strict()
|
|
1275
1285
|
]);
|
|
1276
1286
|
var DevicePreviewStreamStartResponseBaseShape = {
|
|
1277
|
-
type:
|
|
1287
|
+
type: z13.literal("device_preview_stream_start_response"),
|
|
1278
1288
|
streamId: IdSchema,
|
|
1279
1289
|
leaseId: IdSchema,
|
|
1280
1290
|
previewId: IdSchema
|
|
1281
1291
|
};
|
|
1282
|
-
var DevicePreviewStreamStartSuccessSchema =
|
|
1292
|
+
var DevicePreviewStreamStartSuccessSchema = z13.object({
|
|
1283
1293
|
...DevicePreviewStreamStartResponseBaseShape,
|
|
1284
|
-
success:
|
|
1294
|
+
success: z13.literal(true),
|
|
1285
1295
|
format: DevicePreviewStreamFormatSchema,
|
|
1286
|
-
width:
|
|
1287
|
-
height:
|
|
1296
|
+
width: z13.number().int().positive().max(16384).optional(),
|
|
1297
|
+
height: z13.number().int().positive().max(16384).optional()
|
|
1288
1298
|
}).strict().superRefine((response, context) => {
|
|
1289
1299
|
if (response.width === void 0 === (response.height === void 0))
|
|
1290
1300
|
return;
|
|
@@ -1294,74 +1304,74 @@ var DevicePreviewStreamStartSuccessSchema = z12.object({
|
|
|
1294
1304
|
message: "Device preview stream dimensions must include both width and height"
|
|
1295
1305
|
});
|
|
1296
1306
|
});
|
|
1297
|
-
var DevicePreviewStreamStartResponseSchema =
|
|
1307
|
+
var DevicePreviewStreamStartResponseSchema = z13.discriminatedUnion("success", [
|
|
1298
1308
|
DevicePreviewStreamStartSuccessSchema,
|
|
1299
|
-
|
|
1309
|
+
z13.object({
|
|
1300
1310
|
...DevicePreviewStreamStartResponseBaseShape,
|
|
1301
|
-
success:
|
|
1311
|
+
success: z13.literal(false),
|
|
1302
1312
|
...RequiredRequestErrorShape
|
|
1303
1313
|
}).strict()
|
|
1304
1314
|
]);
|
|
1305
|
-
var DevicePreviewStreamCompleteSchema =
|
|
1306
|
-
type:
|
|
1315
|
+
var DevicePreviewStreamCompleteSchema = z13.object({
|
|
1316
|
+
type: z13.literal("device_preview_stream_complete"),
|
|
1307
1317
|
streamId: IdSchema,
|
|
1308
1318
|
leaseId: IdSchema,
|
|
1309
1319
|
previewId: IdSchema,
|
|
1310
|
-
success:
|
|
1311
|
-
error:
|
|
1320
|
+
success: z13.literal(false),
|
|
1321
|
+
error: z13.string().min(1)
|
|
1312
1322
|
}).strict();
|
|
1313
1323
|
var DevicePreviewStreamStartBaseShape = {
|
|
1314
|
-
type:
|
|
1324
|
+
type: z13.literal("device_preview_stream_start"),
|
|
1315
1325
|
streamId: IdSchema,
|
|
1316
1326
|
leaseId: IdSchema,
|
|
1317
1327
|
previewId: IdSchema
|
|
1318
1328
|
};
|
|
1319
|
-
var DevicePreviewStreamStartSchema =
|
|
1320
|
-
|
|
1329
|
+
var DevicePreviewStreamStartSchema = z13.discriminatedUnion("format", [
|
|
1330
|
+
z13.object({
|
|
1321
1331
|
...DevicePreviewStreamStartBaseShape,
|
|
1322
1332
|
...DevicePreviewJpegStreamProfileSchema.shape
|
|
1323
1333
|
}).strict(),
|
|
1324
|
-
|
|
1334
|
+
z13.object({
|
|
1325
1335
|
...DevicePreviewStreamStartBaseShape,
|
|
1326
1336
|
...DevicePreviewH264StreamProfileSchema.shape
|
|
1327
1337
|
}).strict()
|
|
1328
1338
|
]);
|
|
1329
|
-
var DevicePreviewInputAckSchema =
|
|
1330
|
-
|
|
1331
|
-
type:
|
|
1339
|
+
var DevicePreviewInputAckSchema = z13.discriminatedUnion("success", [
|
|
1340
|
+
z13.object({
|
|
1341
|
+
type: z13.literal("device_preview_input_ack"),
|
|
1332
1342
|
scope: PreviewScopeSchema,
|
|
1333
1343
|
leaseId: IdSchema,
|
|
1334
|
-
inputSeq:
|
|
1335
|
-
success:
|
|
1344
|
+
inputSeq: z13.number().int().min(0).max(4294967295),
|
|
1345
|
+
success: z13.literal(true)
|
|
1336
1346
|
}).strict(),
|
|
1337
|
-
|
|
1338
|
-
type:
|
|
1347
|
+
z13.object({
|
|
1348
|
+
type: z13.literal("device_preview_input_ack"),
|
|
1339
1349
|
scope: PreviewScopeSchema,
|
|
1340
1350
|
leaseId: IdSchema,
|
|
1341
|
-
inputSeq:
|
|
1342
|
-
success:
|
|
1351
|
+
inputSeq: z13.number().int().min(0).max(4294967295),
|
|
1352
|
+
success: z13.literal(false),
|
|
1343
1353
|
...RequiredRequestErrorShape
|
|
1344
1354
|
}).strict()
|
|
1345
1355
|
]);
|
|
1346
|
-
var DevicePreviewControlClaimResponseSchema =
|
|
1347
|
-
|
|
1348
|
-
type:
|
|
1356
|
+
var DevicePreviewControlClaimResponseSchema = z13.discriminatedUnion("success", [
|
|
1357
|
+
z13.object({
|
|
1358
|
+
type: z13.literal("device_preview_control_claim_response"),
|
|
1349
1359
|
...RequiredRequestIdShape,
|
|
1350
1360
|
scope: PreviewScopeSchema,
|
|
1351
1361
|
leaseId: IdSchema,
|
|
1352
|
-
success:
|
|
1353
|
-
controlMode:
|
|
1362
|
+
success: z13.literal(true),
|
|
1363
|
+
controlMode: z13.literal("controller")
|
|
1354
1364
|
}).strict(),
|
|
1355
|
-
|
|
1356
|
-
type:
|
|
1365
|
+
z13.object({
|
|
1366
|
+
type: z13.literal("device_preview_control_claim_response"),
|
|
1357
1367
|
...RequiredRequestIdShape,
|
|
1358
1368
|
scope: PreviewScopeSchema,
|
|
1359
1369
|
leaseId: IdSchema,
|
|
1360
|
-
success:
|
|
1370
|
+
success: z13.literal(false),
|
|
1361
1371
|
...RequiredRequestErrorShape
|
|
1362
1372
|
}).strict()
|
|
1363
1373
|
]);
|
|
1364
|
-
var SessionPermissionModeSchema =
|
|
1374
|
+
var SessionPermissionModeSchema = z13.enum([
|
|
1365
1375
|
"default",
|
|
1366
1376
|
"auto",
|
|
1367
1377
|
"acceptEdits",
|
|
@@ -1369,98 +1379,98 @@ var SessionPermissionModeSchema = z12.enum([
|
|
|
1369
1379
|
"bypassPermissions",
|
|
1370
1380
|
"dontAsk"
|
|
1371
1381
|
]);
|
|
1372
|
-
var AgentJsonSessionCreateSchema =
|
|
1373
|
-
type:
|
|
1382
|
+
var AgentJsonSessionCreateSchema = z13.object({
|
|
1383
|
+
type: z13.literal("session_create"),
|
|
1374
1384
|
...RequiredRequestIdShape,
|
|
1375
|
-
kind:
|
|
1376
|
-
cwd:
|
|
1377
|
-
name:
|
|
1378
|
-
provider:
|
|
1379
|
-
mode:
|
|
1380
|
-
resumeSessionId:
|
|
1385
|
+
kind: z13.literal("agent"),
|
|
1386
|
+
cwd: z13.string(),
|
|
1387
|
+
name: z13.string().optional(),
|
|
1388
|
+
provider: z13.enum(providerValues),
|
|
1389
|
+
mode: z13.literal("json"),
|
|
1390
|
+
resumeSessionId: z13.string().optional(),
|
|
1381
1391
|
permissionMode: SessionPermissionModeSchema.optional()
|
|
1382
1392
|
}).strict();
|
|
1383
|
-
var AgentPtySessionCreateSchema =
|
|
1384
|
-
type:
|
|
1393
|
+
var AgentPtySessionCreateSchema = z13.object({
|
|
1394
|
+
type: z13.literal("session_create"),
|
|
1385
1395
|
...RequiredRequestIdShape,
|
|
1386
|
-
kind:
|
|
1387
|
-
cwd:
|
|
1388
|
-
name:
|
|
1389
|
-
provider:
|
|
1390
|
-
mode:
|
|
1391
|
-
resumeSessionId:
|
|
1392
|
-
cols:
|
|
1393
|
-
rows:
|
|
1396
|
+
kind: z13.literal("agent"),
|
|
1397
|
+
cwd: z13.string(),
|
|
1398
|
+
name: z13.string().optional(),
|
|
1399
|
+
provider: z13.enum(providerValues),
|
|
1400
|
+
mode: z13.literal("pty"),
|
|
1401
|
+
resumeSessionId: z13.string().optional(),
|
|
1402
|
+
cols: z13.number().int().positive().max(PTY_INITIAL_MAX_COLS),
|
|
1403
|
+
rows: z13.number().int().positive().max(PTY_INITIAL_MAX_ROWS),
|
|
1394
1404
|
permissionMode: SessionPermissionModeSchema.optional()
|
|
1395
1405
|
}).strict();
|
|
1396
|
-
var TerminalSessionCreateSchema =
|
|
1397
|
-
type:
|
|
1406
|
+
var TerminalSessionCreateSchema = z13.object({
|
|
1407
|
+
type: z13.literal("session_create"),
|
|
1398
1408
|
...RequiredRequestIdShape,
|
|
1399
|
-
kind:
|
|
1400
|
-
name:
|
|
1401
|
-
mode:
|
|
1402
|
-
cols:
|
|
1403
|
-
rows:
|
|
1409
|
+
kind: z13.literal("terminal"),
|
|
1410
|
+
name: z13.string().optional(),
|
|
1411
|
+
mode: z13.literal("pty"),
|
|
1412
|
+
cols: z13.number().int().positive().max(PTY_INITIAL_MAX_COLS),
|
|
1413
|
+
rows: z13.number().int().positive().max(PTY_INITIAL_MAX_ROWS)
|
|
1404
1414
|
}).strict();
|
|
1405
|
-
var SessionCreateSchema =
|
|
1415
|
+
var SessionCreateSchema = z13.discriminatedUnion("mode", [
|
|
1406
1416
|
AgentJsonSessionCreateSchema,
|
|
1407
|
-
|
|
1417
|
+
z13.discriminatedUnion("kind", [AgentPtySessionCreateSchema, TerminalSessionCreateSchema])
|
|
1408
1418
|
]);
|
|
1409
1419
|
var SessionCreateSuccessBaseShape = {
|
|
1410
|
-
type:
|
|
1420
|
+
type: z13.literal("session_create_response"),
|
|
1411
1421
|
...RequiredRequestIdShape,
|
|
1412
|
-
success:
|
|
1422
|
+
success: z13.literal(true),
|
|
1413
1423
|
sessionId: IdSchema,
|
|
1414
|
-
cwd:
|
|
1415
|
-
lastActive:
|
|
1416
|
-
name:
|
|
1417
|
-
nameLocked:
|
|
1424
|
+
cwd: z13.string(),
|
|
1425
|
+
lastActive: z13.number(),
|
|
1426
|
+
name: z13.string().optional(),
|
|
1427
|
+
nameLocked: z13.boolean().optional()
|
|
1418
1428
|
};
|
|
1419
|
-
var SessionCreateSuccessResponseSchema =
|
|
1420
|
-
|
|
1429
|
+
var SessionCreateSuccessResponseSchema = z13.discriminatedUnion("mode", [
|
|
1430
|
+
z13.object({
|
|
1421
1431
|
...SessionCreateSuccessBaseShape,
|
|
1422
|
-
kind:
|
|
1423
|
-
mode:
|
|
1424
|
-
provider:
|
|
1432
|
+
kind: z13.literal("agent"),
|
|
1433
|
+
mode: z13.literal("json"),
|
|
1434
|
+
provider: z13.enum(providerValues)
|
|
1425
1435
|
}).strict(),
|
|
1426
|
-
|
|
1427
|
-
|
|
1436
|
+
z13.discriminatedUnion("kind", [
|
|
1437
|
+
z13.object({
|
|
1428
1438
|
...SessionCreateSuccessBaseShape,
|
|
1429
|
-
kind:
|
|
1430
|
-
mode:
|
|
1431
|
-
provider:
|
|
1432
|
-
ptyOwner:
|
|
1439
|
+
kind: z13.literal("agent"),
|
|
1440
|
+
mode: z13.literal("pty"),
|
|
1441
|
+
provider: z13.enum(providerValues),
|
|
1442
|
+
ptyOwner: z13.enum(ptyOwnerValues)
|
|
1433
1443
|
}).strict(),
|
|
1434
|
-
|
|
1444
|
+
z13.object({
|
|
1435
1445
|
...SessionCreateSuccessBaseShape,
|
|
1436
|
-
kind:
|
|
1437
|
-
mode:
|
|
1438
|
-
provider:
|
|
1439
|
-
ptyOwner:
|
|
1446
|
+
kind: z13.literal("terminal"),
|
|
1447
|
+
mode: z13.literal("pty"),
|
|
1448
|
+
provider: z13.literal("claude"),
|
|
1449
|
+
ptyOwner: z13.literal("local-terminal")
|
|
1440
1450
|
}).strict()
|
|
1441
1451
|
])
|
|
1442
1452
|
]);
|
|
1443
|
-
var SessionCreateResponseSchema =
|
|
1453
|
+
var SessionCreateResponseSchema = z13.discriminatedUnion("success", [
|
|
1444
1454
|
SessionCreateSuccessResponseSchema,
|
|
1445
|
-
|
|
1446
|
-
type:
|
|
1455
|
+
z13.object({
|
|
1456
|
+
type: z13.literal("session_create_response"),
|
|
1447
1457
|
...RequiredRequestIdShape,
|
|
1448
|
-
success:
|
|
1458
|
+
success: z13.literal(false),
|
|
1449
1459
|
...RequiredRequestErrorShape,
|
|
1450
|
-
activeWriterPid:
|
|
1460
|
+
activeWriterPid: z13.number().int().positive().optional()
|
|
1451
1461
|
}).strict()
|
|
1452
1462
|
]);
|
|
1453
1463
|
var relayControlDefinitions = [
|
|
1454
1464
|
strictControl("proxy_register", {
|
|
1455
|
-
protocolVersion:
|
|
1465
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1456
1466
|
proxyId: IdSchema,
|
|
1457
|
-
name:
|
|
1458
|
-
proxyVersion:
|
|
1467
|
+
name: z13.string().optional(),
|
|
1468
|
+
proxyVersion: z13.string().min(1).max(64)
|
|
1459
1469
|
}),
|
|
1460
1470
|
strictControl("proxy_register_response", {
|
|
1461
|
-
protocolVersion:
|
|
1462
|
-
status:
|
|
1463
|
-
relayVersion:
|
|
1471
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1472
|
+
status: z13.enum(["new", "reconnected"]),
|
|
1473
|
+
relayVersion: z13.string().min(1).max(64),
|
|
1464
1474
|
// Relay rotates this nonce for every successful main Proxy registration. The dedicated image
|
|
1465
1475
|
// stream socket must present it before Relay accepts frames, so a superseded Proxy connection
|
|
1466
1476
|
// cannot keep publishing into a newly registered Proxy with the same persistent proxyId.
|
|
@@ -1469,7 +1479,7 @@ var relayControlDefinitions = [
|
|
|
1469
1479
|
control("proxy_list_request", RequestIdShape),
|
|
1470
1480
|
control("proxy_list_response", {
|
|
1471
1481
|
...RequestIdShape,
|
|
1472
|
-
proxies:
|
|
1482
|
+
proxies: z13.array(ProxyInfoSchema)
|
|
1473
1483
|
}),
|
|
1474
1484
|
control("proxy_remove", {
|
|
1475
1485
|
...RequiredRequestIdShape,
|
|
@@ -1478,74 +1488,74 @@ var relayControlDefinitions = [
|
|
|
1478
1488
|
control("proxy_remove_response", {
|
|
1479
1489
|
...RequiredRequestIdShape,
|
|
1480
1490
|
proxyId: IdSchema,
|
|
1481
|
-
success:
|
|
1491
|
+
success: z13.boolean(),
|
|
1482
1492
|
...RequestErrorShape
|
|
1483
1493
|
}),
|
|
1484
1494
|
control("relay_client_list_request", RequestIdShape),
|
|
1485
1495
|
control("relay_client_list_response", {
|
|
1486
1496
|
...RequestIdShape,
|
|
1487
|
-
clients:
|
|
1497
|
+
clients: z13.array(RelayClientInfoSchema)
|
|
1488
1498
|
}),
|
|
1489
1499
|
control("relay_client_kick", { ...RequiredRequestIdShape, clientId: IdSchema }),
|
|
1490
1500
|
control("relay_client_kick_response", {
|
|
1491
1501
|
...RequiredRequestIdShape,
|
|
1492
1502
|
clientId: IdSchema,
|
|
1493
|
-
success:
|
|
1503
|
+
success: z13.boolean(),
|
|
1494
1504
|
...RequestErrorShape
|
|
1495
1505
|
}),
|
|
1496
1506
|
control("relay_client_kicked", {
|
|
1497
|
-
reason:
|
|
1507
|
+
reason: z13.string().optional()
|
|
1498
1508
|
}),
|
|
1499
1509
|
control("remote_file_url_request", {
|
|
1500
1510
|
...RequiredRequestIdShape,
|
|
1501
1511
|
sessionId: IdSchema,
|
|
1502
|
-
path:
|
|
1512
|
+
path: z13.string().min(1),
|
|
1503
1513
|
disposition: RemoteFileDispositionSchema
|
|
1504
1514
|
}),
|
|
1505
1515
|
control("remote_file_url_response", {
|
|
1506
1516
|
...RequiredRequestIdShape,
|
|
1507
1517
|
...RequestErrorShape,
|
|
1508
1518
|
sessionId: IdSchema,
|
|
1509
|
-
path:
|
|
1510
|
-
success:
|
|
1511
|
-
url:
|
|
1512
|
-
expiresAt:
|
|
1519
|
+
path: z13.string().optional(),
|
|
1520
|
+
success: z13.boolean(),
|
|
1521
|
+
url: z13.string().optional(),
|
|
1522
|
+
expiresAt: z13.number().int().nonnegative().optional()
|
|
1513
1523
|
}),
|
|
1514
1524
|
control("remote_file_metadata_request", {
|
|
1515
1525
|
...RequiredRequestIdShape,
|
|
1516
1526
|
sessionId: IdSchema,
|
|
1517
|
-
path:
|
|
1527
|
+
path: z13.string().min(1)
|
|
1518
1528
|
}),
|
|
1519
1529
|
control("remote_file_metadata_response", {
|
|
1520
1530
|
...RequiredRequestIdShape,
|
|
1521
1531
|
...RequestErrorShape,
|
|
1522
1532
|
sessionId: IdSchema,
|
|
1523
|
-
path:
|
|
1524
|
-
success:
|
|
1525
|
-
mimeType:
|
|
1526
|
-
size:
|
|
1527
|
-
fileName:
|
|
1533
|
+
path: z13.string().optional(),
|
|
1534
|
+
success: z13.boolean(),
|
|
1535
|
+
mimeType: z13.string().optional(),
|
|
1536
|
+
size: z13.number().int().nonnegative().optional(),
|
|
1537
|
+
fileName: z13.string().optional()
|
|
1528
1538
|
}),
|
|
1529
1539
|
control("remote_file_stream_request", {
|
|
1530
1540
|
streamId: IdSchema,
|
|
1531
1541
|
sessionId: IdSchema,
|
|
1532
|
-
path:
|
|
1542
|
+
path: z13.string().min(1),
|
|
1533
1543
|
disposition: RemoteFileDispositionSchema
|
|
1534
1544
|
}),
|
|
1535
1545
|
control("remote_file_stream_response", {
|
|
1536
1546
|
...RequestErrorShape,
|
|
1537
1547
|
streamId: IdSchema,
|
|
1538
1548
|
sessionId: IdSchema,
|
|
1539
|
-
success:
|
|
1540
|
-
path:
|
|
1541
|
-
mimeType:
|
|
1542
|
-
size:
|
|
1543
|
-
fileName:
|
|
1549
|
+
success: z13.boolean(),
|
|
1550
|
+
path: z13.string().optional(),
|
|
1551
|
+
mimeType: z13.string().optional(),
|
|
1552
|
+
size: z13.number().int().nonnegative().optional(),
|
|
1553
|
+
fileName: z13.string().optional()
|
|
1544
1554
|
}),
|
|
1545
1555
|
control("remote_file_stream_complete", {
|
|
1546
1556
|
...RequestErrorShape,
|
|
1547
1557
|
streamId: IdSchema,
|
|
1548
|
-
success:
|
|
1558
|
+
success: z13.boolean()
|
|
1549
1559
|
}),
|
|
1550
1560
|
control("remote_file_stream_cancel", {
|
|
1551
1561
|
streamId: IdSchema
|
|
@@ -1554,25 +1564,25 @@ var relayControlDefinitions = [
|
|
|
1554
1564
|
...RequiredRequestIdShape,
|
|
1555
1565
|
sessionId: IdSchema,
|
|
1556
1566
|
kind: RemoteFileUploadKindSchema,
|
|
1557
|
-
fileName:
|
|
1558
|
-
mimeType:
|
|
1559
|
-
size:
|
|
1567
|
+
fileName: z13.string().optional(),
|
|
1568
|
+
mimeType: z13.string().min(1),
|
|
1569
|
+
size: z13.number().int().nonnegative().optional()
|
|
1560
1570
|
}),
|
|
1561
1571
|
control("remote_file_upload_url_response", {
|
|
1562
1572
|
...RequiredRequestIdShape,
|
|
1563
1573
|
...RequestErrorShape,
|
|
1564
1574
|
sessionId: IdSchema,
|
|
1565
|
-
success:
|
|
1566
|
-
uploadUrl:
|
|
1567
|
-
expiresAt:
|
|
1575
|
+
success: z13.boolean(),
|
|
1576
|
+
uploadUrl: z13.string().optional(),
|
|
1577
|
+
expiresAt: z13.number().int().nonnegative().optional()
|
|
1568
1578
|
}),
|
|
1569
1579
|
control("remote_file_upload_stream_request", {
|
|
1570
1580
|
uploadId: IdSchema,
|
|
1571
1581
|
sessionId: IdSchema,
|
|
1572
1582
|
kind: RemoteFileUploadKindSchema,
|
|
1573
|
-
fileName:
|
|
1574
|
-
mimeType:
|
|
1575
|
-
size:
|
|
1583
|
+
fileName: z13.string().optional(),
|
|
1584
|
+
mimeType: z13.string().min(1),
|
|
1585
|
+
size: z13.number().int().nonnegative().optional()
|
|
1576
1586
|
}),
|
|
1577
1587
|
control("remote_file_upload_stream_complete", {
|
|
1578
1588
|
uploadId: IdSchema
|
|
@@ -1584,14 +1594,14 @@ var relayControlDefinitions = [
|
|
|
1584
1594
|
...RequestErrorShape,
|
|
1585
1595
|
uploadId: IdSchema,
|
|
1586
1596
|
sessionId: IdSchema,
|
|
1587
|
-
success:
|
|
1588
|
-
path:
|
|
1597
|
+
success: z13.boolean(),
|
|
1598
|
+
path: z13.string().optional()
|
|
1589
1599
|
}),
|
|
1590
1600
|
control("proxy_select", { ...RequestIdShape, proxyId: IdSchema }),
|
|
1591
1601
|
controlSchema("proxy_select_response", ProxySelectResponseSchema),
|
|
1592
1602
|
control("relay_error", {
|
|
1593
|
-
code:
|
|
1594
|
-
message:
|
|
1603
|
+
code: z13.enum(Object.values(RelayErrorCode)),
|
|
1604
|
+
message: z13.string(),
|
|
1595
1605
|
// 可选 requestId: relay 把 client 发来 raw 的 requestId 字段透传回来,
|
|
1596
1606
|
// client 侧 waitForMessage 据此把对应 pending request 立即拒掉而不必等到 timeout。
|
|
1597
1607
|
requestId: IdSchema.optional()
|
|
@@ -1610,7 +1620,7 @@ var relayControlDefinitions = [
|
|
|
1610
1620
|
control("voice_config_update_response", {
|
|
1611
1621
|
...RequestIdShape,
|
|
1612
1622
|
...RequestErrorShape,
|
|
1613
|
-
success:
|
|
1623
|
+
success: z13.boolean(),
|
|
1614
1624
|
config: VoiceProviderConfigSchema.optional()
|
|
1615
1625
|
}),
|
|
1616
1626
|
control("voice_config_test", {
|
|
@@ -1620,15 +1630,15 @@ var relayControlDefinitions = [
|
|
|
1620
1630
|
control("voice_config_test_response", {
|
|
1621
1631
|
...RequestIdShape,
|
|
1622
1632
|
...RequestErrorShape,
|
|
1623
|
-
success:
|
|
1624
|
-
audioBase64:
|
|
1625
|
-
audioSampleRate:
|
|
1626
|
-
audioEncoding:
|
|
1627
|
-
transcript:
|
|
1633
|
+
success: z13.boolean(),
|
|
1634
|
+
audioBase64: z13.string().optional(),
|
|
1635
|
+
audioSampleRate: z13.number().int().positive().optional(),
|
|
1636
|
+
audioEncoding: z13.literal("pcm_s16le").optional(),
|
|
1637
|
+
transcript: z13.string().optional()
|
|
1628
1638
|
}),
|
|
1629
1639
|
control("voice_capabilities_request", {
|
|
1630
1640
|
...RequestIdShape,
|
|
1631
|
-
region:
|
|
1641
|
+
region: z13.enum(voiceRegionValues).optional()
|
|
1632
1642
|
}),
|
|
1633
1643
|
control("voice_capabilities_response", {
|
|
1634
1644
|
...RequestIdShape,
|
|
@@ -1640,31 +1650,31 @@ var relayControlDefinitions = [
|
|
|
1640
1650
|
control("latency_web_relay_ping", RequiredRequestIdShape),
|
|
1641
1651
|
control("latency_web_relay_pong", {
|
|
1642
1652
|
...RequiredRequestIdShape,
|
|
1643
|
-
relayNow:
|
|
1653
|
+
relayNow: z13.number().optional()
|
|
1644
1654
|
}),
|
|
1645
1655
|
control("latency_relay_proxy_request", RequiredRequestIdShape),
|
|
1646
1656
|
control("latency_relay_proxy_response", {
|
|
1647
1657
|
...RequiredRequestIdShape,
|
|
1648
|
-
success:
|
|
1649
|
-
rttMs:
|
|
1650
|
-
error:
|
|
1658
|
+
success: z13.boolean(),
|
|
1659
|
+
rttMs: z13.number().nonnegative().optional(),
|
|
1660
|
+
error: z13.string().optional()
|
|
1651
1661
|
}),
|
|
1652
1662
|
control("latency_relay_proxy_ping", {
|
|
1653
1663
|
...RequiredRequestIdShape,
|
|
1654
|
-
relayNow:
|
|
1664
|
+
relayNow: z13.number().optional()
|
|
1655
1665
|
}),
|
|
1656
1666
|
control("latency_relay_proxy_pong", {
|
|
1657
1667
|
...RequiredRequestIdShape,
|
|
1658
|
-
proxyNow:
|
|
1668
|
+
proxyNow: z13.number().optional()
|
|
1659
1669
|
}),
|
|
1660
1670
|
control("latency_web_proxy_ping", RequiredRequestIdShape, "client_to_proxy"),
|
|
1661
|
-
control("latency_web_proxy_pong", { ...RequiredRequestIdShape, proxyNow:
|
|
1671
|
+
control("latency_web_proxy_pong", { ...RequiredRequestIdShape, proxyNow: z13.number().optional() }, "proxy_to_client"),
|
|
1662
1672
|
// Web preview is independent from Agent/terminal sessions. Relay rewrites requestId and routes
|
|
1663
1673
|
// every response to the exact requesting WebSocket; only the two push messages are broadcast.
|
|
1664
1674
|
strictControl("preview_capability_request", {
|
|
1665
1675
|
...RequiredRequestIdShape,
|
|
1666
1676
|
scope: PreviewScopeSchema,
|
|
1667
|
-
refreshPath:
|
|
1677
|
+
refreshPath: z13.boolean()
|
|
1668
1678
|
}, "client_to_proxy"),
|
|
1669
1679
|
controlSchema("preview_capability_response", PreviewCapabilityResponseSchema, "proxy_to_client"),
|
|
1670
1680
|
strictControl("preview_static_inspect_request", {
|
|
@@ -1687,8 +1697,8 @@ var relayControlDefinitions = [
|
|
|
1687
1697
|
...RequiredRequestIdShape,
|
|
1688
1698
|
scope: PreviewScopeSchema,
|
|
1689
1699
|
epoch: IdSchema,
|
|
1690
|
-
revision:
|
|
1691
|
-
previews:
|
|
1700
|
+
revision: z13.number().int().nonnegative(),
|
|
1701
|
+
previews: z13.array(PreviewSummarySchema)
|
|
1692
1702
|
}, "proxy_to_client"),
|
|
1693
1703
|
strictControl("preview_rename_request", {
|
|
1694
1704
|
...RequiredRequestIdShape,
|
|
@@ -1714,24 +1724,24 @@ var relayControlDefinitions = [
|
|
|
1714
1724
|
controlSchema("preview_close_response", PreviewCloseResponseSchema, "proxy_to_client"),
|
|
1715
1725
|
strictControl("preview_state_event", {
|
|
1716
1726
|
epoch: IdSchema,
|
|
1717
|
-
revision:
|
|
1727
|
+
revision: z13.number().int().nonnegative(),
|
|
1718
1728
|
preview: PreviewSummarySchema
|
|
1719
1729
|
}),
|
|
1720
1730
|
strictControl("preview_removed_event", {
|
|
1721
1731
|
epoch: IdSchema,
|
|
1722
|
-
revision:
|
|
1732
|
+
revision: z13.number().int().nonnegative(),
|
|
1723
1733
|
previewId: IdSchema
|
|
1724
1734
|
}),
|
|
1725
1735
|
strictControl("preview_state_push", {
|
|
1726
1736
|
scope: PreviewScopeSchema,
|
|
1727
1737
|
epoch: IdSchema,
|
|
1728
|
-
revision:
|
|
1738
|
+
revision: z13.number().int().nonnegative(),
|
|
1729
1739
|
preview: PreviewSummarySchema
|
|
1730
1740
|
}, "proxy_to_client"),
|
|
1731
1741
|
strictControl("preview_removed_push", {
|
|
1732
1742
|
scope: PreviewScopeSchema,
|
|
1733
1743
|
epoch: IdSchema,
|
|
1734
|
-
revision:
|
|
1744
|
+
revision: z13.number().int().nonnegative(),
|
|
1735
1745
|
previewId: IdSchema
|
|
1736
1746
|
}, "proxy_to_client"),
|
|
1737
1747
|
// Device previews are a sibling of Web previews under the product-level Preview entry, but
|
|
@@ -1740,13 +1750,13 @@ var relayControlDefinitions = [
|
|
|
1740
1750
|
strictControl("device_preview_capability_request", {
|
|
1741
1751
|
...RequiredRequestIdShape,
|
|
1742
1752
|
scope: PreviewScopeSchema,
|
|
1743
|
-
refreshPath:
|
|
1753
|
+
refreshPath: z13.boolean()
|
|
1744
1754
|
}, "client_to_proxy"),
|
|
1745
1755
|
controlSchema("device_preview_capability_response", DevicePreviewCapabilityResponseSchema, "proxy_to_client"),
|
|
1746
1756
|
strictControl("device_preview_targets_request", {
|
|
1747
1757
|
...RequiredRequestIdShape,
|
|
1748
1758
|
scope: PreviewScopeSchema,
|
|
1749
|
-
refresh:
|
|
1759
|
+
refresh: z13.boolean()
|
|
1750
1760
|
}, "client_to_proxy"),
|
|
1751
1761
|
controlSchema("device_preview_targets_response", DevicePreviewTargetsResponseSchema, "proxy_to_client"),
|
|
1752
1762
|
strictControl("device_preview_create_request", {
|
|
@@ -1762,8 +1772,8 @@ var relayControlDefinitions = [
|
|
|
1762
1772
|
...RequiredRequestIdShape,
|
|
1763
1773
|
scope: PreviewScopeSchema,
|
|
1764
1774
|
epoch: IdSchema,
|
|
1765
|
-
revision:
|
|
1766
|
-
previews:
|
|
1775
|
+
revision: z13.number().int().nonnegative(),
|
|
1776
|
+
previews: z13.array(DevicePreviewSummarySchema).max(1024)
|
|
1767
1777
|
}, "proxy_to_client"),
|
|
1768
1778
|
strictControl("device_preview_rename_request", {
|
|
1769
1779
|
...RequiredRequestIdShape,
|
|
@@ -1789,24 +1799,24 @@ var relayControlDefinitions = [
|
|
|
1789
1799
|
controlSchema("device_preview_close_response", DevicePreviewCloseResponseSchema, "proxy_to_client"),
|
|
1790
1800
|
strictControl("device_preview_state_event", {
|
|
1791
1801
|
epoch: IdSchema,
|
|
1792
|
-
revision:
|
|
1802
|
+
revision: z13.number().int().nonnegative(),
|
|
1793
1803
|
preview: DevicePreviewSummarySchema
|
|
1794
1804
|
}),
|
|
1795
1805
|
strictControl("device_preview_removed_event", {
|
|
1796
1806
|
epoch: IdSchema,
|
|
1797
|
-
revision:
|
|
1807
|
+
revision: z13.number().int().nonnegative(),
|
|
1798
1808
|
previewId: IdSchema
|
|
1799
1809
|
}),
|
|
1800
1810
|
strictControl("device_preview_state_push", {
|
|
1801
1811
|
scope: PreviewScopeSchema,
|
|
1802
1812
|
epoch: IdSchema,
|
|
1803
|
-
revision:
|
|
1813
|
+
revision: z13.number().int().nonnegative(),
|
|
1804
1814
|
preview: DevicePreviewSummarySchema
|
|
1805
1815
|
}, "proxy_to_client"),
|
|
1806
1816
|
strictControl("device_preview_removed_push", {
|
|
1807
1817
|
scope: PreviewScopeSchema,
|
|
1808
1818
|
epoch: IdSchema,
|
|
1809
|
-
revision:
|
|
1819
|
+
revision: z13.number().int().nonnegative(),
|
|
1810
1820
|
previewId: IdSchema
|
|
1811
1821
|
}, "proxy_to_client"),
|
|
1812
1822
|
strictControl("device_preview_stream_url_request", {
|
|
@@ -1826,7 +1836,7 @@ var relayControlDefinitions = [
|
|
|
1826
1836
|
strictControl("device_preview_input", {
|
|
1827
1837
|
scope: PreviewScopeSchema,
|
|
1828
1838
|
leaseId: IdSchema,
|
|
1829
|
-
inputSeq:
|
|
1839
|
+
inputSeq: z13.number().int().min(0).max(4294967295),
|
|
1830
1840
|
input: DevicePreviewInputSchema
|
|
1831
1841
|
}, "client_to_proxy"),
|
|
1832
1842
|
controlSchema("device_preview_input_ack", DevicePreviewInputAckSchema, "proxy_to_client"),
|
|
@@ -1834,7 +1844,7 @@ var relayControlDefinitions = [
|
|
|
1834
1844
|
// browsers cannot abort another viewer's queued input, and Proxy never sends it to browsers.
|
|
1835
1845
|
strictControl("device_preview_input_revoke", {
|
|
1836
1846
|
leaseId: IdSchema,
|
|
1837
|
-
reason:
|
|
1847
|
+
reason: z13.literal("control_taken_over")
|
|
1838
1848
|
}),
|
|
1839
1849
|
strictControl("device_preview_control_claim_request", {
|
|
1840
1850
|
...RequiredRequestIdShape,
|
|
@@ -1845,18 +1855,18 @@ var relayControlDefinitions = [
|
|
|
1845
1855
|
strictControl("device_preview_control_revoked_push", {
|
|
1846
1856
|
scope: PreviewScopeSchema,
|
|
1847
1857
|
leaseId: IdSchema,
|
|
1848
|
-
reason:
|
|
1858
|
+
reason: z13.enum(["taken_over", "stream_closed", "proxy_offline", "lease_expired"])
|
|
1849
1859
|
}),
|
|
1850
1860
|
// 客户端注册协议
|
|
1851
1861
|
strictControl("client_register", {
|
|
1852
|
-
protocolVersion:
|
|
1862
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1853
1863
|
clientId: IdSchema,
|
|
1854
|
-
userAgent:
|
|
1855
|
-
platform:
|
|
1856
|
-
maxTouchPoints:
|
|
1857
|
-
browserName:
|
|
1858
|
-
osName:
|
|
1859
|
-
deviceKind:
|
|
1864
|
+
userAgent: z13.string().optional(),
|
|
1865
|
+
platform: z13.string().optional(),
|
|
1866
|
+
maxTouchPoints: z13.number().int().nonnegative().optional(),
|
|
1867
|
+
browserName: z13.string().min(1),
|
|
1868
|
+
osName: z13.string().min(1),
|
|
1869
|
+
deviceKind: z13.enum(["desktop", "tablet", "phone", "unknown"])
|
|
1860
1870
|
}),
|
|
1861
1871
|
controlSchema("client_register_response", ClientRegisterResponseSchema),
|
|
1862
1872
|
// Proxy 离线通知
|
|
@@ -1878,38 +1888,38 @@ var relayControlDefinitions = [
|
|
|
1878
1888
|
// 目录列表请求与响应
|
|
1879
1889
|
strictControl("dir_list_request", {
|
|
1880
1890
|
...RequestIdShape,
|
|
1881
|
-
path:
|
|
1882
|
-
includeHidden:
|
|
1891
|
+
path: z13.string(),
|
|
1892
|
+
includeHidden: z13.boolean()
|
|
1883
1893
|
}, "client_to_proxy"),
|
|
1884
1894
|
control("dir_list_response", {
|
|
1885
1895
|
...RequestIdShape,
|
|
1886
1896
|
...RequestErrorShape,
|
|
1887
|
-
entries:
|
|
1888
|
-
path:
|
|
1889
|
-
includeHidden:
|
|
1897
|
+
entries: z13.array(DirEntrySchema),
|
|
1898
|
+
path: z13.string(),
|
|
1899
|
+
includeHidden: z13.boolean()
|
|
1890
1900
|
}, "proxy_to_client"),
|
|
1891
1901
|
// 目录创建请求与响应
|
|
1892
|
-
control("dir_create_request", { ...RequestIdShape, path:
|
|
1902
|
+
control("dir_create_request", { ...RequestIdShape, path: z13.string() }, "client_to_proxy"),
|
|
1893
1903
|
control("dir_create_response", {
|
|
1894
1904
|
...RequestIdShape,
|
|
1895
1905
|
...RequestErrorShape,
|
|
1896
|
-
path:
|
|
1897
|
-
success:
|
|
1906
|
+
path: z13.string(),
|
|
1907
|
+
success: z13.boolean()
|
|
1898
1908
|
}, "proxy_to_client"),
|
|
1899
1909
|
// 命令列表推送,proxy 将可用命令列表推给 client
|
|
1900
1910
|
control("command_list_push", {
|
|
1901
1911
|
sessionId: IdSchema,
|
|
1902
|
-
commands:
|
|
1912
|
+
commands: z13.array(CommandEntrySchema)
|
|
1903
1913
|
}, "proxy_to_client"),
|
|
1904
1914
|
// 文件树推送: 按目录分组, 首组 path 即为 session cwd。
|
|
1905
1915
|
// 前端把它写入普通目录树;includeHidden=true 的按需响应使用独立缓存。
|
|
1906
1916
|
control("file_tree_push", {
|
|
1907
|
-
groups:
|
|
1917
|
+
groups: z13.array(FileTreeGroupSchema)
|
|
1908
1918
|
}, "proxy_to_client"),
|
|
1909
1919
|
// 会话列表请求与权限模式变更
|
|
1910
1920
|
strictControl("session_list_request", {}, "client_to_proxy"),
|
|
1911
1921
|
control("permission_mode_change", {
|
|
1912
|
-
mode:
|
|
1922
|
+
mode: z13.enum(["default", "auto_accept", "plan"]),
|
|
1913
1923
|
// sessionId 可选:传入时 proxy 按该会话的 mode 分叉(PTY 发 Tab ANSI),未传走全局日志行为
|
|
1914
1924
|
sessionId: IdSchema.optional()
|
|
1915
1925
|
}, "client_to_proxy"),
|
|
@@ -1918,33 +1928,33 @@ var relayControlDefinitions = [
|
|
|
1918
1928
|
control("session_history_response", {
|
|
1919
1929
|
...RequiredRequestIdShape,
|
|
1920
1930
|
...RequestErrorShape,
|
|
1921
|
-
success:
|
|
1922
|
-
sessions:
|
|
1931
|
+
success: z13.boolean(),
|
|
1932
|
+
sessions: z13.array(HistorySessionSchema)
|
|
1923
1933
|
}, "proxy_to_client"),
|
|
1924
1934
|
// PTY 语义状态,从 Envelope 迁移到 Control 层
|
|
1925
1935
|
control("pty_state", { sessionId: IdSchema, payload: PtyStatePayloadSchema }, "proxy_to_client"),
|
|
1926
1936
|
// Provider 语义状态,来自 Claude/Codex hook 等结构化事件,不从 PTY 字节推断
|
|
1927
1937
|
control("agent_status", { sessionId: IdSchema, payload: AgentStatusPayloadSchema }, "proxy_to_client"),
|
|
1928
1938
|
// 终端标题变化,proxy -> client
|
|
1929
|
-
control("terminal_title", { sessionId: IdSchema, title:
|
|
1939
|
+
control("terminal_title", { sessionId: IdSchema, title: z13.string() }, "proxy_to_client"),
|
|
1930
1940
|
// 终端尺寸变化,proxy -> client
|
|
1931
1941
|
control("terminal_resize", {
|
|
1932
1942
|
sessionId: IdSchema,
|
|
1933
|
-
cols:
|
|
1934
|
-
rows:
|
|
1943
|
+
cols: z13.number().int().positive(),
|
|
1944
|
+
rows: z13.number().int().positive(),
|
|
1935
1945
|
// PTY output and resize events share one ordered render sequence. The client can therefore
|
|
1936
1946
|
// place a resize between the exact byte frames that preceded and followed it.
|
|
1937
|
-
outputSeq:
|
|
1947
|
+
outputSeq: z13.number().int().nonnegative()
|
|
1938
1948
|
}, "proxy_to_client"),
|
|
1939
|
-
control("terminal_resize_request", { sessionId: IdSchema, cols:
|
|
1949
|
+
control("terminal_resize_request", { sessionId: IdSchema, cols: z13.number().int().positive(), rows: z13.number().int().positive() }, "client_to_proxy"),
|
|
1940
1950
|
// 远程终止 JSON 会话,client -> proxy
|
|
1941
1951
|
strictControl("session_terminate", { sessionId: IdSchema }, "client_to_proxy"),
|
|
1942
|
-
control("session_rename", { ...RequestIdShape, sessionId: IdSchema, name:
|
|
1952
|
+
control("session_rename", { ...RequestIdShape, sessionId: IdSchema, name: z13.string() }, "client_to_proxy"),
|
|
1943
1953
|
control("session_rename_response", {
|
|
1944
1954
|
...RequestIdShape,
|
|
1945
1955
|
sessionId: IdSchema,
|
|
1946
|
-
success:
|
|
1947
|
-
name:
|
|
1956
|
+
success: z13.boolean(),
|
|
1957
|
+
name: z13.string().optional(),
|
|
1948
1958
|
...RequestErrorShape
|
|
1949
1959
|
}, "proxy_to_client"),
|
|
1950
1960
|
// 中断当前 turn,client -> proxy;JSON 由 session-worker 打断 Claude 子进程并保留会话。
|
|
@@ -1952,22 +1962,22 @@ var relayControlDefinitions = [
|
|
|
1952
1962
|
// turn 完成信号,proxy -> client,对应 claude stream-json 的 result 事件
|
|
1953
1963
|
control("turn_result", {
|
|
1954
1964
|
sessionId: IdSchema,
|
|
1955
|
-
success:
|
|
1956
|
-
isError:
|
|
1965
|
+
success: z13.boolean(),
|
|
1966
|
+
isError: z13.boolean(),
|
|
1957
1967
|
// stream-json result.result 是本轮最终文本。assistant_message 流丢失或 CLI 未发增量时,
|
|
1958
1968
|
// Web 用它作为 JSON 模式兜底展示,避免 turn 已结束但界面空白。
|
|
1959
|
-
result:
|
|
1969
|
+
result: z13.string().optional()
|
|
1960
1970
|
}, "proxy_to_client"),
|
|
1961
1971
|
// 客户端发送到 PTY 的原始字节(ANSI 序列),不追加换行
|
|
1962
|
-
control("remote_input_raw", { sessionId: IdSchema, data:
|
|
1972
|
+
control("remote_input_raw", { sessionId: IdSchema, data: z13.string(), traceId: IdSchema.optional() }, "client_to_proxy"),
|
|
1963
1973
|
// 客户端询问 proxy 的环境信息 (home 路径等), client -> proxy -> response
|
|
1964
1974
|
// FilePathPicker 用 homePath 作为 select 模式下的默认起点, 新建会话时打开即可浏览
|
|
1965
1975
|
controlSchema("proxy_info_request", ProxyInfoRequestSchema, "client_to_proxy"),
|
|
1966
1976
|
controlSchema("proxy_info", ProxyInfoResponseSchema, "proxy_to_client"),
|
|
1967
|
-
control("agent_cli_config_update", { ...RequestIdShape, provider:
|
|
1977
|
+
control("agent_cli_config_update", { ...RequestIdShape, provider: z13.enum(providerValues), path: z13.string().min(1) }, "client_to_proxy"),
|
|
1968
1978
|
control("agent_cli_config_update_response", {
|
|
1969
1979
|
...RequestIdShape,
|
|
1970
|
-
provider:
|
|
1980
|
+
provider: z13.enum(providerValues),
|
|
1971
1981
|
agentCli: AgentCliStatusSchema.optional(),
|
|
1972
1982
|
...RequestErrorShape
|
|
1973
1983
|
}, "proxy_to_client"),
|
|
@@ -1979,16 +1989,16 @@ var relayControlDefinitions = [
|
|
|
1979
1989
|
// 非零退出。把可识别的运行时错误结构化推给 Web,避免关键错误只留在终端闪屏里。
|
|
1980
1990
|
control("session_runtime_error", {
|
|
1981
1991
|
sessionId: IdSchema,
|
|
1982
|
-
error:
|
|
1992
|
+
error: z13.string(),
|
|
1983
1993
|
errorCode: ControlErrorCodeSchema,
|
|
1984
|
-
activeWriterPid:
|
|
1994
|
+
activeWriterPid: z13.number().int().positive().optional()
|
|
1985
1995
|
}, "proxy_to_client"),
|
|
1986
1996
|
// 客户端请求会话历史消息,client -> proxy
|
|
1987
1997
|
control("session_messages_request", {
|
|
1988
1998
|
...RequestIdShape,
|
|
1989
1999
|
sessionId: IdSchema,
|
|
1990
|
-
limit:
|
|
1991
|
-
before:
|
|
2000
|
+
limit: z13.number().int().min(1).max(200).optional(),
|
|
2001
|
+
before: z13.string().optional()
|
|
1992
2002
|
}, "client_to_proxy"),
|
|
1993
2003
|
// 客户端请求会话资源(命令列表 + 文件树),client -> proxy
|
|
1994
2004
|
control("session_resources_request", { ...RequiredRequestIdShape, sessionId: IdSchema }, "client_to_proxy"),
|
|
@@ -1996,14 +2006,14 @@ var relayControlDefinitions = [
|
|
|
1996
2006
|
...RequiredRequestIdShape,
|
|
1997
2007
|
...RequestErrorShape,
|
|
1998
2008
|
sessionId: IdSchema,
|
|
1999
|
-
commands:
|
|
2000
|
-
groups:
|
|
2009
|
+
commands: z13.array(CommandEntrySchema),
|
|
2010
|
+
groups: z13.array(FileTreeGroupSchema)
|
|
2001
2011
|
}, "proxy_to_client"),
|
|
2002
2012
|
// 客户端请求当前 provider 语义状态;不经 relay 缓存,由 proxy 返回当前值
|
|
2003
2013
|
control("agent_status_request", { ...RequestIdShape, sessionId: IdSchema.optional() }, "client_to_proxy"),
|
|
2004
2014
|
control("agent_status_response", {
|
|
2005
2015
|
...RequestIdShape,
|
|
2006
|
-
statuses:
|
|
2016
|
+
statuses: z13.array(z13.object({ sessionId: IdSchema, payload: AgentStatusPayloadSchema }))
|
|
2007
2017
|
}, "proxy_to_client"),
|
|
2008
2018
|
// 客户端确认已收到审批请求;proxy 只记录送达状态,不把它当成用户决策
|
|
2009
2019
|
control("permission_request_delivered", { sessionId: IdSchema, requestId: IdSchema }, "client_to_proxy"),
|
|
@@ -2013,18 +2023,18 @@ var relayControlDefinitions = [
|
|
|
2013
2023
|
control("permission_decision_result", {
|
|
2014
2024
|
sessionId: IdSchema,
|
|
2015
2025
|
requestId: IdSchema,
|
|
2016
|
-
outcome:
|
|
2017
|
-
delivered:
|
|
2018
|
-
message:
|
|
2026
|
+
outcome: z13.enum(["allow", "deny"]),
|
|
2027
|
+
delivered: z13.boolean(),
|
|
2028
|
+
message: z13.string().optional()
|
|
2019
2029
|
}, "proxy_to_client"),
|
|
2020
2030
|
// proxy 推送当前 pending 的工具审批列表,client 据此恢复审批卡片
|
|
2021
2031
|
control("pending_approvals_push", {
|
|
2022
2032
|
sessionId: IdSchema,
|
|
2023
|
-
approvals:
|
|
2033
|
+
approvals: z13.array(z13.object({
|
|
2024
2034
|
requestId: IdSchema,
|
|
2025
|
-
toolName:
|
|
2026
|
-
input:
|
|
2027
|
-
options:
|
|
2035
|
+
toolName: z13.string(),
|
|
2036
|
+
input: z13.record(z13.string(), z13.unknown()),
|
|
2037
|
+
options: z13.array(ApprovalOptionSchema).optional()
|
|
2028
2038
|
}))
|
|
2029
2039
|
}, "proxy_to_client"),
|
|
2030
2040
|
// Voice Pilot speech summaries are produced by proxy-side Claude Code so it can read project context.
|
|
@@ -2032,7 +2042,7 @@ var relayControlDefinitions = [
|
|
|
2032
2042
|
...RequestIdShape,
|
|
2033
2043
|
sessionId: IdSchema,
|
|
2034
2044
|
messageId: IdSchema,
|
|
2035
|
-
text:
|
|
2045
|
+
text: z13.string().min(1),
|
|
2036
2046
|
reason: VoiceSummaryReasonSchema
|
|
2037
2047
|
}, "client_to_proxy"),
|
|
2038
2048
|
control("voice_summary_response", {
|
|
@@ -2040,27 +2050,27 @@ var relayControlDefinitions = [
|
|
|
2040
2050
|
...RequestErrorShape,
|
|
2041
2051
|
sessionId: IdSchema,
|
|
2042
2052
|
messageId: IdSchema,
|
|
2043
|
-
success:
|
|
2044
|
-
summary:
|
|
2053
|
+
success: z13.boolean(),
|
|
2054
|
+
summary: z13.string().min(1).optional()
|
|
2045
2055
|
}, "proxy_to_client"),
|
|
2046
2056
|
// 恢复会话时推送历史消息,proxy -> client
|
|
2047
2057
|
control("session_history_messages", {
|
|
2048
2058
|
...RequestIdShape,
|
|
2049
2059
|
sessionId: IdSchema,
|
|
2050
|
-
before:
|
|
2051
|
-
messages:
|
|
2052
|
-
hasMore:
|
|
2053
|
-
nextBefore:
|
|
2060
|
+
before: z13.string().optional(),
|
|
2061
|
+
messages: z13.array(SessionHistoryMessageSchema),
|
|
2062
|
+
hasMore: z13.boolean().optional(),
|
|
2063
|
+
nextBefore: z13.string().optional()
|
|
2054
2064
|
}, "proxy_to_client"),
|
|
2055
2065
|
// proxy 重连后同步活跃 session 列表给 relay。session_sync 由 relay 自消费(更新 proxy-session
|
|
2056
2066
|
// 关联)不转发给 client,因此**没有** direction 标注——RelayControlDirection 只描述转发流。
|
|
2057
2067
|
control("session_sync", {
|
|
2058
|
-
sessions:
|
|
2059
|
-
id:
|
|
2060
|
-
cwd:
|
|
2061
|
-
name:
|
|
2062
|
-
nameLocked:
|
|
2063
|
-
state:
|
|
2068
|
+
sessions: z13.array(createSessionIdentitySchema({
|
|
2069
|
+
id: z13.string(),
|
|
2070
|
+
cwd: z13.string(),
|
|
2071
|
+
name: z13.string().optional(),
|
|
2072
|
+
nameLocked: z13.boolean().optional(),
|
|
2073
|
+
state: z13.enum(sessionStateValues)
|
|
2064
2074
|
}))
|
|
2065
2075
|
}),
|
|
2066
2076
|
// PTY 会话订阅,client -> proxy,触发 terminal serialize() 返回当前状态
|
|
@@ -2068,15 +2078,15 @@ var relayControlDefinitions = [
|
|
|
2068
2078
|
// PTY 会话快照,proxy -> client,serialize() 的全量终端状态
|
|
2069
2079
|
control("session_snapshot", {
|
|
2070
2080
|
sessionId: IdSchema,
|
|
2071
|
-
cols:
|
|
2072
|
-
rows:
|
|
2073
|
-
data:
|
|
2074
|
-
outputSeq:
|
|
2081
|
+
cols: z13.number().int().positive(),
|
|
2082
|
+
rows: z13.number().int().positive(),
|
|
2083
|
+
data: z13.string(),
|
|
2084
|
+
outputSeq: z13.number().int().nonnegative(),
|
|
2075
2085
|
requestId: IdSchema
|
|
2076
2086
|
}, "proxy_to_client")
|
|
2077
2087
|
];
|
|
2078
2088
|
var relayControlSchemas = relayControlDefinitions.map((definition) => definition.schema);
|
|
2079
|
-
var RelayControlSchema =
|
|
2089
|
+
var RelayControlSchema = z13.discriminatedUnion("type", relayControlSchemas);
|
|
2080
2090
|
var ProxyToClientRelayControlTypes = new Set(relayControlDefinitions.filter((definition) => definition.directions.has("proxy_to_client")).map((definition) => definition.type));
|
|
2081
2091
|
function isProxyToClientRelayControlType(type) {
|
|
2082
2092
|
return ProxyToClientRelayControlTypes.has(type);
|
|
@@ -2754,6 +2764,15 @@ function healthRouter(registry, options = {}) {
|
|
|
2754
2764
|
res.status(401).json({ error: "invalid_proxy_token" });
|
|
2755
2765
|
return false;
|
|
2756
2766
|
}
|
|
2767
|
+
router.get("/api/proxy-upgrade-bootstrap", (req, res) => {
|
|
2768
|
+
if (!requireProxyTokenIfConfigured(req, res)) return;
|
|
2769
|
+
res.setHeader("Cache-Control", "no-store");
|
|
2770
|
+
res.json({
|
|
2771
|
+
bootstrapVersion: PROXY_UPGRADE_BOOTSTRAP_VERSION,
|
|
2772
|
+
relayVersion: RELAY_VERSION,
|
|
2773
|
+
controlProtocolVersion: RELAY_CONTROL_PROTOCOL_VERSION
|
|
2774
|
+
});
|
|
2775
|
+
});
|
|
2757
2776
|
router.get("/status", (_req, res) => {
|
|
2758
2777
|
res.json({
|
|
2759
2778
|
version: RELAY_VERSION,
|
|
@@ -3141,6 +3160,56 @@ var WebPreviewRouteRegistry = class extends PreviewRouteRegistry {
|
|
|
3141
3160
|
}
|
|
3142
3161
|
};
|
|
3143
3162
|
|
|
3163
|
+
// src/proxy-upgrade-bootstrap.ts
|
|
3164
|
+
import { z as z14 } from "zod";
|
|
3165
|
+
var UPGRADE_BOOTSTRAP_SOURCE_VERSION = "0.8.1";
|
|
3166
|
+
var STABLE_VERSION_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
3167
|
+
var ProxyUpgradeBootstrapRequestSchema = z14.object({
|
|
3168
|
+
type: z14.literal("proxy_register"),
|
|
3169
|
+
proxyId: IdSchema,
|
|
3170
|
+
name: z14.string().optional(),
|
|
3171
|
+
proxyVersion: z14.literal(UPGRADE_BOOTSTRAP_SOURCE_VERSION)
|
|
3172
|
+
}).strict();
|
|
3173
|
+
function parseStableVersion(value) {
|
|
3174
|
+
const match = STABLE_VERSION_RE.exec(value);
|
|
3175
|
+
if (!match) return null;
|
|
3176
|
+
const parts = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
3177
|
+
return parts.every(Number.isSafeInteger) ? parts : null;
|
|
3178
|
+
}
|
|
3179
|
+
function isLowerStableVersion(source, target) {
|
|
3180
|
+
const left = parseStableVersion(source);
|
|
3181
|
+
const right = parseStableVersion(target);
|
|
3182
|
+
if (!left || !right) return false;
|
|
3183
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
3184
|
+
if (left[index] !== right[index]) return left[index] < right[index];
|
|
3185
|
+
}
|
|
3186
|
+
return false;
|
|
3187
|
+
}
|
|
3188
|
+
function parseProxyUpgradeBootstrapRequest(raw, relayVersion) {
|
|
3189
|
+
let parsed;
|
|
3190
|
+
try {
|
|
3191
|
+
parsed = JSON.parse(raw);
|
|
3192
|
+
} catch {
|
|
3193
|
+
return null;
|
|
3194
|
+
}
|
|
3195
|
+
const request = ProxyUpgradeBootstrapRequestSchema.safeParse(parsed);
|
|
3196
|
+
if (!request.success) return null;
|
|
3197
|
+
if (!isLowerStableVersion(request.data.proxyVersion, relayVersion)) return null;
|
|
3198
|
+
return request.data;
|
|
3199
|
+
}
|
|
3200
|
+
function sendProxyUpgradeBootstrapResponse(ws, relayVersion) {
|
|
3201
|
+
ws.send(
|
|
3202
|
+
JSON.stringify({
|
|
3203
|
+
type: "proxy_register_response",
|
|
3204
|
+
status: "new",
|
|
3205
|
+
relayVersion
|
|
3206
|
+
}),
|
|
3207
|
+
(error) => {
|
|
3208
|
+
if (error) ws.terminate();
|
|
3209
|
+
}
|
|
3210
|
+
);
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3144
3213
|
// src/handlers/proxy.ts
|
|
3145
3214
|
var PREVIEW_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
3146
3215
|
"preview_state_event",
|
|
@@ -3244,10 +3313,15 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3244
3313
|
const proxyWs = ws;
|
|
3245
3314
|
proxyWs.isAlive = true;
|
|
3246
3315
|
let registrationCompleted = false;
|
|
3316
|
+
let upgradeBootstrapStarted = false;
|
|
3317
|
+
let initialFrameReceived = false;
|
|
3247
3318
|
proxyWs.on("pong", () => {
|
|
3248
3319
|
proxyWs.isAlive = true;
|
|
3249
3320
|
});
|
|
3250
3321
|
proxyWs.on("message", (data, isBinary) => {
|
|
3322
|
+
if (upgradeBootstrapStarted) return;
|
|
3323
|
+
const isInitialFrame = !initialFrameReceived;
|
|
3324
|
+
initialFrameReceived = true;
|
|
3251
3325
|
if (isBinary) {
|
|
3252
3326
|
if (!proxyWs.proxyId) {
|
|
3253
3327
|
closeRejectedProxyProtocol(proxyWs);
|
|
@@ -3296,6 +3370,20 @@ function handleProxyConnection(ws, registry, logger, ptySnapshotRoutes, sessionH
|
|
|
3296
3370
|
return;
|
|
3297
3371
|
}
|
|
3298
3372
|
const raw = data.toString();
|
|
3373
|
+
const upgradeBootstrap = isInitialFrame ? parseProxyUpgradeBootstrapRequest(raw, RELAY_VERSION) : null;
|
|
3374
|
+
if (upgradeBootstrap) {
|
|
3375
|
+
upgradeBootstrapStarted = true;
|
|
3376
|
+
logger.info(
|
|
3377
|
+
{
|
|
3378
|
+
proxyId: upgradeBootstrap.proxyId,
|
|
3379
|
+
proxyVersion: upgradeBootstrap.proxyVersion,
|
|
3380
|
+
relayVersion: RELAY_VERSION
|
|
3381
|
+
},
|
|
3382
|
+
"Proxy upgrade bootstrap sent"
|
|
3383
|
+
);
|
|
3384
|
+
sendProxyUpgradeBootstrapResponse(proxyWs, RELAY_VERSION);
|
|
3385
|
+
return;
|
|
3386
|
+
}
|
|
3299
3387
|
const result = parseMessage(raw);
|
|
3300
3388
|
if (result.kind === "control" && result.message.type === "proxy_register") {
|
|
3301
3389
|
if (registrationCompleted) {
|
|
@@ -8609,4 +8697,4 @@ export {
|
|
|
8609
8697
|
parseRelayChaosFromEnv,
|
|
8610
8698
|
createRelayServer
|
|
8611
8699
|
};
|
|
8612
|
-
//# sourceMappingURL=chunk-
|
|
8700
|
+
//# sourceMappingURL=chunk-JLLMBFAB.js.map
|