@dev-anywhere/proxy 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/dist/{chunk-HWPURRXB.js → chunk-7LUBU2WA.js} +10 -2
- package/dist/{chunk-HWPURRXB.js.map → chunk-7LUBU2WA.js.map} +1 -1
- package/dist/{chunk-YM74AWYC.js → chunk-7SYT65DN.js} +2 -2
- package/dist/{chunk-RN3KQK6E.js → chunk-NTL4CXBA.js} +775 -764
- package/dist/chunk-NTL4CXBA.js.map +1 -0
- package/dist/{chunk-K72MFCMC.js → chunk-OFD4UVPB.js} +2 -2
- package/dist/index.js +3 -3
- package/dist/serve.js +148 -7
- package/dist/serve.js.map +1 -1
- package/dist/session-worker.js +1 -1
- package/dist/{terminal-AHMO45YN.js → terminal-BEXDQ5WK.js} +3 -3
- package/dist/terminal-worker.js +2 -2
- package/dist/update-runner.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-RN3KQK6E.js.map +0 -1
- /package/dist/{chunk-YM74AWYC.js.map → chunk-7SYT65DN.js.map} +0 -0
- /package/dist/{chunk-K72MFCMC.js.map → chunk-OFD4UVPB.js.map} +0 -0
- /package/dist/{terminal-AHMO45YN.js.map → terminal-BEXDQ5WK.js.map} +0 -0
|
@@ -423,18 +423,28 @@ var PreviewScopeSchema = z8.object({
|
|
|
423
423
|
bindingId: IdSchema
|
|
424
424
|
}).strict();
|
|
425
425
|
|
|
426
|
-
// ../../packages/shared/dist/schemas/
|
|
426
|
+
// ../../packages/shared/dist/schemas/proxy-upgrade-bootstrap.js
|
|
427
427
|
import { z as z9 } from "zod";
|
|
428
|
+
var PROXY_UPGRADE_BOOTSTRAP_VERSION = 1;
|
|
429
|
+
var StableVersionSchema = z9.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
|
|
430
|
+
var ProxyUpgradeBootstrapResponseSchema = z9.object({
|
|
431
|
+
bootstrapVersion: z9.literal(PROXY_UPGRADE_BOOTSTRAP_VERSION),
|
|
432
|
+
relayVersion: StableVersionSchema,
|
|
433
|
+
controlProtocolVersion: z9.number().int().positive()
|
|
434
|
+
}).strict();
|
|
435
|
+
|
|
436
|
+
// ../../packages/shared/dist/schemas/web-preview.js
|
|
437
|
+
import { z as z10 } from "zod";
|
|
428
438
|
var WEB_PREVIEW_PATH_MAX_LENGTH = 4096;
|
|
429
439
|
var WEB_PREVIEW_SOURCE_URL_MAX_LENGTH = 4096;
|
|
430
440
|
var WEB_PREVIEW_PUBLIC_URL_MAX_LENGTH = 65536;
|
|
431
441
|
var WEB_PREVIEW_NAME_MAX_LENGTH = 256;
|
|
432
442
|
var WEB_PREVIEW_ERROR_MAX_LENGTH = 4096;
|
|
433
443
|
var WEB_PREVIEW_HTML_ENTRY_MAX_COUNT = 1e3;
|
|
434
|
-
var WebPreviewNameSchema =
|
|
444
|
+
var WebPreviewNameSchema = z10.string().trim().min(1).max(WEB_PREVIEW_NAME_MAX_LENGTH);
|
|
435
445
|
var tunnelProviderValues = ["cloudflare", "cpolar"];
|
|
436
|
-
var TunnelProviderSchema =
|
|
437
|
-
var WebPreviewPathSchema =
|
|
446
|
+
var TunnelProviderSchema = z10.enum(tunnelProviderValues);
|
|
447
|
+
var WebPreviewPathSchema = z10.string().min(1).max(WEB_PREVIEW_PATH_MAX_LENGTH);
|
|
438
448
|
function parseUrlSafely(value) {
|
|
439
449
|
try {
|
|
440
450
|
return new URL(value);
|
|
@@ -442,7 +452,7 @@ function parseUrlSafely(value) {
|
|
|
442
452
|
return null;
|
|
443
453
|
}
|
|
444
454
|
}
|
|
445
|
-
var LoopbackHttpUrlSchema =
|
|
455
|
+
var LoopbackHttpUrlSchema = z10.string().min(1).max(WEB_PREVIEW_SOURCE_URL_MAX_LENGTH).url().refine((value) => {
|
|
446
456
|
const url = parseUrlSafely(value);
|
|
447
457
|
if (!url)
|
|
448
458
|
return false;
|
|
@@ -450,7 +460,7 @@ var LoopbackHttpUrlSchema = z9.string().min(1).max(WEB_PREVIEW_SOURCE_URL_MAX_LE
|
|
|
450
460
|
return false;
|
|
451
461
|
return url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
|
|
452
462
|
}, "Local preview URL must use http:// with a loopback host and no credentials");
|
|
453
|
-
var PublicPreviewUrlSchema =
|
|
463
|
+
var PublicPreviewUrlSchema = z10.string().min(1).max(WEB_PREVIEW_PUBLIC_URL_MAX_LENGTH).url().refine((value) => {
|
|
454
464
|
const url = parseUrlSafely(value);
|
|
455
465
|
if (!url)
|
|
456
466
|
return false;
|
|
@@ -459,45 +469,45 @@ var PublicPreviewUrlSchema = z9.string().min(1).max(WEB_PREVIEW_PUBLIC_URL_MAX_L
|
|
|
459
469
|
var DNS_LABEL_PATTERN = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
|
|
460
470
|
var CLOUDFLARE_PUBLIC_HOST_PATTERN = new RegExp(`^${DNS_LABEL_PATTERN}\\.trycloudflare\\.com$`, "i");
|
|
461
471
|
var CPOLAR_PUBLIC_HOST_PATTERN = new RegExp(`^(?:${DNS_LABEL_PATTERN}\\.)+cpolar\\.(?:top|cn|io)$`, "i");
|
|
462
|
-
var WebPreviewTunnelSuggestionsSchema =
|
|
463
|
-
var WebPreviewTunnelStatusSchema =
|
|
464
|
-
|
|
465
|
-
available:
|
|
466
|
-
command:
|
|
467
|
-
version:
|
|
468
|
-
error:
|
|
472
|
+
var WebPreviewTunnelSuggestionsSchema = z10.array(z10.string().min(1).max(WEB_PREVIEW_PATH_MAX_LENGTH)).max(32).optional();
|
|
473
|
+
var WebPreviewTunnelStatusSchema = z10.discriminatedUnion("available", [
|
|
474
|
+
z10.object({
|
|
475
|
+
available: z10.literal(true),
|
|
476
|
+
command: z10.string().min(1).max(WEB_PREVIEW_PATH_MAX_LENGTH),
|
|
477
|
+
version: z10.string().min(1).max(256).optional(),
|
|
478
|
+
error: z10.never().optional(),
|
|
469
479
|
suggestions: WebPreviewTunnelSuggestionsSchema
|
|
470
480
|
}).strict(),
|
|
471
|
-
|
|
472
|
-
available:
|
|
473
|
-
command:
|
|
474
|
-
version:
|
|
475
|
-
error:
|
|
481
|
+
z10.object({
|
|
482
|
+
available: z10.literal(false),
|
|
483
|
+
command: z10.never().optional(),
|
|
484
|
+
version: z10.never().optional(),
|
|
485
|
+
error: z10.string().min(1).max(WEB_PREVIEW_ERROR_MAX_LENGTH),
|
|
476
486
|
suggestions: WebPreviewTunnelSuggestionsSchema
|
|
477
487
|
}).strict()
|
|
478
488
|
]);
|
|
479
|
-
var WebPreviewCapabilitySchema =
|
|
489
|
+
var WebPreviewCapabilitySchema = z10.object({
|
|
480
490
|
cloudflared: WebPreviewTunnelStatusSchema,
|
|
481
491
|
cpolar: WebPreviewTunnelStatusSchema
|
|
482
492
|
}).strict();
|
|
483
|
-
var WebPreviewSourceInputSchema =
|
|
484
|
-
|
|
485
|
-
kind:
|
|
493
|
+
var WebPreviewSourceInputSchema = z10.discriminatedUnion("kind", [
|
|
494
|
+
z10.object({
|
|
495
|
+
kind: z10.literal("local"),
|
|
486
496
|
url: LoopbackHttpUrlSchema
|
|
487
497
|
}).strict(),
|
|
488
|
-
|
|
489
|
-
kind:
|
|
498
|
+
z10.object({
|
|
499
|
+
kind: z10.literal("static"),
|
|
490
500
|
path: WebPreviewPathSchema,
|
|
491
501
|
entryPath: WebPreviewPathSchema
|
|
492
502
|
}).strict()
|
|
493
503
|
]);
|
|
494
|
-
var PreviewSourceSchema =
|
|
495
|
-
|
|
496
|
-
kind:
|
|
504
|
+
var PreviewSourceSchema = z10.discriminatedUnion("kind", [
|
|
505
|
+
z10.object({
|
|
506
|
+
kind: z10.literal("local"),
|
|
497
507
|
url: LoopbackHttpUrlSchema
|
|
498
508
|
}).strict(),
|
|
499
|
-
|
|
500
|
-
kind:
|
|
509
|
+
z10.object({
|
|
510
|
+
kind: z10.literal("static"),
|
|
501
511
|
rootPath: WebPreviewPathSchema,
|
|
502
512
|
entryPath: WebPreviewPathSchema
|
|
503
513
|
}).strict()
|
|
@@ -509,40 +519,40 @@ var previewStateValues = [
|
|
|
509
519
|
"failed",
|
|
510
520
|
"stopping"
|
|
511
521
|
];
|
|
512
|
-
var PreviewStateSchema =
|
|
513
|
-
var PreviewSummaryBaseSchema =
|
|
522
|
+
var PreviewStateSchema = z10.enum(previewStateValues);
|
|
523
|
+
var PreviewSummaryBaseSchema = z10.object({
|
|
514
524
|
previewId: IdSchema,
|
|
515
525
|
name: WebPreviewNameSchema,
|
|
516
526
|
source: PreviewSourceSchema,
|
|
517
527
|
tunnelProvider: TunnelProviderSchema,
|
|
518
|
-
createdAt:
|
|
519
|
-
updatedAt:
|
|
528
|
+
createdAt: z10.number().int().nonnegative(),
|
|
529
|
+
updatedAt: z10.number().int().nonnegative()
|
|
520
530
|
});
|
|
521
531
|
var PreviewSummaryInactiveShape = {
|
|
522
|
-
publicUrl:
|
|
523
|
-
error:
|
|
532
|
+
publicUrl: z10.never().optional(),
|
|
533
|
+
error: z10.never().optional()
|
|
524
534
|
};
|
|
525
|
-
var PreviewSummarySchema =
|
|
535
|
+
var PreviewSummarySchema = z10.discriminatedUnion("state", [
|
|
526
536
|
PreviewSummaryBaseSchema.extend({
|
|
527
|
-
state:
|
|
537
|
+
state: z10.literal("starting"),
|
|
528
538
|
...PreviewSummaryInactiveShape
|
|
529
539
|
}).strict(),
|
|
530
540
|
PreviewSummaryBaseSchema.extend({
|
|
531
|
-
state:
|
|
541
|
+
state: z10.literal("ready"),
|
|
532
542
|
publicUrl: PublicPreviewUrlSchema,
|
|
533
|
-
error:
|
|
543
|
+
error: z10.never().optional()
|
|
534
544
|
}).strict(),
|
|
535
545
|
PreviewSummaryBaseSchema.extend({
|
|
536
|
-
state:
|
|
546
|
+
state: z10.literal("disconnected"),
|
|
537
547
|
...PreviewSummaryInactiveShape
|
|
538
548
|
}).strict(),
|
|
539
549
|
PreviewSummaryBaseSchema.extend({
|
|
540
|
-
state:
|
|
541
|
-
publicUrl:
|
|
542
|
-
error:
|
|
550
|
+
state: z10.literal("failed"),
|
|
551
|
+
publicUrl: z10.never().optional(),
|
|
552
|
+
error: z10.string().min(1).max(WEB_PREVIEW_ERROR_MAX_LENGTH)
|
|
543
553
|
}).strict(),
|
|
544
554
|
PreviewSummaryBaseSchema.extend({
|
|
545
|
-
state:
|
|
555
|
+
state: z10.literal("stopping"),
|
|
546
556
|
...PreviewSummaryInactiveShape
|
|
547
557
|
}).strict()
|
|
548
558
|
]).superRefine((preview, context) => {
|
|
@@ -562,104 +572,104 @@ var PreviewSummarySchema = z9.discriminatedUnion("state", [
|
|
|
562
572
|
});
|
|
563
573
|
}
|
|
564
574
|
});
|
|
565
|
-
var PreviewHtmlEntriesSchema =
|
|
575
|
+
var PreviewHtmlEntriesSchema = z10.array(WebPreviewPathSchema).max(WEB_PREVIEW_HTML_ENTRY_MAX_COUNT);
|
|
566
576
|
|
|
567
577
|
// ../../packages/shared/dist/schemas/device-preview.js
|
|
568
|
-
import { z as
|
|
578
|
+
import { z as z11 } from "zod";
|
|
569
579
|
var DEVICE_PREVIEW_PATH_MAX_LENGTH = 4096;
|
|
570
580
|
var DEVICE_PREVIEW_TEXT_MAX_LENGTH = 4096;
|
|
571
581
|
var DEVICE_PREVIEW_ERROR_MAX_LENGTH = 4096;
|
|
572
582
|
var DEVICE_PREVIEW_NAME_MAX_LENGTH = 256;
|
|
573
583
|
var DEVICE_PREVIEW_VERSION_MAX_LENGTH = 256;
|
|
574
584
|
var DEVICE_PREVIEW_SCREEN_EDGE_MAX = 16384;
|
|
575
|
-
var DevicePreviewNameSchema =
|
|
585
|
+
var DevicePreviewNameSchema = z11.string().trim().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH);
|
|
576
586
|
var devicePreviewStreamFormatValues = ["jpeg", "h264_annex_b"];
|
|
577
|
-
var DevicePreviewStreamFormatSchema =
|
|
587
|
+
var DevicePreviewStreamFormatSchema = z11.enum(devicePreviewStreamFormatValues);
|
|
578
588
|
var devicePreviewPlatformValues = ["ios", "android"];
|
|
579
|
-
var DevicePreviewPlatformSchema =
|
|
580
|
-
var DevicePreviewToolSuggestionsSchema =
|
|
581
|
-
var DevicePreviewToolStatusSchema =
|
|
582
|
-
|
|
583
|
-
supported:
|
|
584
|
-
available:
|
|
585
|
-
interactive:
|
|
586
|
-
command:
|
|
587
|
-
version:
|
|
588
|
-
error:
|
|
589
|
+
var DevicePreviewPlatformSchema = z11.enum(devicePreviewPlatformValues);
|
|
590
|
+
var DevicePreviewToolSuggestionsSchema = z11.array(z11.string().min(1).max(DEVICE_PREVIEW_PATH_MAX_LENGTH)).max(32).optional();
|
|
591
|
+
var DevicePreviewToolStatusSchema = z11.union([
|
|
592
|
+
z11.object({
|
|
593
|
+
supported: z11.literal(false),
|
|
594
|
+
available: z11.literal(false),
|
|
595
|
+
interactive: z11.literal(false),
|
|
596
|
+
command: z11.never().optional(),
|
|
597
|
+
version: z11.never().optional(),
|
|
598
|
+
error: z11.string().min(1).max(DEVICE_PREVIEW_ERROR_MAX_LENGTH),
|
|
589
599
|
suggestions: DevicePreviewToolSuggestionsSchema
|
|
590
600
|
}).strict(),
|
|
591
|
-
|
|
592
|
-
supported:
|
|
593
|
-
available:
|
|
594
|
-
interactive:
|
|
595
|
-
command:
|
|
596
|
-
version:
|
|
597
|
-
error:
|
|
601
|
+
z11.object({
|
|
602
|
+
supported: z11.literal(true),
|
|
603
|
+
available: z11.literal(false),
|
|
604
|
+
interactive: z11.literal(false),
|
|
605
|
+
command: z11.string().min(1).max(DEVICE_PREVIEW_PATH_MAX_LENGTH).optional(),
|
|
606
|
+
version: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH).optional(),
|
|
607
|
+
error: z11.string().min(1).max(DEVICE_PREVIEW_ERROR_MAX_LENGTH),
|
|
598
608
|
suggestions: DevicePreviewToolSuggestionsSchema
|
|
599
609
|
}).strict(),
|
|
600
|
-
|
|
601
|
-
supported:
|
|
602
|
-
available:
|
|
603
|
-
interactive:
|
|
604
|
-
command:
|
|
605
|
-
version:
|
|
606
|
-
error:
|
|
610
|
+
z11.object({
|
|
611
|
+
supported: z11.literal(true),
|
|
612
|
+
available: z11.literal(true),
|
|
613
|
+
interactive: z11.literal(true),
|
|
614
|
+
command: z11.string().min(1).max(DEVICE_PREVIEW_PATH_MAX_LENGTH),
|
|
615
|
+
version: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH).optional(),
|
|
616
|
+
error: z11.never().optional(),
|
|
607
617
|
suggestions: DevicePreviewToolSuggestionsSchema
|
|
608
618
|
}).strict()
|
|
609
619
|
]);
|
|
610
|
-
var DevicePreviewCapabilitySchema =
|
|
620
|
+
var DevicePreviewCapabilitySchema = z11.object({
|
|
611
621
|
ios: DevicePreviewToolStatusSchema,
|
|
612
622
|
android: DevicePreviewToolStatusSchema
|
|
613
623
|
}).strict();
|
|
614
|
-
var DevicePreviewTargetBaseSchema =
|
|
624
|
+
var DevicePreviewTargetBaseSchema = z11.object({
|
|
615
625
|
targetId: IdSchema,
|
|
616
626
|
platform: DevicePreviewPlatformSchema,
|
|
617
|
-
name:
|
|
618
|
-
model:
|
|
619
|
-
osVersion:
|
|
620
|
-
interactive:
|
|
627
|
+
name: z11.string().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH),
|
|
628
|
+
model: z11.string().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH),
|
|
629
|
+
osVersion: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH),
|
|
630
|
+
interactive: z11.boolean()
|
|
621
631
|
});
|
|
622
|
-
var DevicePreviewScreenEdgeSchema =
|
|
623
|
-
var DevicePreviewTargetSchema =
|
|
632
|
+
var DevicePreviewScreenEdgeSchema = z11.number().int().positive().max(DEVICE_PREVIEW_SCREEN_EDGE_MAX);
|
|
633
|
+
var DevicePreviewTargetSchema = z11.union([
|
|
624
634
|
DevicePreviewTargetBaseSchema.extend({
|
|
625
635
|
width: DevicePreviewScreenEdgeSchema,
|
|
626
636
|
height: DevicePreviewScreenEdgeSchema
|
|
627
637
|
}).strict(),
|
|
628
638
|
DevicePreviewTargetBaseSchema.extend({
|
|
629
|
-
width:
|
|
630
|
-
height:
|
|
639
|
+
width: z11.never().optional(),
|
|
640
|
+
height: z11.never().optional()
|
|
631
641
|
}).strict()
|
|
632
642
|
]);
|
|
633
|
-
var DevicePreviewStateSchema =
|
|
634
|
-
var DevicePreviewSummaryBaseSchema =
|
|
643
|
+
var DevicePreviewStateSchema = z11.enum(["ready", "disconnected"]);
|
|
644
|
+
var DevicePreviewSummaryBaseSchema = z11.object({
|
|
635
645
|
previewId: IdSchema,
|
|
636
646
|
name: DevicePreviewNameSchema,
|
|
637
647
|
platform: DevicePreviewPlatformSchema,
|
|
638
648
|
targetId: IdSchema,
|
|
639
|
-
model:
|
|
640
|
-
osVersion:
|
|
641
|
-
interactive:
|
|
642
|
-
createdAt:
|
|
643
|
-
updatedAt:
|
|
649
|
+
model: z11.string().min(1).max(DEVICE_PREVIEW_NAME_MAX_LENGTH),
|
|
650
|
+
osVersion: z11.string().min(1).max(DEVICE_PREVIEW_VERSION_MAX_LENGTH),
|
|
651
|
+
interactive: z11.boolean(),
|
|
652
|
+
createdAt: z11.number().int().nonnegative(),
|
|
653
|
+
updatedAt: z11.number().int().nonnegative()
|
|
644
654
|
});
|
|
645
|
-
var DevicePreviewSummarySchema =
|
|
655
|
+
var DevicePreviewSummarySchema = z11.discriminatedUnion("state", [
|
|
646
656
|
DevicePreviewSummaryBaseSchema.extend({
|
|
647
|
-
state:
|
|
648
|
-
error:
|
|
657
|
+
state: z11.literal("ready"),
|
|
658
|
+
error: z11.never().optional()
|
|
649
659
|
}).strict(),
|
|
650
660
|
DevicePreviewSummaryBaseSchema.extend({
|
|
651
|
-
state:
|
|
652
|
-
error:
|
|
661
|
+
state: z11.literal("disconnected"),
|
|
662
|
+
error: z11.never().optional()
|
|
653
663
|
}).strict()
|
|
654
664
|
]);
|
|
655
|
-
var DevicePreviewJpegStreamProfileSchema =
|
|
656
|
-
format:
|
|
657
|
-
maxFps:
|
|
665
|
+
var DevicePreviewJpegStreamProfileSchema = z11.object({
|
|
666
|
+
format: z11.literal("jpeg"),
|
|
667
|
+
maxFps: z11.number().int().min(1).max(30).optional()
|
|
658
668
|
}).strict();
|
|
659
|
-
var DevicePreviewH264StreamProfileSchema =
|
|
660
|
-
format:
|
|
669
|
+
var DevicePreviewH264StreamProfileSchema = z11.object({
|
|
670
|
+
format: z11.literal("h264_annex_b")
|
|
661
671
|
}).strict();
|
|
662
|
-
var DevicePreviewStreamProfileSchema =
|
|
672
|
+
var DevicePreviewStreamProfileSchema = z11.discriminatedUnion("format", [
|
|
663
673
|
DevicePreviewJpegStreamProfileSchema,
|
|
664
674
|
DevicePreviewH264StreamProfileSchema
|
|
665
675
|
]);
|
|
@@ -670,10 +680,10 @@ var devicePreviewStreamStopReasonValues = [
|
|
|
670
680
|
"relay_shutdown",
|
|
671
681
|
"stream_error"
|
|
672
682
|
];
|
|
673
|
-
var DevicePreviewStreamStopReasonSchema =
|
|
674
|
-
var NormalizedCoordinateSchema =
|
|
683
|
+
var DevicePreviewStreamStopReasonSchema = z11.enum(devicePreviewStreamStopReasonValues);
|
|
684
|
+
var NormalizedCoordinateSchema = z11.number().finite().min(0).max(1);
|
|
675
685
|
var devicePreviewTouchPhaseValues = ["down", "move", "up"];
|
|
676
|
-
var DevicePreviewTouchPhaseSchema =
|
|
686
|
+
var DevicePreviewTouchPhaseSchema = z11.enum(devicePreviewTouchPhaseValues);
|
|
677
687
|
var devicePreviewOrientationValues = [
|
|
678
688
|
"portrait",
|
|
679
689
|
"landscape_left",
|
|
@@ -681,102 +691,102 @@ var devicePreviewOrientationValues = [
|
|
|
681
691
|
"portrait_upside_down",
|
|
682
692
|
"auto"
|
|
683
693
|
];
|
|
684
|
-
var DevicePreviewOrientationSchema =
|
|
685
|
-
var DevicePreviewInputSchema =
|
|
686
|
-
|
|
687
|
-
kind:
|
|
694
|
+
var DevicePreviewOrientationSchema = z11.enum(devicePreviewOrientationValues);
|
|
695
|
+
var DevicePreviewInputSchema = z11.discriminatedUnion("kind", [
|
|
696
|
+
z11.object({
|
|
697
|
+
kind: z11.literal("touch"),
|
|
688
698
|
phase: DevicePreviewTouchPhaseSchema,
|
|
689
699
|
x: NormalizedCoordinateSchema,
|
|
690
700
|
y: NormalizedCoordinateSchema
|
|
691
701
|
}).strict(),
|
|
692
|
-
|
|
693
|
-
kind:
|
|
694
|
-
text:
|
|
702
|
+
z11.object({
|
|
703
|
+
kind: z11.literal("text"),
|
|
704
|
+
text: z11.string().min(1).max(DEVICE_PREVIEW_TEXT_MAX_LENGTH)
|
|
695
705
|
}).strict(),
|
|
696
|
-
|
|
697
|
-
kind:
|
|
698
|
-
button:
|
|
706
|
+
z11.object({
|
|
707
|
+
kind: z11.literal("button"),
|
|
708
|
+
button: z11.enum(["home", "back"])
|
|
699
709
|
}).strict(),
|
|
700
|
-
|
|
701
|
-
kind:
|
|
710
|
+
z11.object({
|
|
711
|
+
kind: z11.literal("orientation"),
|
|
702
712
|
orientation: DevicePreviewOrientationSchema
|
|
703
713
|
}).strict()
|
|
704
714
|
]);
|
|
705
|
-
var DevicePreviewStreamRegisterSchema =
|
|
706
|
-
type:
|
|
715
|
+
var DevicePreviewStreamRegisterSchema = z11.object({
|
|
716
|
+
type: z11.literal("device_preview_stream_register"),
|
|
707
717
|
proxyId: IdSchema,
|
|
708
718
|
connectionId: IdSchema
|
|
709
719
|
}).strict();
|
|
710
|
-
var DevicePreviewStreamRegisterResponseSchema =
|
|
711
|
-
|
|
712
|
-
type:
|
|
713
|
-
success:
|
|
720
|
+
var DevicePreviewStreamRegisterResponseSchema = z11.discriminatedUnion("success", [
|
|
721
|
+
z11.object({
|
|
722
|
+
type: z11.literal("device_preview_stream_register_response"),
|
|
723
|
+
success: z11.literal(true)
|
|
714
724
|
}).strict(),
|
|
715
|
-
|
|
716
|
-
type:
|
|
717
|
-
success:
|
|
718
|
-
error:
|
|
725
|
+
z11.object({
|
|
726
|
+
type: z11.literal("device_preview_stream_register_response"),
|
|
727
|
+
success: z11.literal(false),
|
|
728
|
+
error: z11.string().min(1).max(DEVICE_PREVIEW_ERROR_MAX_LENGTH)
|
|
719
729
|
}).strict()
|
|
720
730
|
]);
|
|
721
|
-
var DevicePreviewStreamFlowBaseSchema =
|
|
722
|
-
type:
|
|
731
|
+
var DevicePreviewStreamFlowBaseSchema = z11.object({
|
|
732
|
+
type: z11.literal("device_preview_stream_flow"),
|
|
723
733
|
streamId: IdSchema
|
|
724
734
|
});
|
|
725
|
-
var DevicePreviewStreamFlowSchema =
|
|
735
|
+
var DevicePreviewStreamFlowSchema = z11.discriminatedUnion("paused", [
|
|
726
736
|
DevicePreviewStreamFlowBaseSchema.extend({
|
|
727
|
-
paused:
|
|
728
|
-
resyncRequired:
|
|
737
|
+
paused: z11.literal(true),
|
|
738
|
+
resyncRequired: z11.literal(false)
|
|
729
739
|
}).strict(),
|
|
730
740
|
DevicePreviewStreamFlowBaseSchema.extend({
|
|
731
|
-
paused:
|
|
732
|
-
resyncRequired:
|
|
741
|
+
paused: z11.literal(false),
|
|
742
|
+
resyncRequired: z11.boolean()
|
|
733
743
|
}).strict()
|
|
734
744
|
]);
|
|
735
|
-
var DevicePreviewStreamServerMessageSchema =
|
|
745
|
+
var DevicePreviewStreamServerMessageSchema = z11.union([
|
|
736
746
|
DevicePreviewStreamRegisterResponseSchema,
|
|
737
747
|
DevicePreviewStreamFlowSchema
|
|
738
748
|
]);
|
|
739
749
|
|
|
740
750
|
// ../../packages/shared/dist/schemas/voice-stream.js
|
|
741
|
-
import { z as
|
|
742
|
-
var VoiceAsrAudioEncodingSchema =
|
|
743
|
-
var VoiceAsrStartMessageSchema =
|
|
744
|
-
type:
|
|
745
|
-
sessionId:
|
|
746
|
-
attemptId:
|
|
747
|
-
sampleRate:
|
|
751
|
+
import { z as z12 } from "zod";
|
|
752
|
+
var VoiceAsrAudioEncodingSchema = z12.enum(["pcm_s16le", "mulaw"]);
|
|
753
|
+
var VoiceAsrStartMessageSchema = z12.object({
|
|
754
|
+
type: z12.literal("start"),
|
|
755
|
+
sessionId: z12.string().min(1),
|
|
756
|
+
attemptId: z12.string().min(1),
|
|
757
|
+
sampleRate: z12.number().int().positive(),
|
|
748
758
|
encoding: VoiceAsrAudioEncodingSchema
|
|
749
759
|
});
|
|
750
|
-
var VoiceAsrStopMessageSchema =
|
|
751
|
-
type:
|
|
752
|
-
attemptId:
|
|
760
|
+
var VoiceAsrStopMessageSchema = z12.object({
|
|
761
|
+
type: z12.literal("stop"),
|
|
762
|
+
attemptId: z12.string().min(1)
|
|
753
763
|
});
|
|
754
|
-
var VoiceAsrClientMessageSchema =
|
|
764
|
+
var VoiceAsrClientMessageSchema = z12.discriminatedUnion("type", [
|
|
755
765
|
VoiceAsrStartMessageSchema,
|
|
756
766
|
VoiceAsrStopMessageSchema
|
|
757
767
|
]);
|
|
758
|
-
var VoiceAsrServerMessageSchema =
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
type:
|
|
762
|
-
attemptId:
|
|
763
|
-
encodedBytes:
|
|
764
|
-
pcmBytes:
|
|
765
|
-
chunks:
|
|
766
|
-
}),
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
type:
|
|
771
|
-
attemptId:
|
|
772
|
-
code:
|
|
773
|
-
reason:
|
|
768
|
+
var VoiceAsrServerMessageSchema = z12.discriminatedUnion("type", [
|
|
769
|
+
z12.object({ type: z12.literal("ready"), attemptId: z12.string().min(1) }),
|
|
770
|
+
z12.object({
|
|
771
|
+
type: z12.literal("audio_ack"),
|
|
772
|
+
attemptId: z12.string().min(1),
|
|
773
|
+
encodedBytes: z12.number().int().nonnegative(),
|
|
774
|
+
pcmBytes: z12.number().int().nonnegative(),
|
|
775
|
+
chunks: z12.number().int().nonnegative()
|
|
776
|
+
}),
|
|
777
|
+
z12.object({ type: z12.literal("partial"), attemptId: z12.string().min(1), text: z12.string() }),
|
|
778
|
+
z12.object({ type: z12.literal("final"), attemptId: z12.string().min(1), text: z12.string() }),
|
|
779
|
+
z12.object({
|
|
780
|
+
type: z12.literal("closed"),
|
|
781
|
+
attemptId: z12.string().min(1),
|
|
782
|
+
code: z12.number().int().optional(),
|
|
783
|
+
reason: z12.string().optional()
|
|
774
784
|
}),
|
|
775
|
-
|
|
776
|
-
type:
|
|
777
|
-
attemptId:
|
|
778
|
-
error:
|
|
779
|
-
errorCode:
|
|
785
|
+
z12.object({
|
|
786
|
+
type: z12.literal("error"),
|
|
787
|
+
attemptId: z12.string().min(1),
|
|
788
|
+
error: z12.string().optional(),
|
|
789
|
+
errorCode: z12.string().optional()
|
|
780
790
|
})
|
|
781
791
|
]);
|
|
782
792
|
|
|
@@ -886,7 +896,7 @@ function summarizeToolActivity(toolName, input) {
|
|
|
886
896
|
}
|
|
887
897
|
|
|
888
898
|
// ../../packages/shared/dist/schemas/relay-control.js
|
|
889
|
-
import { z as
|
|
899
|
+
import { z as z13 } from "zod";
|
|
890
900
|
|
|
891
901
|
// ../../packages/shared/dist/constants/relay-errors.js
|
|
892
902
|
var RelayErrorCode = {
|
|
@@ -901,95 +911,95 @@ var RelayErrorCode = {
|
|
|
901
911
|
|
|
902
912
|
// ../../packages/shared/dist/schemas/relay-control.js
|
|
903
913
|
var RELAY_CONTROL_PROTOCOL_VERSION = 1;
|
|
904
|
-
var ProxyInfoSchema =
|
|
914
|
+
var ProxyInfoSchema = z13.object({
|
|
905
915
|
proxyId: IdSchema,
|
|
906
|
-
name:
|
|
907
|
-
version:
|
|
908
|
-
online:
|
|
909
|
-
sessions:
|
|
916
|
+
name: z13.string().optional(),
|
|
917
|
+
version: z13.string().min(1).max(64),
|
|
918
|
+
online: z13.boolean(),
|
|
919
|
+
sessions: z13.array(z13.string())
|
|
910
920
|
});
|
|
911
|
-
var RelayClientInfoSchema =
|
|
921
|
+
var RelayClientInfoSchema = z13.object({
|
|
912
922
|
clientId: IdSchema,
|
|
913
923
|
proxyId: IdSchema.optional(),
|
|
914
|
-
connectedAt:
|
|
915
|
-
current:
|
|
916
|
-
userAgent:
|
|
917
|
-
platform:
|
|
918
|
-
maxTouchPoints:
|
|
919
|
-
browserName:
|
|
920
|
-
osName:
|
|
921
|
-
deviceKind:
|
|
922
|
-
remoteAddress:
|
|
924
|
+
connectedAt: z13.number().int().nonnegative(),
|
|
925
|
+
current: z13.boolean().optional(),
|
|
926
|
+
userAgent: z13.string().optional(),
|
|
927
|
+
platform: z13.string().optional(),
|
|
928
|
+
maxTouchPoints: z13.number().int().nonnegative().optional(),
|
|
929
|
+
browserName: z13.string().min(1),
|
|
930
|
+
osName: z13.string().min(1),
|
|
931
|
+
deviceKind: z13.enum(["desktop", "tablet", "phone", "unknown"]),
|
|
932
|
+
remoteAddress: z13.string().optional()
|
|
923
933
|
});
|
|
924
|
-
var AgentCliAvailabilitySchema =
|
|
925
|
-
available:
|
|
926
|
-
command:
|
|
927
|
-
error:
|
|
928
|
-
suggestions:
|
|
934
|
+
var AgentCliAvailabilitySchema = z13.object({
|
|
935
|
+
available: z13.boolean(),
|
|
936
|
+
command: z13.string().optional(),
|
|
937
|
+
error: z13.string().optional(),
|
|
938
|
+
suggestions: z13.array(z13.string()).optional()
|
|
929
939
|
});
|
|
930
|
-
var AgentCliStatusSchema =
|
|
940
|
+
var AgentCliStatusSchema = z13.object({
|
|
931
941
|
claude: AgentCliAvailabilitySchema,
|
|
932
942
|
codex: AgentCliAvailabilitySchema,
|
|
933
943
|
kimi: AgentCliAvailabilitySchema
|
|
934
944
|
});
|
|
935
|
-
var DirEntrySchema =
|
|
936
|
-
var FileTreeGroupSchema =
|
|
937
|
-
path:
|
|
938
|
-
entries:
|
|
945
|
+
var DirEntrySchema = z13.object({ name: z13.string(), isDir: z13.boolean() });
|
|
946
|
+
var FileTreeGroupSchema = z13.object({
|
|
947
|
+
path: z13.string(),
|
|
948
|
+
entries: z13.array(DirEntrySchema)
|
|
939
949
|
});
|
|
940
|
-
var CommandEntrySchema =
|
|
941
|
-
name:
|
|
942
|
-
description:
|
|
943
|
-
argumentHint:
|
|
944
|
-
source:
|
|
950
|
+
var CommandEntrySchema = z13.object({
|
|
951
|
+
name: z13.string(),
|
|
952
|
+
description: z13.string(),
|
|
953
|
+
argumentHint: z13.string().optional(),
|
|
954
|
+
source: z13.string()
|
|
945
955
|
});
|
|
946
|
-
var HistorySessionSchema =
|
|
947
|
-
id:
|
|
948
|
-
title:
|
|
949
|
-
projectDir:
|
|
950
|
-
updatedAt:
|
|
951
|
-
provider:
|
|
952
|
-
preferredMode:
|
|
956
|
+
var HistorySessionSchema = z13.object({
|
|
957
|
+
id: z13.string(),
|
|
958
|
+
title: z13.string(),
|
|
959
|
+
projectDir: z13.string(),
|
|
960
|
+
updatedAt: z13.number(),
|
|
961
|
+
provider: z13.enum(providerValues),
|
|
962
|
+
preferredMode: z13.enum(sessionModeValues).optional()
|
|
953
963
|
});
|
|
954
964
|
var SessionHistoryPositionShape = {
|
|
955
|
-
timestamp:
|
|
956
|
-
cursor:
|
|
965
|
+
timestamp: z13.number().optional(),
|
|
966
|
+
cursor: z13.string().optional()
|
|
957
967
|
};
|
|
958
|
-
var SessionHistoryMessageSchema =
|
|
959
|
-
|
|
960
|
-
role:
|
|
961
|
-
text:
|
|
968
|
+
var SessionHistoryMessageSchema = z13.discriminatedUnion("role", [
|
|
969
|
+
z13.object({
|
|
970
|
+
role: z13.enum(["user", "assistant", "system"]),
|
|
971
|
+
text: z13.string(),
|
|
962
972
|
...SessionHistoryPositionShape
|
|
963
973
|
}),
|
|
964
|
-
|
|
965
|
-
role:
|
|
966
|
-
text:
|
|
974
|
+
z13.object({
|
|
975
|
+
role: z13.literal("activity"),
|
|
976
|
+
text: z13.string(),
|
|
967
977
|
toolId: IdSchema,
|
|
968
|
-
toolName:
|
|
969
|
-
parameters:
|
|
970
|
-
status:
|
|
978
|
+
toolName: z13.string(),
|
|
979
|
+
parameters: z13.record(z13.string(), z13.unknown()).optional(),
|
|
980
|
+
status: z13.enum(["running", "done", "error"]),
|
|
971
981
|
...SessionHistoryPositionShape
|
|
972
982
|
})
|
|
973
983
|
]);
|
|
974
984
|
var RequestIdShape = { requestId: IdSchema.optional() };
|
|
975
985
|
var RequiredRequestIdShape = { requestId: IdSchema };
|
|
976
|
-
var ControlErrorCodeSchema =
|
|
986
|
+
var ControlErrorCodeSchema = z13.enum(Object.values(ControlErrorCode));
|
|
977
987
|
var RequestErrorShape = {
|
|
978
|
-
error:
|
|
988
|
+
error: z13.string().optional(),
|
|
979
989
|
errorCode: ControlErrorCodeSchema.optional()
|
|
980
990
|
};
|
|
981
991
|
var RequiredRequestErrorShape = {
|
|
982
|
-
error:
|
|
992
|
+
error: z13.string().min(1),
|
|
983
993
|
errorCode: ControlErrorCodeSchema
|
|
984
994
|
};
|
|
985
|
-
var RemoteFileDispositionSchema =
|
|
986
|
-
var RemoteFileUploadKindSchema =
|
|
995
|
+
var RemoteFileDispositionSchema = z13.enum(["inline", "download"]);
|
|
996
|
+
var RemoteFileUploadKindSchema = z13.enum(["clipboard_image", "file"]);
|
|
987
997
|
function control(type, shape, directions) {
|
|
988
998
|
return {
|
|
989
999
|
type,
|
|
990
1000
|
directions: new Set(Array.isArray(directions) ? directions : directions ? [directions] : []),
|
|
991
|
-
schema:
|
|
992
|
-
type:
|
|
1001
|
+
schema: z13.object({
|
|
1002
|
+
type: z13.literal(type),
|
|
993
1003
|
...shape ?? {}
|
|
994
1004
|
})
|
|
995
1005
|
};
|
|
@@ -998,8 +1008,8 @@ function strictControl(type, shape, directions) {
|
|
|
998
1008
|
return {
|
|
999
1009
|
type,
|
|
1000
1010
|
directions: new Set(Array.isArray(directions) ? directions : directions ? [directions] : []),
|
|
1001
|
-
schema:
|
|
1002
|
-
type:
|
|
1011
|
+
schema: z13.object({
|
|
1012
|
+
type: z13.literal(type),
|
|
1003
1013
|
...shape
|
|
1004
1014
|
}).strict()
|
|
1005
1015
|
};
|
|
@@ -1011,300 +1021,300 @@ function controlSchema(type, schema, directions) {
|
|
|
1011
1021
|
schema
|
|
1012
1022
|
};
|
|
1013
1023
|
}
|
|
1014
|
-
var ProxySelectResponseSchema =
|
|
1015
|
-
|
|
1016
|
-
type:
|
|
1024
|
+
var ProxySelectResponseSchema = z13.discriminatedUnion("success", [
|
|
1025
|
+
z13.object({
|
|
1026
|
+
type: z13.literal("proxy_select_response"),
|
|
1017
1027
|
...RequestIdShape,
|
|
1018
|
-
success:
|
|
1028
|
+
success: z13.literal(true),
|
|
1019
1029
|
proxyId: IdSchema,
|
|
1020
1030
|
bindingId: IdSchema
|
|
1021
1031
|
}).strict(),
|
|
1022
|
-
|
|
1023
|
-
type:
|
|
1032
|
+
z13.object({
|
|
1033
|
+
type: z13.literal("proxy_select_response"),
|
|
1024
1034
|
...RequestIdShape,
|
|
1025
|
-
success:
|
|
1035
|
+
success: z13.literal(false),
|
|
1026
1036
|
...RequestErrorShape
|
|
1027
1037
|
}).strict()
|
|
1028
1038
|
]);
|
|
1029
|
-
var ClientRegisterResponseSchema =
|
|
1030
|
-
|
|
1031
|
-
type:
|
|
1032
|
-
protocolVersion:
|
|
1033
|
-
status:
|
|
1039
|
+
var ClientRegisterResponseSchema = z13.discriminatedUnion("status", [
|
|
1040
|
+
z13.object({
|
|
1041
|
+
type: z13.literal("client_register_response"),
|
|
1042
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1043
|
+
status: z13.literal("restored"),
|
|
1034
1044
|
proxyId: IdSchema,
|
|
1035
1045
|
bindingId: IdSchema
|
|
1036
1046
|
}).strict(),
|
|
1037
|
-
|
|
1038
|
-
type:
|
|
1039
|
-
protocolVersion:
|
|
1040
|
-
status:
|
|
1047
|
+
z13.object({
|
|
1048
|
+
type: z13.literal("client_register_response"),
|
|
1049
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1050
|
+
status: z13.literal("proxy_offline"),
|
|
1041
1051
|
proxyId: IdSchema,
|
|
1042
1052
|
bindingId: IdSchema
|
|
1043
1053
|
}).strict(),
|
|
1044
|
-
|
|
1045
|
-
type:
|
|
1046
|
-
protocolVersion:
|
|
1047
|
-
status:
|
|
1054
|
+
z13.object({
|
|
1055
|
+
type: z13.literal("client_register_response"),
|
|
1056
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1057
|
+
status: z13.literal("new")
|
|
1048
1058
|
}).strict()
|
|
1049
1059
|
]);
|
|
1050
|
-
var PreviewCreateResponseSchema =
|
|
1051
|
-
|
|
1052
|
-
type:
|
|
1060
|
+
var PreviewCreateResponseSchema = z13.discriminatedUnion("accepted", [
|
|
1061
|
+
z13.object({
|
|
1062
|
+
type: z13.literal("preview_create_response"),
|
|
1053
1063
|
...RequiredRequestIdShape,
|
|
1054
1064
|
scope: PreviewScopeSchema,
|
|
1055
1065
|
operationId: IdSchema,
|
|
1056
|
-
accepted:
|
|
1066
|
+
accepted: z13.literal(true),
|
|
1057
1067
|
previewId: IdSchema
|
|
1058
1068
|
}).strict(),
|
|
1059
|
-
|
|
1060
|
-
type:
|
|
1069
|
+
z13.object({
|
|
1070
|
+
type: z13.literal("preview_create_response"),
|
|
1061
1071
|
...RequiredRequestIdShape,
|
|
1062
1072
|
scope: PreviewScopeSchema,
|
|
1063
1073
|
operationId: IdSchema,
|
|
1064
|
-
accepted:
|
|
1074
|
+
accepted: z13.literal(false),
|
|
1065
1075
|
...RequiredRequestErrorShape
|
|
1066
1076
|
}).strict()
|
|
1067
1077
|
]);
|
|
1068
|
-
var DevicePreviewCreateResponseSchema =
|
|
1069
|
-
|
|
1070
|
-
type:
|
|
1078
|
+
var DevicePreviewCreateResponseSchema = z13.discriminatedUnion("accepted", [
|
|
1079
|
+
z13.object({
|
|
1080
|
+
type: z13.literal("device_preview_create_response"),
|
|
1071
1081
|
...RequiredRequestIdShape,
|
|
1072
1082
|
scope: PreviewScopeSchema,
|
|
1073
1083
|
operationId: IdSchema,
|
|
1074
|
-
accepted:
|
|
1084
|
+
accepted: z13.literal(true),
|
|
1075
1085
|
previewId: IdSchema
|
|
1076
1086
|
}).strict(),
|
|
1077
|
-
|
|
1078
|
-
type:
|
|
1087
|
+
z13.object({
|
|
1088
|
+
type: z13.literal("device_preview_create_response"),
|
|
1079
1089
|
...RequiredRequestIdShape,
|
|
1080
1090
|
scope: PreviewScopeSchema,
|
|
1081
1091
|
operationId: IdSchema,
|
|
1082
|
-
accepted:
|
|
1092
|
+
accepted: z13.literal(false),
|
|
1083
1093
|
...RequiredRequestErrorShape
|
|
1084
1094
|
}).strict()
|
|
1085
1095
|
]);
|
|
1086
|
-
var PreviewCapabilityResponseSchema =
|
|
1087
|
-
|
|
1088
|
-
type:
|
|
1096
|
+
var PreviewCapabilityResponseSchema = z13.discriminatedUnion("success", [
|
|
1097
|
+
z13.object({
|
|
1098
|
+
type: z13.literal("preview_capability_response"),
|
|
1089
1099
|
...RequiredRequestIdShape,
|
|
1090
1100
|
scope: PreviewScopeSchema,
|
|
1091
|
-
success:
|
|
1101
|
+
success: z13.literal(true),
|
|
1092
1102
|
capability: WebPreviewCapabilitySchema
|
|
1093
1103
|
}).strict(),
|
|
1094
|
-
|
|
1095
|
-
type:
|
|
1104
|
+
z13.object({
|
|
1105
|
+
type: z13.literal("preview_capability_response"),
|
|
1096
1106
|
...RequiredRequestIdShape,
|
|
1097
1107
|
scope: PreviewScopeSchema,
|
|
1098
|
-
success:
|
|
1108
|
+
success: z13.literal(false),
|
|
1099
1109
|
...RequiredRequestErrorShape
|
|
1100
1110
|
}).strict()
|
|
1101
1111
|
]);
|
|
1102
|
-
var DevicePreviewCapabilityResponseSchema =
|
|
1103
|
-
|
|
1104
|
-
type:
|
|
1112
|
+
var DevicePreviewCapabilityResponseSchema = z13.discriminatedUnion("success", [
|
|
1113
|
+
z13.object({
|
|
1114
|
+
type: z13.literal("device_preview_capability_response"),
|
|
1105
1115
|
...RequiredRequestIdShape,
|
|
1106
1116
|
scope: PreviewScopeSchema,
|
|
1107
|
-
success:
|
|
1117
|
+
success: z13.literal(true),
|
|
1108
1118
|
capability: DevicePreviewCapabilitySchema
|
|
1109
1119
|
}).strict(),
|
|
1110
|
-
|
|
1111
|
-
type:
|
|
1120
|
+
z13.object({
|
|
1121
|
+
type: z13.literal("device_preview_capability_response"),
|
|
1112
1122
|
...RequiredRequestIdShape,
|
|
1113
1123
|
scope: PreviewScopeSchema,
|
|
1114
|
-
success:
|
|
1124
|
+
success: z13.literal(false),
|
|
1115
1125
|
...RequiredRequestErrorShape
|
|
1116
1126
|
}).strict()
|
|
1117
1127
|
]);
|
|
1118
|
-
var ProxyInfoRequestSchema =
|
|
1119
|
-
type:
|
|
1128
|
+
var ProxyInfoRequestSchema = z13.object({
|
|
1129
|
+
type: z13.literal("proxy_info_request"),
|
|
1120
1130
|
...RequestIdShape
|
|
1121
1131
|
}).strict();
|
|
1122
|
-
var ProxyInfoResponseSchema =
|
|
1123
|
-
type:
|
|
1132
|
+
var ProxyInfoResponseSchema = z13.object({
|
|
1133
|
+
type: z13.literal("proxy_info"),
|
|
1124
1134
|
...RequestIdShape,
|
|
1125
|
-
homePath:
|
|
1135
|
+
homePath: z13.string(),
|
|
1126
1136
|
agentCli: AgentCliStatusSchema
|
|
1127
1137
|
}).strict();
|
|
1128
|
-
var PreviewStaticInspectResponseSchema =
|
|
1129
|
-
|
|
1130
|
-
type:
|
|
1138
|
+
var PreviewStaticInspectResponseSchema = z13.discriminatedUnion("success", [
|
|
1139
|
+
z13.object({
|
|
1140
|
+
type: z13.literal("preview_static_inspect_response"),
|
|
1131
1141
|
...RequiredRequestIdShape,
|
|
1132
1142
|
scope: PreviewScopeSchema,
|
|
1133
|
-
success:
|
|
1143
|
+
success: z13.literal(true),
|
|
1134
1144
|
entryPath: WebPreviewPathSchema.optional(),
|
|
1135
1145
|
htmlEntries: PreviewHtmlEntriesSchema
|
|
1136
1146
|
}).strict(),
|
|
1137
|
-
|
|
1138
|
-
type:
|
|
1147
|
+
z13.object({
|
|
1148
|
+
type: z13.literal("preview_static_inspect_response"),
|
|
1139
1149
|
...RequiredRequestIdShape,
|
|
1140
1150
|
scope: PreviewScopeSchema,
|
|
1141
|
-
success:
|
|
1151
|
+
success: z13.literal(false),
|
|
1142
1152
|
...RequiredRequestErrorShape
|
|
1143
1153
|
}).strict()
|
|
1144
1154
|
]);
|
|
1145
|
-
var PreviewRenameResponseSchema =
|
|
1146
|
-
|
|
1147
|
-
type:
|
|
1155
|
+
var PreviewRenameResponseSchema = z13.discriminatedUnion("success", [
|
|
1156
|
+
z13.object({
|
|
1157
|
+
type: z13.literal("preview_rename_response"),
|
|
1148
1158
|
...RequiredRequestIdShape,
|
|
1149
1159
|
scope: PreviewScopeSchema,
|
|
1150
1160
|
operationId: IdSchema,
|
|
1151
1161
|
previewId: IdSchema,
|
|
1152
|
-
success:
|
|
1162
|
+
success: z13.literal(true)
|
|
1153
1163
|
}).strict(),
|
|
1154
|
-
|
|
1155
|
-
type:
|
|
1164
|
+
z13.object({
|
|
1165
|
+
type: z13.literal("preview_rename_response"),
|
|
1156
1166
|
...RequiredRequestIdShape,
|
|
1157
1167
|
scope: PreviewScopeSchema,
|
|
1158
1168
|
operationId: IdSchema,
|
|
1159
1169
|
previewId: IdSchema,
|
|
1160
|
-
success:
|
|
1170
|
+
success: z13.literal(false),
|
|
1161
1171
|
...RequiredRequestErrorShape
|
|
1162
1172
|
}).strict()
|
|
1163
1173
|
]);
|
|
1164
|
-
var PreviewReconnectResponseSchema =
|
|
1165
|
-
|
|
1166
|
-
type:
|
|
1174
|
+
var PreviewReconnectResponseSchema = z13.discriminatedUnion("success", [
|
|
1175
|
+
z13.object({
|
|
1176
|
+
type: z13.literal("preview_reconnect_response"),
|
|
1167
1177
|
...RequiredRequestIdShape,
|
|
1168
1178
|
scope: PreviewScopeSchema,
|
|
1169
1179
|
operationId: IdSchema,
|
|
1170
1180
|
previewId: IdSchema,
|
|
1171
|
-
success:
|
|
1181
|
+
success: z13.literal(true)
|
|
1172
1182
|
}).strict(),
|
|
1173
|
-
|
|
1174
|
-
type:
|
|
1183
|
+
z13.object({
|
|
1184
|
+
type: z13.literal("preview_reconnect_response"),
|
|
1175
1185
|
...RequiredRequestIdShape,
|
|
1176
1186
|
scope: PreviewScopeSchema,
|
|
1177
1187
|
operationId: IdSchema,
|
|
1178
1188
|
previewId: IdSchema,
|
|
1179
|
-
success:
|
|
1189
|
+
success: z13.literal(false),
|
|
1180
1190
|
...RequiredRequestErrorShape
|
|
1181
1191
|
}).strict()
|
|
1182
1192
|
]);
|
|
1183
|
-
var PreviewCloseResponseSchema =
|
|
1184
|
-
|
|
1185
|
-
type:
|
|
1193
|
+
var PreviewCloseResponseSchema = z13.discriminatedUnion("success", [
|
|
1194
|
+
z13.object({
|
|
1195
|
+
type: z13.literal("preview_close_response"),
|
|
1186
1196
|
...RequiredRequestIdShape,
|
|
1187
1197
|
scope: PreviewScopeSchema,
|
|
1188
1198
|
operationId: IdSchema,
|
|
1189
1199
|
previewId: IdSchema,
|
|
1190
|
-
success:
|
|
1200
|
+
success: z13.literal(true)
|
|
1191
1201
|
}).strict(),
|
|
1192
|
-
|
|
1193
|
-
type:
|
|
1202
|
+
z13.object({
|
|
1203
|
+
type: z13.literal("preview_close_response"),
|
|
1194
1204
|
...RequiredRequestIdShape,
|
|
1195
1205
|
scope: PreviewScopeSchema,
|
|
1196
1206
|
operationId: IdSchema,
|
|
1197
1207
|
previewId: IdSchema,
|
|
1198
|
-
success:
|
|
1208
|
+
success: z13.literal(false),
|
|
1199
1209
|
...RequiredRequestErrorShape
|
|
1200
1210
|
}).strict()
|
|
1201
1211
|
]);
|
|
1202
|
-
var DevicePreviewTargetsResponseSchema =
|
|
1203
|
-
|
|
1204
|
-
type:
|
|
1212
|
+
var DevicePreviewTargetsResponseSchema = z13.discriminatedUnion("success", [
|
|
1213
|
+
z13.object({
|
|
1214
|
+
type: z13.literal("device_preview_targets_response"),
|
|
1205
1215
|
...RequiredRequestIdShape,
|
|
1206
1216
|
scope: PreviewScopeSchema,
|
|
1207
|
-
success:
|
|
1208
|
-
targets:
|
|
1217
|
+
success: z13.literal(true),
|
|
1218
|
+
targets: z13.array(DevicePreviewTargetSchema).max(1024)
|
|
1209
1219
|
}).strict(),
|
|
1210
|
-
|
|
1211
|
-
type:
|
|
1220
|
+
z13.object({
|
|
1221
|
+
type: z13.literal("device_preview_targets_response"),
|
|
1212
1222
|
...RequiredRequestIdShape,
|
|
1213
1223
|
scope: PreviewScopeSchema,
|
|
1214
|
-
success:
|
|
1224
|
+
success: z13.literal(false),
|
|
1215
1225
|
...RequiredRequestErrorShape
|
|
1216
1226
|
}).strict()
|
|
1217
1227
|
]);
|
|
1218
|
-
var DevicePreviewRenameResponseSchema =
|
|
1219
|
-
|
|
1220
|
-
type:
|
|
1228
|
+
var DevicePreviewRenameResponseSchema = z13.discriminatedUnion("success", [
|
|
1229
|
+
z13.object({
|
|
1230
|
+
type: z13.literal("device_preview_rename_response"),
|
|
1221
1231
|
...RequiredRequestIdShape,
|
|
1222
1232
|
scope: PreviewScopeSchema,
|
|
1223
1233
|
operationId: IdSchema,
|
|
1224
1234
|
previewId: IdSchema,
|
|
1225
|
-
success:
|
|
1235
|
+
success: z13.literal(true)
|
|
1226
1236
|
}).strict(),
|
|
1227
|
-
|
|
1228
|
-
type:
|
|
1237
|
+
z13.object({
|
|
1238
|
+
type: z13.literal("device_preview_rename_response"),
|
|
1229
1239
|
...RequiredRequestIdShape,
|
|
1230
1240
|
scope: PreviewScopeSchema,
|
|
1231
1241
|
operationId: IdSchema,
|
|
1232
1242
|
previewId: IdSchema,
|
|
1233
|
-
success:
|
|
1243
|
+
success: z13.literal(false),
|
|
1234
1244
|
...RequiredRequestErrorShape
|
|
1235
1245
|
}).strict()
|
|
1236
1246
|
]);
|
|
1237
|
-
var DevicePreviewReconnectResponseSchema =
|
|
1238
|
-
|
|
1239
|
-
type:
|
|
1247
|
+
var DevicePreviewReconnectResponseSchema = z13.discriminatedUnion("success", [
|
|
1248
|
+
z13.object({
|
|
1249
|
+
type: z13.literal("device_preview_reconnect_response"),
|
|
1240
1250
|
...RequiredRequestIdShape,
|
|
1241
1251
|
scope: PreviewScopeSchema,
|
|
1242
1252
|
operationId: IdSchema,
|
|
1243
1253
|
previewId: IdSchema,
|
|
1244
|
-
success:
|
|
1254
|
+
success: z13.literal(true)
|
|
1245
1255
|
}).strict(),
|
|
1246
|
-
|
|
1247
|
-
type:
|
|
1256
|
+
z13.object({
|
|
1257
|
+
type: z13.literal("device_preview_reconnect_response"),
|
|
1248
1258
|
...RequiredRequestIdShape,
|
|
1249
1259
|
scope: PreviewScopeSchema,
|
|
1250
1260
|
operationId: IdSchema,
|
|
1251
1261
|
previewId: IdSchema,
|
|
1252
|
-
success:
|
|
1262
|
+
success: z13.literal(false),
|
|
1253
1263
|
...RequiredRequestErrorShape
|
|
1254
1264
|
}).strict()
|
|
1255
1265
|
]);
|
|
1256
|
-
var DevicePreviewCloseResponseSchema =
|
|
1257
|
-
|
|
1258
|
-
type:
|
|
1266
|
+
var DevicePreviewCloseResponseSchema = z13.discriminatedUnion("success", [
|
|
1267
|
+
z13.object({
|
|
1268
|
+
type: z13.literal("device_preview_close_response"),
|
|
1259
1269
|
...RequiredRequestIdShape,
|
|
1260
1270
|
scope: PreviewScopeSchema,
|
|
1261
1271
|
operationId: IdSchema,
|
|
1262
1272
|
previewId: IdSchema,
|
|
1263
|
-
success:
|
|
1273
|
+
success: z13.literal(true)
|
|
1264
1274
|
}).strict(),
|
|
1265
|
-
|
|
1266
|
-
type:
|
|
1275
|
+
z13.object({
|
|
1276
|
+
type: z13.literal("device_preview_close_response"),
|
|
1267
1277
|
...RequiredRequestIdShape,
|
|
1268
1278
|
scope: PreviewScopeSchema,
|
|
1269
1279
|
operationId: IdSchema,
|
|
1270
1280
|
previewId: IdSchema,
|
|
1271
|
-
success:
|
|
1281
|
+
success: z13.literal(false),
|
|
1272
1282
|
...RequiredRequestErrorShape
|
|
1273
1283
|
}).strict()
|
|
1274
1284
|
]);
|
|
1275
|
-
var DevicePreviewStreamUrlResponseSchema =
|
|
1276
|
-
|
|
1277
|
-
type:
|
|
1285
|
+
var DevicePreviewStreamUrlResponseSchema = z13.discriminatedUnion("success", [
|
|
1286
|
+
z13.object({
|
|
1287
|
+
type: z13.literal("device_preview_stream_url_response"),
|
|
1278
1288
|
...RequiredRequestIdShape,
|
|
1279
1289
|
scope: PreviewScopeSchema,
|
|
1280
1290
|
previewId: IdSchema,
|
|
1281
|
-
success:
|
|
1282
|
-
url:
|
|
1291
|
+
success: z13.literal(true),
|
|
1292
|
+
url: z13.string().min(1).max(4096),
|
|
1283
1293
|
leaseId: IdSchema,
|
|
1284
|
-
expiresAt:
|
|
1285
|
-
controlMode:
|
|
1294
|
+
expiresAt: z13.number().int().nonnegative(),
|
|
1295
|
+
controlMode: z13.enum(["controller", "view_only"])
|
|
1286
1296
|
}).strict(),
|
|
1287
|
-
|
|
1288
|
-
type:
|
|
1297
|
+
z13.object({
|
|
1298
|
+
type: z13.literal("device_preview_stream_url_response"),
|
|
1289
1299
|
...RequiredRequestIdShape,
|
|
1290
1300
|
scope: PreviewScopeSchema,
|
|
1291
1301
|
previewId: IdSchema,
|
|
1292
|
-
success:
|
|
1302
|
+
success: z13.literal(false),
|
|
1293
1303
|
...RequiredRequestErrorShape
|
|
1294
1304
|
}).strict()
|
|
1295
1305
|
]);
|
|
1296
1306
|
var DevicePreviewStreamStartResponseBaseShape = {
|
|
1297
|
-
type:
|
|
1307
|
+
type: z13.literal("device_preview_stream_start_response"),
|
|
1298
1308
|
streamId: IdSchema,
|
|
1299
1309
|
leaseId: IdSchema,
|
|
1300
1310
|
previewId: IdSchema
|
|
1301
1311
|
};
|
|
1302
|
-
var DevicePreviewStreamStartSuccessSchema =
|
|
1312
|
+
var DevicePreviewStreamStartSuccessSchema = z13.object({
|
|
1303
1313
|
...DevicePreviewStreamStartResponseBaseShape,
|
|
1304
|
-
success:
|
|
1314
|
+
success: z13.literal(true),
|
|
1305
1315
|
format: DevicePreviewStreamFormatSchema,
|
|
1306
|
-
width:
|
|
1307
|
-
height:
|
|
1316
|
+
width: z13.number().int().positive().max(16384).optional(),
|
|
1317
|
+
height: z13.number().int().positive().max(16384).optional()
|
|
1308
1318
|
}).strict().superRefine((response, context) => {
|
|
1309
1319
|
if (response.width === void 0 === (response.height === void 0))
|
|
1310
1320
|
return;
|
|
@@ -1314,74 +1324,74 @@ var DevicePreviewStreamStartSuccessSchema = z12.object({
|
|
|
1314
1324
|
message: "Device preview stream dimensions must include both width and height"
|
|
1315
1325
|
});
|
|
1316
1326
|
});
|
|
1317
|
-
var DevicePreviewStreamStartResponseSchema =
|
|
1327
|
+
var DevicePreviewStreamStartResponseSchema = z13.discriminatedUnion("success", [
|
|
1318
1328
|
DevicePreviewStreamStartSuccessSchema,
|
|
1319
|
-
|
|
1329
|
+
z13.object({
|
|
1320
1330
|
...DevicePreviewStreamStartResponseBaseShape,
|
|
1321
|
-
success:
|
|
1331
|
+
success: z13.literal(false),
|
|
1322
1332
|
...RequiredRequestErrorShape
|
|
1323
1333
|
}).strict()
|
|
1324
1334
|
]);
|
|
1325
|
-
var DevicePreviewStreamCompleteSchema =
|
|
1326
|
-
type:
|
|
1335
|
+
var DevicePreviewStreamCompleteSchema = z13.object({
|
|
1336
|
+
type: z13.literal("device_preview_stream_complete"),
|
|
1327
1337
|
streamId: IdSchema,
|
|
1328
1338
|
leaseId: IdSchema,
|
|
1329
1339
|
previewId: IdSchema,
|
|
1330
|
-
success:
|
|
1331
|
-
error:
|
|
1340
|
+
success: z13.literal(false),
|
|
1341
|
+
error: z13.string().min(1)
|
|
1332
1342
|
}).strict();
|
|
1333
1343
|
var DevicePreviewStreamStartBaseShape = {
|
|
1334
|
-
type:
|
|
1344
|
+
type: z13.literal("device_preview_stream_start"),
|
|
1335
1345
|
streamId: IdSchema,
|
|
1336
1346
|
leaseId: IdSchema,
|
|
1337
1347
|
previewId: IdSchema
|
|
1338
1348
|
};
|
|
1339
|
-
var DevicePreviewStreamStartSchema =
|
|
1340
|
-
|
|
1349
|
+
var DevicePreviewStreamStartSchema = z13.discriminatedUnion("format", [
|
|
1350
|
+
z13.object({
|
|
1341
1351
|
...DevicePreviewStreamStartBaseShape,
|
|
1342
1352
|
...DevicePreviewJpegStreamProfileSchema.shape
|
|
1343
1353
|
}).strict(),
|
|
1344
|
-
|
|
1354
|
+
z13.object({
|
|
1345
1355
|
...DevicePreviewStreamStartBaseShape,
|
|
1346
1356
|
...DevicePreviewH264StreamProfileSchema.shape
|
|
1347
1357
|
}).strict()
|
|
1348
1358
|
]);
|
|
1349
|
-
var DevicePreviewInputAckSchema =
|
|
1350
|
-
|
|
1351
|
-
type:
|
|
1359
|
+
var DevicePreviewInputAckSchema = z13.discriminatedUnion("success", [
|
|
1360
|
+
z13.object({
|
|
1361
|
+
type: z13.literal("device_preview_input_ack"),
|
|
1352
1362
|
scope: PreviewScopeSchema,
|
|
1353
1363
|
leaseId: IdSchema,
|
|
1354
|
-
inputSeq:
|
|
1355
|
-
success:
|
|
1364
|
+
inputSeq: z13.number().int().min(0).max(4294967295),
|
|
1365
|
+
success: z13.literal(true)
|
|
1356
1366
|
}).strict(),
|
|
1357
|
-
|
|
1358
|
-
type:
|
|
1367
|
+
z13.object({
|
|
1368
|
+
type: z13.literal("device_preview_input_ack"),
|
|
1359
1369
|
scope: PreviewScopeSchema,
|
|
1360
1370
|
leaseId: IdSchema,
|
|
1361
|
-
inputSeq:
|
|
1362
|
-
success:
|
|
1371
|
+
inputSeq: z13.number().int().min(0).max(4294967295),
|
|
1372
|
+
success: z13.literal(false),
|
|
1363
1373
|
...RequiredRequestErrorShape
|
|
1364
1374
|
}).strict()
|
|
1365
1375
|
]);
|
|
1366
|
-
var DevicePreviewControlClaimResponseSchema =
|
|
1367
|
-
|
|
1368
|
-
type:
|
|
1376
|
+
var DevicePreviewControlClaimResponseSchema = z13.discriminatedUnion("success", [
|
|
1377
|
+
z13.object({
|
|
1378
|
+
type: z13.literal("device_preview_control_claim_response"),
|
|
1369
1379
|
...RequiredRequestIdShape,
|
|
1370
1380
|
scope: PreviewScopeSchema,
|
|
1371
1381
|
leaseId: IdSchema,
|
|
1372
|
-
success:
|
|
1373
|
-
controlMode:
|
|
1382
|
+
success: z13.literal(true),
|
|
1383
|
+
controlMode: z13.literal("controller")
|
|
1374
1384
|
}).strict(),
|
|
1375
|
-
|
|
1376
|
-
type:
|
|
1385
|
+
z13.object({
|
|
1386
|
+
type: z13.literal("device_preview_control_claim_response"),
|
|
1377
1387
|
...RequiredRequestIdShape,
|
|
1378
1388
|
scope: PreviewScopeSchema,
|
|
1379
1389
|
leaseId: IdSchema,
|
|
1380
|
-
success:
|
|
1390
|
+
success: z13.literal(false),
|
|
1381
1391
|
...RequiredRequestErrorShape
|
|
1382
1392
|
}).strict()
|
|
1383
1393
|
]);
|
|
1384
|
-
var SessionPermissionModeSchema =
|
|
1394
|
+
var SessionPermissionModeSchema = z13.enum([
|
|
1385
1395
|
"default",
|
|
1386
1396
|
"auto",
|
|
1387
1397
|
"acceptEdits",
|
|
@@ -1389,98 +1399,98 @@ var SessionPermissionModeSchema = z12.enum([
|
|
|
1389
1399
|
"bypassPermissions",
|
|
1390
1400
|
"dontAsk"
|
|
1391
1401
|
]);
|
|
1392
|
-
var AgentJsonSessionCreateSchema =
|
|
1393
|
-
type:
|
|
1402
|
+
var AgentJsonSessionCreateSchema = z13.object({
|
|
1403
|
+
type: z13.literal("session_create"),
|
|
1394
1404
|
...RequiredRequestIdShape,
|
|
1395
|
-
kind:
|
|
1396
|
-
cwd:
|
|
1397
|
-
name:
|
|
1398
|
-
provider:
|
|
1399
|
-
mode:
|
|
1400
|
-
resumeSessionId:
|
|
1405
|
+
kind: z13.literal("agent"),
|
|
1406
|
+
cwd: z13.string(),
|
|
1407
|
+
name: z13.string().optional(),
|
|
1408
|
+
provider: z13.enum(providerValues),
|
|
1409
|
+
mode: z13.literal("json"),
|
|
1410
|
+
resumeSessionId: z13.string().optional(),
|
|
1401
1411
|
permissionMode: SessionPermissionModeSchema.optional()
|
|
1402
1412
|
}).strict();
|
|
1403
|
-
var AgentPtySessionCreateSchema =
|
|
1404
|
-
type:
|
|
1413
|
+
var AgentPtySessionCreateSchema = z13.object({
|
|
1414
|
+
type: z13.literal("session_create"),
|
|
1405
1415
|
...RequiredRequestIdShape,
|
|
1406
|
-
kind:
|
|
1407
|
-
cwd:
|
|
1408
|
-
name:
|
|
1409
|
-
provider:
|
|
1410
|
-
mode:
|
|
1411
|
-
resumeSessionId:
|
|
1412
|
-
cols:
|
|
1413
|
-
rows:
|
|
1416
|
+
kind: z13.literal("agent"),
|
|
1417
|
+
cwd: z13.string(),
|
|
1418
|
+
name: z13.string().optional(),
|
|
1419
|
+
provider: z13.enum(providerValues),
|
|
1420
|
+
mode: z13.literal("pty"),
|
|
1421
|
+
resumeSessionId: z13.string().optional(),
|
|
1422
|
+
cols: z13.number().int().positive().max(PTY_INITIAL_MAX_COLS),
|
|
1423
|
+
rows: z13.number().int().positive().max(PTY_INITIAL_MAX_ROWS),
|
|
1414
1424
|
permissionMode: SessionPermissionModeSchema.optional()
|
|
1415
1425
|
}).strict();
|
|
1416
|
-
var TerminalSessionCreateSchema =
|
|
1417
|
-
type:
|
|
1426
|
+
var TerminalSessionCreateSchema = z13.object({
|
|
1427
|
+
type: z13.literal("session_create"),
|
|
1418
1428
|
...RequiredRequestIdShape,
|
|
1419
|
-
kind:
|
|
1420
|
-
name:
|
|
1421
|
-
mode:
|
|
1422
|
-
cols:
|
|
1423
|
-
rows:
|
|
1429
|
+
kind: z13.literal("terminal"),
|
|
1430
|
+
name: z13.string().optional(),
|
|
1431
|
+
mode: z13.literal("pty"),
|
|
1432
|
+
cols: z13.number().int().positive().max(PTY_INITIAL_MAX_COLS),
|
|
1433
|
+
rows: z13.number().int().positive().max(PTY_INITIAL_MAX_ROWS)
|
|
1424
1434
|
}).strict();
|
|
1425
|
-
var SessionCreateSchema =
|
|
1435
|
+
var SessionCreateSchema = z13.discriminatedUnion("mode", [
|
|
1426
1436
|
AgentJsonSessionCreateSchema,
|
|
1427
|
-
|
|
1437
|
+
z13.discriminatedUnion("kind", [AgentPtySessionCreateSchema, TerminalSessionCreateSchema])
|
|
1428
1438
|
]);
|
|
1429
1439
|
var SessionCreateSuccessBaseShape = {
|
|
1430
|
-
type:
|
|
1440
|
+
type: z13.literal("session_create_response"),
|
|
1431
1441
|
...RequiredRequestIdShape,
|
|
1432
|
-
success:
|
|
1442
|
+
success: z13.literal(true),
|
|
1433
1443
|
sessionId: IdSchema,
|
|
1434
|
-
cwd:
|
|
1435
|
-
lastActive:
|
|
1436
|
-
name:
|
|
1437
|
-
nameLocked:
|
|
1444
|
+
cwd: z13.string(),
|
|
1445
|
+
lastActive: z13.number(),
|
|
1446
|
+
name: z13.string().optional(),
|
|
1447
|
+
nameLocked: z13.boolean().optional()
|
|
1438
1448
|
};
|
|
1439
|
-
var SessionCreateSuccessResponseSchema =
|
|
1440
|
-
|
|
1449
|
+
var SessionCreateSuccessResponseSchema = z13.discriminatedUnion("mode", [
|
|
1450
|
+
z13.object({
|
|
1441
1451
|
...SessionCreateSuccessBaseShape,
|
|
1442
|
-
kind:
|
|
1443
|
-
mode:
|
|
1444
|
-
provider:
|
|
1452
|
+
kind: z13.literal("agent"),
|
|
1453
|
+
mode: z13.literal("json"),
|
|
1454
|
+
provider: z13.enum(providerValues)
|
|
1445
1455
|
}).strict(),
|
|
1446
|
-
|
|
1447
|
-
|
|
1456
|
+
z13.discriminatedUnion("kind", [
|
|
1457
|
+
z13.object({
|
|
1448
1458
|
...SessionCreateSuccessBaseShape,
|
|
1449
|
-
kind:
|
|
1450
|
-
mode:
|
|
1451
|
-
provider:
|
|
1452
|
-
ptyOwner:
|
|
1459
|
+
kind: z13.literal("agent"),
|
|
1460
|
+
mode: z13.literal("pty"),
|
|
1461
|
+
provider: z13.enum(providerValues),
|
|
1462
|
+
ptyOwner: z13.enum(ptyOwnerValues)
|
|
1453
1463
|
}).strict(),
|
|
1454
|
-
|
|
1464
|
+
z13.object({
|
|
1455
1465
|
...SessionCreateSuccessBaseShape,
|
|
1456
|
-
kind:
|
|
1457
|
-
mode:
|
|
1458
|
-
provider:
|
|
1459
|
-
ptyOwner:
|
|
1466
|
+
kind: z13.literal("terminal"),
|
|
1467
|
+
mode: z13.literal("pty"),
|
|
1468
|
+
provider: z13.literal("claude"),
|
|
1469
|
+
ptyOwner: z13.literal("local-terminal")
|
|
1460
1470
|
}).strict()
|
|
1461
1471
|
])
|
|
1462
1472
|
]);
|
|
1463
|
-
var SessionCreateResponseSchema =
|
|
1473
|
+
var SessionCreateResponseSchema = z13.discriminatedUnion("success", [
|
|
1464
1474
|
SessionCreateSuccessResponseSchema,
|
|
1465
|
-
|
|
1466
|
-
type:
|
|
1475
|
+
z13.object({
|
|
1476
|
+
type: z13.literal("session_create_response"),
|
|
1467
1477
|
...RequiredRequestIdShape,
|
|
1468
|
-
success:
|
|
1478
|
+
success: z13.literal(false),
|
|
1469
1479
|
...RequiredRequestErrorShape,
|
|
1470
|
-
activeWriterPid:
|
|
1480
|
+
activeWriterPid: z13.number().int().positive().optional()
|
|
1471
1481
|
}).strict()
|
|
1472
1482
|
]);
|
|
1473
1483
|
var relayControlDefinitions = [
|
|
1474
1484
|
strictControl("proxy_register", {
|
|
1475
|
-
protocolVersion:
|
|
1485
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1476
1486
|
proxyId: IdSchema,
|
|
1477
|
-
name:
|
|
1478
|
-
proxyVersion:
|
|
1487
|
+
name: z13.string().optional(),
|
|
1488
|
+
proxyVersion: z13.string().min(1).max(64)
|
|
1479
1489
|
}),
|
|
1480
1490
|
strictControl("proxy_register_response", {
|
|
1481
|
-
protocolVersion:
|
|
1482
|
-
status:
|
|
1483
|
-
relayVersion:
|
|
1491
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1492
|
+
status: z13.enum(["new", "reconnected"]),
|
|
1493
|
+
relayVersion: z13.string().min(1).max(64),
|
|
1484
1494
|
// Relay rotates this nonce for every successful main Proxy registration. The dedicated image
|
|
1485
1495
|
// stream socket must present it before Relay accepts frames, so a superseded Proxy connection
|
|
1486
1496
|
// cannot keep publishing into a newly registered Proxy with the same persistent proxyId.
|
|
@@ -1489,7 +1499,7 @@ var relayControlDefinitions = [
|
|
|
1489
1499
|
control("proxy_list_request", RequestIdShape),
|
|
1490
1500
|
control("proxy_list_response", {
|
|
1491
1501
|
...RequestIdShape,
|
|
1492
|
-
proxies:
|
|
1502
|
+
proxies: z13.array(ProxyInfoSchema)
|
|
1493
1503
|
}),
|
|
1494
1504
|
control("proxy_remove", {
|
|
1495
1505
|
...RequiredRequestIdShape,
|
|
@@ -1498,74 +1508,74 @@ var relayControlDefinitions = [
|
|
|
1498
1508
|
control("proxy_remove_response", {
|
|
1499
1509
|
...RequiredRequestIdShape,
|
|
1500
1510
|
proxyId: IdSchema,
|
|
1501
|
-
success:
|
|
1511
|
+
success: z13.boolean(),
|
|
1502
1512
|
...RequestErrorShape
|
|
1503
1513
|
}),
|
|
1504
1514
|
control("relay_client_list_request", RequestIdShape),
|
|
1505
1515
|
control("relay_client_list_response", {
|
|
1506
1516
|
...RequestIdShape,
|
|
1507
|
-
clients:
|
|
1517
|
+
clients: z13.array(RelayClientInfoSchema)
|
|
1508
1518
|
}),
|
|
1509
1519
|
control("relay_client_kick", { ...RequiredRequestIdShape, clientId: IdSchema }),
|
|
1510
1520
|
control("relay_client_kick_response", {
|
|
1511
1521
|
...RequiredRequestIdShape,
|
|
1512
1522
|
clientId: IdSchema,
|
|
1513
|
-
success:
|
|
1523
|
+
success: z13.boolean(),
|
|
1514
1524
|
...RequestErrorShape
|
|
1515
1525
|
}),
|
|
1516
1526
|
control("relay_client_kicked", {
|
|
1517
|
-
reason:
|
|
1527
|
+
reason: z13.string().optional()
|
|
1518
1528
|
}),
|
|
1519
1529
|
control("remote_file_url_request", {
|
|
1520
1530
|
...RequiredRequestIdShape,
|
|
1521
1531
|
sessionId: IdSchema,
|
|
1522
|
-
path:
|
|
1532
|
+
path: z13.string().min(1),
|
|
1523
1533
|
disposition: RemoteFileDispositionSchema
|
|
1524
1534
|
}),
|
|
1525
1535
|
control("remote_file_url_response", {
|
|
1526
1536
|
...RequiredRequestIdShape,
|
|
1527
1537
|
...RequestErrorShape,
|
|
1528
1538
|
sessionId: IdSchema,
|
|
1529
|
-
path:
|
|
1530
|
-
success:
|
|
1531
|
-
url:
|
|
1532
|
-
expiresAt:
|
|
1539
|
+
path: z13.string().optional(),
|
|
1540
|
+
success: z13.boolean(),
|
|
1541
|
+
url: z13.string().optional(),
|
|
1542
|
+
expiresAt: z13.number().int().nonnegative().optional()
|
|
1533
1543
|
}),
|
|
1534
1544
|
control("remote_file_metadata_request", {
|
|
1535
1545
|
...RequiredRequestIdShape,
|
|
1536
1546
|
sessionId: IdSchema,
|
|
1537
|
-
path:
|
|
1547
|
+
path: z13.string().min(1)
|
|
1538
1548
|
}),
|
|
1539
1549
|
control("remote_file_metadata_response", {
|
|
1540
1550
|
...RequiredRequestIdShape,
|
|
1541
1551
|
...RequestErrorShape,
|
|
1542
1552
|
sessionId: IdSchema,
|
|
1543
|
-
path:
|
|
1544
|
-
success:
|
|
1545
|
-
mimeType:
|
|
1546
|
-
size:
|
|
1547
|
-
fileName:
|
|
1553
|
+
path: z13.string().optional(),
|
|
1554
|
+
success: z13.boolean(),
|
|
1555
|
+
mimeType: z13.string().optional(),
|
|
1556
|
+
size: z13.number().int().nonnegative().optional(),
|
|
1557
|
+
fileName: z13.string().optional()
|
|
1548
1558
|
}),
|
|
1549
1559
|
control("remote_file_stream_request", {
|
|
1550
1560
|
streamId: IdSchema,
|
|
1551
1561
|
sessionId: IdSchema,
|
|
1552
|
-
path:
|
|
1562
|
+
path: z13.string().min(1),
|
|
1553
1563
|
disposition: RemoteFileDispositionSchema
|
|
1554
1564
|
}),
|
|
1555
1565
|
control("remote_file_stream_response", {
|
|
1556
1566
|
...RequestErrorShape,
|
|
1557
1567
|
streamId: IdSchema,
|
|
1558
1568
|
sessionId: IdSchema,
|
|
1559
|
-
success:
|
|
1560
|
-
path:
|
|
1561
|
-
mimeType:
|
|
1562
|
-
size:
|
|
1563
|
-
fileName:
|
|
1569
|
+
success: z13.boolean(),
|
|
1570
|
+
path: z13.string().optional(),
|
|
1571
|
+
mimeType: z13.string().optional(),
|
|
1572
|
+
size: z13.number().int().nonnegative().optional(),
|
|
1573
|
+
fileName: z13.string().optional()
|
|
1564
1574
|
}),
|
|
1565
1575
|
control("remote_file_stream_complete", {
|
|
1566
1576
|
...RequestErrorShape,
|
|
1567
1577
|
streamId: IdSchema,
|
|
1568
|
-
success:
|
|
1578
|
+
success: z13.boolean()
|
|
1569
1579
|
}),
|
|
1570
1580
|
control("remote_file_stream_cancel", {
|
|
1571
1581
|
streamId: IdSchema
|
|
@@ -1574,25 +1584,25 @@ var relayControlDefinitions = [
|
|
|
1574
1584
|
...RequiredRequestIdShape,
|
|
1575
1585
|
sessionId: IdSchema,
|
|
1576
1586
|
kind: RemoteFileUploadKindSchema,
|
|
1577
|
-
fileName:
|
|
1578
|
-
mimeType:
|
|
1579
|
-
size:
|
|
1587
|
+
fileName: z13.string().optional(),
|
|
1588
|
+
mimeType: z13.string().min(1),
|
|
1589
|
+
size: z13.number().int().nonnegative().optional()
|
|
1580
1590
|
}),
|
|
1581
1591
|
control("remote_file_upload_url_response", {
|
|
1582
1592
|
...RequiredRequestIdShape,
|
|
1583
1593
|
...RequestErrorShape,
|
|
1584
1594
|
sessionId: IdSchema,
|
|
1585
|
-
success:
|
|
1586
|
-
uploadUrl:
|
|
1587
|
-
expiresAt:
|
|
1595
|
+
success: z13.boolean(),
|
|
1596
|
+
uploadUrl: z13.string().optional(),
|
|
1597
|
+
expiresAt: z13.number().int().nonnegative().optional()
|
|
1588
1598
|
}),
|
|
1589
1599
|
control("remote_file_upload_stream_request", {
|
|
1590
1600
|
uploadId: IdSchema,
|
|
1591
1601
|
sessionId: IdSchema,
|
|
1592
1602
|
kind: RemoteFileUploadKindSchema,
|
|
1593
|
-
fileName:
|
|
1594
|
-
mimeType:
|
|
1595
|
-
size:
|
|
1603
|
+
fileName: z13.string().optional(),
|
|
1604
|
+
mimeType: z13.string().min(1),
|
|
1605
|
+
size: z13.number().int().nonnegative().optional()
|
|
1596
1606
|
}),
|
|
1597
1607
|
control("remote_file_upload_stream_complete", {
|
|
1598
1608
|
uploadId: IdSchema
|
|
@@ -1604,14 +1614,14 @@ var relayControlDefinitions = [
|
|
|
1604
1614
|
...RequestErrorShape,
|
|
1605
1615
|
uploadId: IdSchema,
|
|
1606
1616
|
sessionId: IdSchema,
|
|
1607
|
-
success:
|
|
1608
|
-
path:
|
|
1617
|
+
success: z13.boolean(),
|
|
1618
|
+
path: z13.string().optional()
|
|
1609
1619
|
}),
|
|
1610
1620
|
control("proxy_select", { ...RequestIdShape, proxyId: IdSchema }),
|
|
1611
1621
|
controlSchema("proxy_select_response", ProxySelectResponseSchema),
|
|
1612
1622
|
control("relay_error", {
|
|
1613
|
-
code:
|
|
1614
|
-
message:
|
|
1623
|
+
code: z13.enum(Object.values(RelayErrorCode)),
|
|
1624
|
+
message: z13.string(),
|
|
1615
1625
|
// 可选 requestId: relay 把 client 发来 raw 的 requestId 字段透传回来,
|
|
1616
1626
|
// client 侧 waitForMessage 据此把对应 pending request 立即拒掉而不必等到 timeout。
|
|
1617
1627
|
requestId: IdSchema.optional()
|
|
@@ -1630,7 +1640,7 @@ var relayControlDefinitions = [
|
|
|
1630
1640
|
control("voice_config_update_response", {
|
|
1631
1641
|
...RequestIdShape,
|
|
1632
1642
|
...RequestErrorShape,
|
|
1633
|
-
success:
|
|
1643
|
+
success: z13.boolean(),
|
|
1634
1644
|
config: VoiceProviderConfigSchema.optional()
|
|
1635
1645
|
}),
|
|
1636
1646
|
control("voice_config_test", {
|
|
@@ -1640,15 +1650,15 @@ var relayControlDefinitions = [
|
|
|
1640
1650
|
control("voice_config_test_response", {
|
|
1641
1651
|
...RequestIdShape,
|
|
1642
1652
|
...RequestErrorShape,
|
|
1643
|
-
success:
|
|
1644
|
-
audioBase64:
|
|
1645
|
-
audioSampleRate:
|
|
1646
|
-
audioEncoding:
|
|
1647
|
-
transcript:
|
|
1653
|
+
success: z13.boolean(),
|
|
1654
|
+
audioBase64: z13.string().optional(),
|
|
1655
|
+
audioSampleRate: z13.number().int().positive().optional(),
|
|
1656
|
+
audioEncoding: z13.literal("pcm_s16le").optional(),
|
|
1657
|
+
transcript: z13.string().optional()
|
|
1648
1658
|
}),
|
|
1649
1659
|
control("voice_capabilities_request", {
|
|
1650
1660
|
...RequestIdShape,
|
|
1651
|
-
region:
|
|
1661
|
+
region: z13.enum(voiceRegionValues).optional()
|
|
1652
1662
|
}),
|
|
1653
1663
|
control("voice_capabilities_response", {
|
|
1654
1664
|
...RequestIdShape,
|
|
@@ -1660,31 +1670,31 @@ var relayControlDefinitions = [
|
|
|
1660
1670
|
control("latency_web_relay_ping", RequiredRequestIdShape),
|
|
1661
1671
|
control("latency_web_relay_pong", {
|
|
1662
1672
|
...RequiredRequestIdShape,
|
|
1663
|
-
relayNow:
|
|
1673
|
+
relayNow: z13.number().optional()
|
|
1664
1674
|
}),
|
|
1665
1675
|
control("latency_relay_proxy_request", RequiredRequestIdShape),
|
|
1666
1676
|
control("latency_relay_proxy_response", {
|
|
1667
1677
|
...RequiredRequestIdShape,
|
|
1668
|
-
success:
|
|
1669
|
-
rttMs:
|
|
1670
|
-
error:
|
|
1678
|
+
success: z13.boolean(),
|
|
1679
|
+
rttMs: z13.number().nonnegative().optional(),
|
|
1680
|
+
error: z13.string().optional()
|
|
1671
1681
|
}),
|
|
1672
1682
|
control("latency_relay_proxy_ping", {
|
|
1673
1683
|
...RequiredRequestIdShape,
|
|
1674
|
-
relayNow:
|
|
1684
|
+
relayNow: z13.number().optional()
|
|
1675
1685
|
}),
|
|
1676
1686
|
control("latency_relay_proxy_pong", {
|
|
1677
1687
|
...RequiredRequestIdShape,
|
|
1678
|
-
proxyNow:
|
|
1688
|
+
proxyNow: z13.number().optional()
|
|
1679
1689
|
}),
|
|
1680
1690
|
control("latency_web_proxy_ping", RequiredRequestIdShape, "client_to_proxy"),
|
|
1681
|
-
control("latency_web_proxy_pong", { ...RequiredRequestIdShape, proxyNow:
|
|
1691
|
+
control("latency_web_proxy_pong", { ...RequiredRequestIdShape, proxyNow: z13.number().optional() }, "proxy_to_client"),
|
|
1682
1692
|
// Web preview is independent from Agent/terminal sessions. Relay rewrites requestId and routes
|
|
1683
1693
|
// every response to the exact requesting WebSocket; only the two push messages are broadcast.
|
|
1684
1694
|
strictControl("preview_capability_request", {
|
|
1685
1695
|
...RequiredRequestIdShape,
|
|
1686
1696
|
scope: PreviewScopeSchema,
|
|
1687
|
-
refreshPath:
|
|
1697
|
+
refreshPath: z13.boolean()
|
|
1688
1698
|
}, "client_to_proxy"),
|
|
1689
1699
|
controlSchema("preview_capability_response", PreviewCapabilityResponseSchema, "proxy_to_client"),
|
|
1690
1700
|
strictControl("preview_static_inspect_request", {
|
|
@@ -1707,8 +1717,8 @@ var relayControlDefinitions = [
|
|
|
1707
1717
|
...RequiredRequestIdShape,
|
|
1708
1718
|
scope: PreviewScopeSchema,
|
|
1709
1719
|
epoch: IdSchema,
|
|
1710
|
-
revision:
|
|
1711
|
-
previews:
|
|
1720
|
+
revision: z13.number().int().nonnegative(),
|
|
1721
|
+
previews: z13.array(PreviewSummarySchema)
|
|
1712
1722
|
}, "proxy_to_client"),
|
|
1713
1723
|
strictControl("preview_rename_request", {
|
|
1714
1724
|
...RequiredRequestIdShape,
|
|
@@ -1734,24 +1744,24 @@ var relayControlDefinitions = [
|
|
|
1734
1744
|
controlSchema("preview_close_response", PreviewCloseResponseSchema, "proxy_to_client"),
|
|
1735
1745
|
strictControl("preview_state_event", {
|
|
1736
1746
|
epoch: IdSchema,
|
|
1737
|
-
revision:
|
|
1747
|
+
revision: z13.number().int().nonnegative(),
|
|
1738
1748
|
preview: PreviewSummarySchema
|
|
1739
1749
|
}),
|
|
1740
1750
|
strictControl("preview_removed_event", {
|
|
1741
1751
|
epoch: IdSchema,
|
|
1742
|
-
revision:
|
|
1752
|
+
revision: z13.number().int().nonnegative(),
|
|
1743
1753
|
previewId: IdSchema
|
|
1744
1754
|
}),
|
|
1745
1755
|
strictControl("preview_state_push", {
|
|
1746
1756
|
scope: PreviewScopeSchema,
|
|
1747
1757
|
epoch: IdSchema,
|
|
1748
|
-
revision:
|
|
1758
|
+
revision: z13.number().int().nonnegative(),
|
|
1749
1759
|
preview: PreviewSummarySchema
|
|
1750
1760
|
}, "proxy_to_client"),
|
|
1751
1761
|
strictControl("preview_removed_push", {
|
|
1752
1762
|
scope: PreviewScopeSchema,
|
|
1753
1763
|
epoch: IdSchema,
|
|
1754
|
-
revision:
|
|
1764
|
+
revision: z13.number().int().nonnegative(),
|
|
1755
1765
|
previewId: IdSchema
|
|
1756
1766
|
}, "proxy_to_client"),
|
|
1757
1767
|
// Device previews are a sibling of Web previews under the product-level Preview entry, but
|
|
@@ -1760,13 +1770,13 @@ var relayControlDefinitions = [
|
|
|
1760
1770
|
strictControl("device_preview_capability_request", {
|
|
1761
1771
|
...RequiredRequestIdShape,
|
|
1762
1772
|
scope: PreviewScopeSchema,
|
|
1763
|
-
refreshPath:
|
|
1773
|
+
refreshPath: z13.boolean()
|
|
1764
1774
|
}, "client_to_proxy"),
|
|
1765
1775
|
controlSchema("device_preview_capability_response", DevicePreviewCapabilityResponseSchema, "proxy_to_client"),
|
|
1766
1776
|
strictControl("device_preview_targets_request", {
|
|
1767
1777
|
...RequiredRequestIdShape,
|
|
1768
1778
|
scope: PreviewScopeSchema,
|
|
1769
|
-
refresh:
|
|
1779
|
+
refresh: z13.boolean()
|
|
1770
1780
|
}, "client_to_proxy"),
|
|
1771
1781
|
controlSchema("device_preview_targets_response", DevicePreviewTargetsResponseSchema, "proxy_to_client"),
|
|
1772
1782
|
strictControl("device_preview_create_request", {
|
|
@@ -1782,8 +1792,8 @@ var relayControlDefinitions = [
|
|
|
1782
1792
|
...RequiredRequestIdShape,
|
|
1783
1793
|
scope: PreviewScopeSchema,
|
|
1784
1794
|
epoch: IdSchema,
|
|
1785
|
-
revision:
|
|
1786
|
-
previews:
|
|
1795
|
+
revision: z13.number().int().nonnegative(),
|
|
1796
|
+
previews: z13.array(DevicePreviewSummarySchema).max(1024)
|
|
1787
1797
|
}, "proxy_to_client"),
|
|
1788
1798
|
strictControl("device_preview_rename_request", {
|
|
1789
1799
|
...RequiredRequestIdShape,
|
|
@@ -1809,24 +1819,24 @@ var relayControlDefinitions = [
|
|
|
1809
1819
|
controlSchema("device_preview_close_response", DevicePreviewCloseResponseSchema, "proxy_to_client"),
|
|
1810
1820
|
strictControl("device_preview_state_event", {
|
|
1811
1821
|
epoch: IdSchema,
|
|
1812
|
-
revision:
|
|
1822
|
+
revision: z13.number().int().nonnegative(),
|
|
1813
1823
|
preview: DevicePreviewSummarySchema
|
|
1814
1824
|
}),
|
|
1815
1825
|
strictControl("device_preview_removed_event", {
|
|
1816
1826
|
epoch: IdSchema,
|
|
1817
|
-
revision:
|
|
1827
|
+
revision: z13.number().int().nonnegative(),
|
|
1818
1828
|
previewId: IdSchema
|
|
1819
1829
|
}),
|
|
1820
1830
|
strictControl("device_preview_state_push", {
|
|
1821
1831
|
scope: PreviewScopeSchema,
|
|
1822
1832
|
epoch: IdSchema,
|
|
1823
|
-
revision:
|
|
1833
|
+
revision: z13.number().int().nonnegative(),
|
|
1824
1834
|
preview: DevicePreviewSummarySchema
|
|
1825
1835
|
}, "proxy_to_client"),
|
|
1826
1836
|
strictControl("device_preview_removed_push", {
|
|
1827
1837
|
scope: PreviewScopeSchema,
|
|
1828
1838
|
epoch: IdSchema,
|
|
1829
|
-
revision:
|
|
1839
|
+
revision: z13.number().int().nonnegative(),
|
|
1830
1840
|
previewId: IdSchema
|
|
1831
1841
|
}, "proxy_to_client"),
|
|
1832
1842
|
strictControl("device_preview_stream_url_request", {
|
|
@@ -1846,7 +1856,7 @@ var relayControlDefinitions = [
|
|
|
1846
1856
|
strictControl("device_preview_input", {
|
|
1847
1857
|
scope: PreviewScopeSchema,
|
|
1848
1858
|
leaseId: IdSchema,
|
|
1849
|
-
inputSeq:
|
|
1859
|
+
inputSeq: z13.number().int().min(0).max(4294967295),
|
|
1850
1860
|
input: DevicePreviewInputSchema
|
|
1851
1861
|
}, "client_to_proxy"),
|
|
1852
1862
|
controlSchema("device_preview_input_ack", DevicePreviewInputAckSchema, "proxy_to_client"),
|
|
@@ -1854,7 +1864,7 @@ var relayControlDefinitions = [
|
|
|
1854
1864
|
// browsers cannot abort another viewer's queued input, and Proxy never sends it to browsers.
|
|
1855
1865
|
strictControl("device_preview_input_revoke", {
|
|
1856
1866
|
leaseId: IdSchema,
|
|
1857
|
-
reason:
|
|
1867
|
+
reason: z13.literal("control_taken_over")
|
|
1858
1868
|
}),
|
|
1859
1869
|
strictControl("device_preview_control_claim_request", {
|
|
1860
1870
|
...RequiredRequestIdShape,
|
|
@@ -1865,18 +1875,18 @@ var relayControlDefinitions = [
|
|
|
1865
1875
|
strictControl("device_preview_control_revoked_push", {
|
|
1866
1876
|
scope: PreviewScopeSchema,
|
|
1867
1877
|
leaseId: IdSchema,
|
|
1868
|
-
reason:
|
|
1878
|
+
reason: z13.enum(["taken_over", "stream_closed", "proxy_offline", "lease_expired"])
|
|
1869
1879
|
}),
|
|
1870
1880
|
// 客户端注册协议
|
|
1871
1881
|
strictControl("client_register", {
|
|
1872
|
-
protocolVersion:
|
|
1882
|
+
protocolVersion: z13.literal(RELAY_CONTROL_PROTOCOL_VERSION),
|
|
1873
1883
|
clientId: IdSchema,
|
|
1874
|
-
userAgent:
|
|
1875
|
-
platform:
|
|
1876
|
-
maxTouchPoints:
|
|
1877
|
-
browserName:
|
|
1878
|
-
osName:
|
|
1879
|
-
deviceKind:
|
|
1884
|
+
userAgent: z13.string().optional(),
|
|
1885
|
+
platform: z13.string().optional(),
|
|
1886
|
+
maxTouchPoints: z13.number().int().nonnegative().optional(),
|
|
1887
|
+
browserName: z13.string().min(1),
|
|
1888
|
+
osName: z13.string().min(1),
|
|
1889
|
+
deviceKind: z13.enum(["desktop", "tablet", "phone", "unknown"])
|
|
1880
1890
|
}),
|
|
1881
1891
|
controlSchema("client_register_response", ClientRegisterResponseSchema),
|
|
1882
1892
|
// Proxy 离线通知
|
|
@@ -1898,38 +1908,38 @@ var relayControlDefinitions = [
|
|
|
1898
1908
|
// 目录列表请求与响应
|
|
1899
1909
|
strictControl("dir_list_request", {
|
|
1900
1910
|
...RequestIdShape,
|
|
1901
|
-
path:
|
|
1902
|
-
includeHidden:
|
|
1911
|
+
path: z13.string(),
|
|
1912
|
+
includeHidden: z13.boolean()
|
|
1903
1913
|
}, "client_to_proxy"),
|
|
1904
1914
|
control("dir_list_response", {
|
|
1905
1915
|
...RequestIdShape,
|
|
1906
1916
|
...RequestErrorShape,
|
|
1907
|
-
entries:
|
|
1908
|
-
path:
|
|
1909
|
-
includeHidden:
|
|
1917
|
+
entries: z13.array(DirEntrySchema),
|
|
1918
|
+
path: z13.string(),
|
|
1919
|
+
includeHidden: z13.boolean()
|
|
1910
1920
|
}, "proxy_to_client"),
|
|
1911
1921
|
// 目录创建请求与响应
|
|
1912
|
-
control("dir_create_request", { ...RequestIdShape, path:
|
|
1922
|
+
control("dir_create_request", { ...RequestIdShape, path: z13.string() }, "client_to_proxy"),
|
|
1913
1923
|
control("dir_create_response", {
|
|
1914
1924
|
...RequestIdShape,
|
|
1915
1925
|
...RequestErrorShape,
|
|
1916
|
-
path:
|
|
1917
|
-
success:
|
|
1926
|
+
path: z13.string(),
|
|
1927
|
+
success: z13.boolean()
|
|
1918
1928
|
}, "proxy_to_client"),
|
|
1919
1929
|
// 命令列表推送,proxy 将可用命令列表推给 client
|
|
1920
1930
|
control("command_list_push", {
|
|
1921
1931
|
sessionId: IdSchema,
|
|
1922
|
-
commands:
|
|
1932
|
+
commands: z13.array(CommandEntrySchema)
|
|
1923
1933
|
}, "proxy_to_client"),
|
|
1924
1934
|
// 文件树推送: 按目录分组, 首组 path 即为 session cwd。
|
|
1925
1935
|
// 前端把它写入普通目录树;includeHidden=true 的按需响应使用独立缓存。
|
|
1926
1936
|
control("file_tree_push", {
|
|
1927
|
-
groups:
|
|
1937
|
+
groups: z13.array(FileTreeGroupSchema)
|
|
1928
1938
|
}, "proxy_to_client"),
|
|
1929
1939
|
// 会话列表请求与权限模式变更
|
|
1930
1940
|
strictControl("session_list_request", {}, "client_to_proxy"),
|
|
1931
1941
|
control("permission_mode_change", {
|
|
1932
|
-
mode:
|
|
1942
|
+
mode: z13.enum(["default", "auto_accept", "plan"]),
|
|
1933
1943
|
// sessionId 可选:传入时 proxy 按该会话的 mode 分叉(PTY 发 Tab ANSI),未传走全局日志行为
|
|
1934
1944
|
sessionId: IdSchema.optional()
|
|
1935
1945
|
}, "client_to_proxy"),
|
|
@@ -1938,33 +1948,33 @@ var relayControlDefinitions = [
|
|
|
1938
1948
|
control("session_history_response", {
|
|
1939
1949
|
...RequiredRequestIdShape,
|
|
1940
1950
|
...RequestErrorShape,
|
|
1941
|
-
success:
|
|
1942
|
-
sessions:
|
|
1951
|
+
success: z13.boolean(),
|
|
1952
|
+
sessions: z13.array(HistorySessionSchema)
|
|
1943
1953
|
}, "proxy_to_client"),
|
|
1944
1954
|
// PTY 语义状态,从 Envelope 迁移到 Control 层
|
|
1945
1955
|
control("pty_state", { sessionId: IdSchema, payload: PtyStatePayloadSchema }, "proxy_to_client"),
|
|
1946
1956
|
// Provider 语义状态,来自 Claude/Codex hook 等结构化事件,不从 PTY 字节推断
|
|
1947
1957
|
control("agent_status", { sessionId: IdSchema, payload: AgentStatusPayloadSchema }, "proxy_to_client"),
|
|
1948
1958
|
// 终端标题变化,proxy -> client
|
|
1949
|
-
control("terminal_title", { sessionId: IdSchema, title:
|
|
1959
|
+
control("terminal_title", { sessionId: IdSchema, title: z13.string() }, "proxy_to_client"),
|
|
1950
1960
|
// 终端尺寸变化,proxy -> client
|
|
1951
1961
|
control("terminal_resize", {
|
|
1952
1962
|
sessionId: IdSchema,
|
|
1953
|
-
cols:
|
|
1954
|
-
rows:
|
|
1963
|
+
cols: z13.number().int().positive(),
|
|
1964
|
+
rows: z13.number().int().positive(),
|
|
1955
1965
|
// PTY output and resize events share one ordered render sequence. The client can therefore
|
|
1956
1966
|
// place a resize between the exact byte frames that preceded and followed it.
|
|
1957
|
-
outputSeq:
|
|
1967
|
+
outputSeq: z13.number().int().nonnegative()
|
|
1958
1968
|
}, "proxy_to_client"),
|
|
1959
|
-
control("terminal_resize_request", { sessionId: IdSchema, cols:
|
|
1969
|
+
control("terminal_resize_request", { sessionId: IdSchema, cols: z13.number().int().positive(), rows: z13.number().int().positive() }, "client_to_proxy"),
|
|
1960
1970
|
// 远程终止 JSON 会话,client -> proxy
|
|
1961
1971
|
strictControl("session_terminate", { sessionId: IdSchema }, "client_to_proxy"),
|
|
1962
|
-
control("session_rename", { ...RequestIdShape, sessionId: IdSchema, name:
|
|
1972
|
+
control("session_rename", { ...RequestIdShape, sessionId: IdSchema, name: z13.string() }, "client_to_proxy"),
|
|
1963
1973
|
control("session_rename_response", {
|
|
1964
1974
|
...RequestIdShape,
|
|
1965
1975
|
sessionId: IdSchema,
|
|
1966
|
-
success:
|
|
1967
|
-
name:
|
|
1976
|
+
success: z13.boolean(),
|
|
1977
|
+
name: z13.string().optional(),
|
|
1968
1978
|
...RequestErrorShape
|
|
1969
1979
|
}, "proxy_to_client"),
|
|
1970
1980
|
// 中断当前 turn,client -> proxy;JSON 由 session-worker 打断 Claude 子进程并保留会话。
|
|
@@ -1972,22 +1982,22 @@ var relayControlDefinitions = [
|
|
|
1972
1982
|
// turn 完成信号,proxy -> client,对应 claude stream-json 的 result 事件
|
|
1973
1983
|
control("turn_result", {
|
|
1974
1984
|
sessionId: IdSchema,
|
|
1975
|
-
success:
|
|
1976
|
-
isError:
|
|
1985
|
+
success: z13.boolean(),
|
|
1986
|
+
isError: z13.boolean(),
|
|
1977
1987
|
// stream-json result.result 是本轮最终文本。assistant_message 流丢失或 CLI 未发增量时,
|
|
1978
1988
|
// Web 用它作为 JSON 模式兜底展示,避免 turn 已结束但界面空白。
|
|
1979
|
-
result:
|
|
1989
|
+
result: z13.string().optional()
|
|
1980
1990
|
}, "proxy_to_client"),
|
|
1981
1991
|
// 客户端发送到 PTY 的原始字节(ANSI 序列),不追加换行
|
|
1982
|
-
control("remote_input_raw", { sessionId: IdSchema, data:
|
|
1992
|
+
control("remote_input_raw", { sessionId: IdSchema, data: z13.string(), traceId: IdSchema.optional() }, "client_to_proxy"),
|
|
1983
1993
|
// 客户端询问 proxy 的环境信息 (home 路径等), client -> proxy -> response
|
|
1984
1994
|
// FilePathPicker 用 homePath 作为 select 模式下的默认起点, 新建会话时打开即可浏览
|
|
1985
1995
|
controlSchema("proxy_info_request", ProxyInfoRequestSchema, "client_to_proxy"),
|
|
1986
1996
|
controlSchema("proxy_info", ProxyInfoResponseSchema, "proxy_to_client"),
|
|
1987
|
-
control("agent_cli_config_update", { ...RequestIdShape, provider:
|
|
1997
|
+
control("agent_cli_config_update", { ...RequestIdShape, provider: z13.enum(providerValues), path: z13.string().min(1) }, "client_to_proxy"),
|
|
1988
1998
|
control("agent_cli_config_update_response", {
|
|
1989
1999
|
...RequestIdShape,
|
|
1990
|
-
provider:
|
|
2000
|
+
provider: z13.enum(providerValues),
|
|
1991
2001
|
agentCli: AgentCliStatusSchema.optional(),
|
|
1992
2002
|
...RequestErrorShape
|
|
1993
2003
|
}, "proxy_to_client"),
|
|
@@ -1999,16 +2009,16 @@ var relayControlDefinitions = [
|
|
|
1999
2009
|
// 非零退出。把可识别的运行时错误结构化推给 Web,避免关键错误只留在终端闪屏里。
|
|
2000
2010
|
control("session_runtime_error", {
|
|
2001
2011
|
sessionId: IdSchema,
|
|
2002
|
-
error:
|
|
2012
|
+
error: z13.string(),
|
|
2003
2013
|
errorCode: ControlErrorCodeSchema,
|
|
2004
|
-
activeWriterPid:
|
|
2014
|
+
activeWriterPid: z13.number().int().positive().optional()
|
|
2005
2015
|
}, "proxy_to_client"),
|
|
2006
2016
|
// 客户端请求会话历史消息,client -> proxy
|
|
2007
2017
|
control("session_messages_request", {
|
|
2008
2018
|
...RequestIdShape,
|
|
2009
2019
|
sessionId: IdSchema,
|
|
2010
|
-
limit:
|
|
2011
|
-
before:
|
|
2020
|
+
limit: z13.number().int().min(1).max(200).optional(),
|
|
2021
|
+
before: z13.string().optional()
|
|
2012
2022
|
}, "client_to_proxy"),
|
|
2013
2023
|
// 客户端请求会话资源(命令列表 + 文件树),client -> proxy
|
|
2014
2024
|
control("session_resources_request", { ...RequiredRequestIdShape, sessionId: IdSchema }, "client_to_proxy"),
|
|
@@ -2016,14 +2026,14 @@ var relayControlDefinitions = [
|
|
|
2016
2026
|
...RequiredRequestIdShape,
|
|
2017
2027
|
...RequestErrorShape,
|
|
2018
2028
|
sessionId: IdSchema,
|
|
2019
|
-
commands:
|
|
2020
|
-
groups:
|
|
2029
|
+
commands: z13.array(CommandEntrySchema),
|
|
2030
|
+
groups: z13.array(FileTreeGroupSchema)
|
|
2021
2031
|
}, "proxy_to_client"),
|
|
2022
2032
|
// 客户端请求当前 provider 语义状态;不经 relay 缓存,由 proxy 返回当前值
|
|
2023
2033
|
control("agent_status_request", { ...RequestIdShape, sessionId: IdSchema.optional() }, "client_to_proxy"),
|
|
2024
2034
|
control("agent_status_response", {
|
|
2025
2035
|
...RequestIdShape,
|
|
2026
|
-
statuses:
|
|
2036
|
+
statuses: z13.array(z13.object({ sessionId: IdSchema, payload: AgentStatusPayloadSchema }))
|
|
2027
2037
|
}, "proxy_to_client"),
|
|
2028
2038
|
// 客户端确认已收到审批请求;proxy 只记录送达状态,不把它当成用户决策
|
|
2029
2039
|
control("permission_request_delivered", { sessionId: IdSchema, requestId: IdSchema }, "client_to_proxy"),
|
|
@@ -2033,18 +2043,18 @@ var relayControlDefinitions = [
|
|
|
2033
2043
|
control("permission_decision_result", {
|
|
2034
2044
|
sessionId: IdSchema,
|
|
2035
2045
|
requestId: IdSchema,
|
|
2036
|
-
outcome:
|
|
2037
|
-
delivered:
|
|
2038
|
-
message:
|
|
2046
|
+
outcome: z13.enum(["allow", "deny"]),
|
|
2047
|
+
delivered: z13.boolean(),
|
|
2048
|
+
message: z13.string().optional()
|
|
2039
2049
|
}, "proxy_to_client"),
|
|
2040
2050
|
// proxy 推送当前 pending 的工具审批列表,client 据此恢复审批卡片
|
|
2041
2051
|
control("pending_approvals_push", {
|
|
2042
2052
|
sessionId: IdSchema,
|
|
2043
|
-
approvals:
|
|
2053
|
+
approvals: z13.array(z13.object({
|
|
2044
2054
|
requestId: IdSchema,
|
|
2045
|
-
toolName:
|
|
2046
|
-
input:
|
|
2047
|
-
options:
|
|
2055
|
+
toolName: z13.string(),
|
|
2056
|
+
input: z13.record(z13.string(), z13.unknown()),
|
|
2057
|
+
options: z13.array(ApprovalOptionSchema).optional()
|
|
2048
2058
|
}))
|
|
2049
2059
|
}, "proxy_to_client"),
|
|
2050
2060
|
// Voice Pilot speech summaries are produced by proxy-side Claude Code so it can read project context.
|
|
@@ -2052,7 +2062,7 @@ var relayControlDefinitions = [
|
|
|
2052
2062
|
...RequestIdShape,
|
|
2053
2063
|
sessionId: IdSchema,
|
|
2054
2064
|
messageId: IdSchema,
|
|
2055
|
-
text:
|
|
2065
|
+
text: z13.string().min(1),
|
|
2056
2066
|
reason: VoiceSummaryReasonSchema
|
|
2057
2067
|
}, "client_to_proxy"),
|
|
2058
2068
|
control("voice_summary_response", {
|
|
@@ -2060,27 +2070,27 @@ var relayControlDefinitions = [
|
|
|
2060
2070
|
...RequestErrorShape,
|
|
2061
2071
|
sessionId: IdSchema,
|
|
2062
2072
|
messageId: IdSchema,
|
|
2063
|
-
success:
|
|
2064
|
-
summary:
|
|
2073
|
+
success: z13.boolean(),
|
|
2074
|
+
summary: z13.string().min(1).optional()
|
|
2065
2075
|
}, "proxy_to_client"),
|
|
2066
2076
|
// 恢复会话时推送历史消息,proxy -> client
|
|
2067
2077
|
control("session_history_messages", {
|
|
2068
2078
|
...RequestIdShape,
|
|
2069
2079
|
sessionId: IdSchema,
|
|
2070
|
-
before:
|
|
2071
|
-
messages:
|
|
2072
|
-
hasMore:
|
|
2073
|
-
nextBefore:
|
|
2080
|
+
before: z13.string().optional(),
|
|
2081
|
+
messages: z13.array(SessionHistoryMessageSchema),
|
|
2082
|
+
hasMore: z13.boolean().optional(),
|
|
2083
|
+
nextBefore: z13.string().optional()
|
|
2074
2084
|
}, "proxy_to_client"),
|
|
2075
2085
|
// proxy 重连后同步活跃 session 列表给 relay。session_sync 由 relay 自消费(更新 proxy-session
|
|
2076
2086
|
// 关联)不转发给 client,因此**没有** direction 标注——RelayControlDirection 只描述转发流。
|
|
2077
2087
|
control("session_sync", {
|
|
2078
|
-
sessions:
|
|
2079
|
-
id:
|
|
2080
|
-
cwd:
|
|
2081
|
-
name:
|
|
2082
|
-
nameLocked:
|
|
2083
|
-
state:
|
|
2088
|
+
sessions: z13.array(createSessionIdentitySchema({
|
|
2089
|
+
id: z13.string(),
|
|
2090
|
+
cwd: z13.string(),
|
|
2091
|
+
name: z13.string().optional(),
|
|
2092
|
+
nameLocked: z13.boolean().optional(),
|
|
2093
|
+
state: z13.enum(sessionStateValues)
|
|
2084
2094
|
}))
|
|
2085
2095
|
}),
|
|
2086
2096
|
// PTY 会话订阅,client -> proxy,触发 terminal serialize() 返回当前状态
|
|
@@ -2088,15 +2098,15 @@ var relayControlDefinitions = [
|
|
|
2088
2098
|
// PTY 会话快照,proxy -> client,serialize() 的全量终端状态
|
|
2089
2099
|
control("session_snapshot", {
|
|
2090
2100
|
sessionId: IdSchema,
|
|
2091
|
-
cols:
|
|
2092
|
-
rows:
|
|
2093
|
-
data:
|
|
2094
|
-
outputSeq:
|
|
2101
|
+
cols: z13.number().int().positive(),
|
|
2102
|
+
rows: z13.number().int().positive(),
|
|
2103
|
+
data: z13.string(),
|
|
2104
|
+
outputSeq: z13.number().int().nonnegative(),
|
|
2095
2105
|
requestId: IdSchema
|
|
2096
2106
|
}, "proxy_to_client")
|
|
2097
2107
|
];
|
|
2098
2108
|
var relayControlSchemas = relayControlDefinitions.map((definition) => definition.schema);
|
|
2099
|
-
var RelayControlSchema =
|
|
2109
|
+
var RelayControlSchema = z13.discriminatedUnion("type", relayControlSchemas);
|
|
2100
2110
|
var ProxyToClientRelayControlTypes = new Set(relayControlDefinitions.filter((definition) => definition.directions.has("proxy_to_client")).map((definition) => definition.type));
|
|
2101
2111
|
var ClientToProxyRelayControlTypes = new Set(relayControlDefinitions.filter((definition) => definition.directions.has("client_to_proxy")).map((definition) => definition.type));
|
|
2102
2112
|
|
|
@@ -2300,7 +2310,7 @@ function encodeDevicePreviewH264ProxyPacket(streamId, packet) {
|
|
|
2300
2310
|
}
|
|
2301
2311
|
|
|
2302
2312
|
// src/ipc/ipc-protocol.ts
|
|
2303
|
-
import { z as
|
|
2313
|
+
import { z as z14 } from "zod";
|
|
2304
2314
|
|
|
2305
2315
|
// src/ipc/line-buffer.ts
|
|
2306
2316
|
import { Transform } from "stream";
|
|
@@ -2343,283 +2353,283 @@ function encodeBinaryIpcFrame(sessionId, data, outputSeq) {
|
|
|
2343
2353
|
return frame;
|
|
2344
2354
|
}
|
|
2345
2355
|
var sessionStateValues2 = Object.values(SessionState);
|
|
2346
|
-
var ProviderHookContextSchema =
|
|
2347
|
-
provider:
|
|
2348
|
-
sessionId:
|
|
2349
|
-
hookUrl:
|
|
2350
|
-
marker:
|
|
2351
|
-
token:
|
|
2356
|
+
var ProviderHookContextSchema = z14.object({
|
|
2357
|
+
provider: z14.enum(["claude", "codex"]),
|
|
2358
|
+
sessionId: z14.string(),
|
|
2359
|
+
hookUrl: z14.string(),
|
|
2360
|
+
marker: z14.string(),
|
|
2361
|
+
token: z14.string()
|
|
2352
2362
|
}).strict();
|
|
2353
2363
|
var terminalSessionCreateFields = {
|
|
2354
|
-
type:
|
|
2355
|
-
name:
|
|
2356
|
-
mode:
|
|
2357
|
-
cwd:
|
|
2358
|
-
pid:
|
|
2359
|
-
protocolVersion:
|
|
2360
|
-
sessionId:
|
|
2364
|
+
type: z14.literal("session_create_request"),
|
|
2365
|
+
name: z14.string().optional(),
|
|
2366
|
+
mode: z14.literal("pty"),
|
|
2367
|
+
cwd: z14.string().min(1),
|
|
2368
|
+
pid: z14.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
2369
|
+
protocolVersion: z14.literal(TERMINAL_IPC_PROTOCOL_VERSION),
|
|
2370
|
+
sessionId: z14.string().min(1).optional()
|
|
2361
2371
|
};
|
|
2362
|
-
var TerminalSessionCreateRequestSchema =
|
|
2363
|
-
|
|
2372
|
+
var TerminalSessionCreateRequestSchema = z14.discriminatedUnion("kind", [
|
|
2373
|
+
z14.object({
|
|
2364
2374
|
...terminalSessionCreateFields,
|
|
2365
|
-
kind:
|
|
2366
|
-
provider:
|
|
2375
|
+
kind: z14.literal("agent"),
|
|
2376
|
+
provider: z14.enum(providerValues)
|
|
2367
2377
|
}).strict(),
|
|
2368
|
-
|
|
2378
|
+
z14.object({
|
|
2369
2379
|
...terminalSessionCreateFields,
|
|
2370
|
-
kind:
|
|
2371
|
-
provider:
|
|
2380
|
+
kind: z14.literal("terminal"),
|
|
2381
|
+
provider: z14.literal("claude")
|
|
2372
2382
|
}).strict()
|
|
2373
2383
|
]);
|
|
2374
|
-
var TerminalSessionCreateResponseSchema =
|
|
2375
|
-
|
|
2376
|
-
type:
|
|
2377
|
-
success:
|
|
2378
|
-
sessionId:
|
|
2379
|
-
protocolVersion:
|
|
2384
|
+
var TerminalSessionCreateResponseSchema = z14.discriminatedUnion("success", [
|
|
2385
|
+
z14.object({
|
|
2386
|
+
type: z14.literal("session_create_response"),
|
|
2387
|
+
success: z14.literal(true),
|
|
2388
|
+
sessionId: z14.string().min(1),
|
|
2389
|
+
protocolVersion: z14.literal(TERMINAL_IPC_PROTOCOL_VERSION),
|
|
2380
2390
|
hook: ProviderHookContextSchema.optional()
|
|
2381
2391
|
}).strict(),
|
|
2382
|
-
|
|
2383
|
-
type:
|
|
2384
|
-
success:
|
|
2385
|
-
protocolVersion:
|
|
2386
|
-
error:
|
|
2392
|
+
z14.object({
|
|
2393
|
+
type: z14.literal("session_create_response"),
|
|
2394
|
+
success: z14.literal(false),
|
|
2395
|
+
protocolVersion: z14.literal(TERMINAL_IPC_PROTOCOL_VERSION),
|
|
2396
|
+
error: z14.string().min(1)
|
|
2387
2397
|
}).strict()
|
|
2388
2398
|
]);
|
|
2389
|
-
var IpcMessageSchema =
|
|
2399
|
+
var IpcMessageSchema = z14.discriminatedUnion("type", [
|
|
2390
2400
|
// 客户端请求创建新会话,sessionId 可选用于重连时复用
|
|
2391
2401
|
TerminalSessionCreateRequestSchema,
|
|
2392
2402
|
// 服务端响应创建会话
|
|
2393
2403
|
TerminalSessionCreateResponseSchema,
|
|
2394
2404
|
// 客户端向服务端注册 PTY 会话
|
|
2395
|
-
|
|
2396
|
-
type:
|
|
2397
|
-
sessionId:
|
|
2398
|
-
pid:
|
|
2405
|
+
z14.object({
|
|
2406
|
+
type: z14.literal("pty_register"),
|
|
2407
|
+
sessionId: z14.string(),
|
|
2408
|
+
pid: z14.number()
|
|
2399
2409
|
}),
|
|
2400
2410
|
// 客户端取消注册 PTY 会话
|
|
2401
|
-
|
|
2402
|
-
type:
|
|
2403
|
-
sessionId:
|
|
2404
|
-
exitCode:
|
|
2405
|
-
errorTail:
|
|
2411
|
+
z14.object({
|
|
2412
|
+
type: z14.literal("pty_deregister"),
|
|
2413
|
+
sessionId: z14.string(),
|
|
2414
|
+
exitCode: z14.number().int().optional(),
|
|
2415
|
+
errorTail: z14.string().max(2048).optional()
|
|
2406
2416
|
}),
|
|
2407
2417
|
// 输入,从服务端转发到客户端的 PTY stdin(手机远程输入注入)
|
|
2408
|
-
|
|
2409
|
-
type:
|
|
2410
|
-
sessionId:
|
|
2411
|
-
data:
|
|
2412
|
-
traceId:
|
|
2418
|
+
z14.object({
|
|
2419
|
+
type: z14.literal("pty_input"),
|
|
2420
|
+
sessionId: z14.string(),
|
|
2421
|
+
data: z14.string(),
|
|
2422
|
+
traceId: z14.string().optional()
|
|
2413
2423
|
}),
|
|
2414
2424
|
// serve → terminal:Web 端移除本地终端会话时,只断开远程视图,不杀本地 CLI。
|
|
2415
|
-
|
|
2416
|
-
type:
|
|
2417
|
-
sessionId:
|
|
2425
|
+
z14.object({
|
|
2426
|
+
type: z14.literal("pty_detach"),
|
|
2427
|
+
sessionId: z14.string()
|
|
2418
2428
|
}),
|
|
2419
2429
|
// serve → terminal worker:终止 Web 创建的纯终端进程。
|
|
2420
|
-
|
|
2421
|
-
type:
|
|
2422
|
-
sessionId:
|
|
2430
|
+
z14.object({
|
|
2431
|
+
type: z14.literal("pty_terminate"),
|
|
2432
|
+
sessionId: z14.string()
|
|
2423
2433
|
}),
|
|
2424
2434
|
// 错误响应
|
|
2425
|
-
|
|
2426
|
-
type:
|
|
2427
|
-
message:
|
|
2428
|
-
code:
|
|
2435
|
+
z14.object({
|
|
2436
|
+
type: z14.literal("error"),
|
|
2437
|
+
message: z14.string(),
|
|
2438
|
+
code: z14.string().optional()
|
|
2429
2439
|
}),
|
|
2430
2440
|
// 客户端请求服务状态(含 relay 连接信息和 worker 状态)
|
|
2431
|
-
|
|
2432
|
-
type:
|
|
2433
|
-
protocolVersion:
|
|
2441
|
+
z14.object({
|
|
2442
|
+
type: z14.literal("service_status_request"),
|
|
2443
|
+
protocolVersion: z14.literal(TERMINAL_IPC_PROTOCOL_VERSION)
|
|
2434
2444
|
}).strict(),
|
|
2435
2445
|
// 服务端响应增强版服务状态
|
|
2436
|
-
|
|
2437
|
-
type:
|
|
2438
|
-
protocolVersion:
|
|
2439
|
-
config:
|
|
2440
|
-
profile:
|
|
2441
|
-
version:
|
|
2442
|
-
autoUpdate:
|
|
2443
|
-
relayName:
|
|
2444
|
-
relayNameSource:
|
|
2445
|
-
relayUrl:
|
|
2446
|
-
relayUrlSource:
|
|
2447
|
-
relayTokenSource:
|
|
2448
|
-
hookPort:
|
|
2449
|
-
hookPortSource:
|
|
2446
|
+
z14.object({
|
|
2447
|
+
type: z14.literal("service_status_response"),
|
|
2448
|
+
protocolVersion: z14.literal(TERMINAL_IPC_PROTOCOL_VERSION),
|
|
2449
|
+
config: z14.object({
|
|
2450
|
+
profile: z14.string().optional(),
|
|
2451
|
+
version: z14.string(),
|
|
2452
|
+
autoUpdate: z14.boolean(),
|
|
2453
|
+
relayName: z14.string(),
|
|
2454
|
+
relayNameSource: z14.enum(["cli", "profile", "env"]),
|
|
2455
|
+
relayUrl: z14.string().optional(),
|
|
2456
|
+
relayUrlSource: z14.enum(["env", "file", "none"]),
|
|
2457
|
+
relayTokenSource: z14.enum(["env", "file", "none"]),
|
|
2458
|
+
hookPort: z14.number(),
|
|
2459
|
+
hookPortSource: z14.enum(["env", "file", "default"])
|
|
2450
2460
|
}),
|
|
2451
|
-
relay:
|
|
2452
|
-
connected:
|
|
2453
|
-
proxyId:
|
|
2454
|
-
reconnectAttempt:
|
|
2455
|
-
queueDepth:
|
|
2461
|
+
relay: z14.object({
|
|
2462
|
+
connected: z14.boolean(),
|
|
2463
|
+
proxyId: z14.string(),
|
|
2464
|
+
reconnectAttempt: z14.number(),
|
|
2465
|
+
queueDepth: z14.number()
|
|
2456
2466
|
}).nullable(),
|
|
2457
|
-
sessions:
|
|
2458
|
-
|
|
2459
|
-
id:
|
|
2460
|
-
mode:
|
|
2461
|
-
state:
|
|
2462
|
-
createdAt:
|
|
2463
|
-
name:
|
|
2464
|
-
hasWorker:
|
|
2467
|
+
sessions: z14.array(
|
|
2468
|
+
z14.object({
|
|
2469
|
+
id: z14.string(),
|
|
2470
|
+
mode: z14.enum(["pty", "json"]),
|
|
2471
|
+
state: z14.enum(sessionStateValues2),
|
|
2472
|
+
createdAt: z14.string(),
|
|
2473
|
+
name: z14.string().optional(),
|
|
2474
|
+
hasWorker: z14.boolean()
|
|
2465
2475
|
})
|
|
2466
2476
|
)
|
|
2467
2477
|
}).strict(),
|
|
2468
2478
|
// terminal → serve:终端标题变化,由 xterm onTitleChange 触发
|
|
2469
|
-
|
|
2470
|
-
type:
|
|
2471
|
-
sessionId:
|
|
2472
|
-
title:
|
|
2479
|
+
z14.object({
|
|
2480
|
+
type: z14.literal("pty_title_change"),
|
|
2481
|
+
sessionId: z14.string(),
|
|
2482
|
+
title: z14.string()
|
|
2473
2483
|
}),
|
|
2474
2484
|
// terminal → serve:shell 通过 OSC 7 报告的当前工作目录
|
|
2475
|
-
|
|
2476
|
-
type:
|
|
2477
|
-
sessionId:
|
|
2478
|
-
cwd:
|
|
2485
|
+
z14.object({
|
|
2486
|
+
type: z14.literal("pty_cwd_change"),
|
|
2487
|
+
sessionId: z14.string(),
|
|
2488
|
+
cwd: z14.string().min(1)
|
|
2479
2489
|
}),
|
|
2480
2490
|
// terminal → serve:local runtime 观察到的 PTY 语义事件。
|
|
2481
|
-
|
|
2482
|
-
type:
|
|
2483
|
-
sessionId:
|
|
2484
|
-
state:
|
|
2485
|
-
seq:
|
|
2486
|
-
title:
|
|
2487
|
-
tool:
|
|
2491
|
+
z14.object({
|
|
2492
|
+
type: z14.literal("pty_semantic_event"),
|
|
2493
|
+
sessionId: z14.string(),
|
|
2494
|
+
state: z14.enum(ptySemanticStateValues),
|
|
2495
|
+
seq: z14.number().int().nonnegative(),
|
|
2496
|
+
title: z14.string().optional(),
|
|
2497
|
+
tool: z14.string().optional()
|
|
2488
2498
|
}),
|
|
2489
2499
|
// terminal → serve:终端尺寸变化
|
|
2490
|
-
|
|
2491
|
-
type:
|
|
2492
|
-
sessionId:
|
|
2493
|
-
cols:
|
|
2494
|
-
rows:
|
|
2500
|
+
z14.object({
|
|
2501
|
+
type: z14.literal("pty_resize"),
|
|
2502
|
+
sessionId: z14.string(),
|
|
2503
|
+
cols: z14.number(),
|
|
2504
|
+
rows: z14.number(),
|
|
2495
2505
|
// Shares the monotonic render-event sequence used by binary PTY frames and snapshots.
|
|
2496
|
-
outputSeq:
|
|
2506
|
+
outputSeq: z14.number().int().nonnegative()
|
|
2497
2507
|
}),
|
|
2498
2508
|
// serve → terminal worker:Web owns pure terminal geometry, so resize requests flow down.
|
|
2499
|
-
|
|
2500
|
-
type:
|
|
2501
|
-
sessionId:
|
|
2502
|
-
cols:
|
|
2503
|
-
rows:
|
|
2509
|
+
z14.object({
|
|
2510
|
+
type: z14.literal("pty_resize_request"),
|
|
2511
|
+
sessionId: z14.string(),
|
|
2512
|
+
cols: z14.number(),
|
|
2513
|
+
rows: z14.number()
|
|
2504
2514
|
}),
|
|
2505
2515
|
// serve → terminal:请求 HeadlessTerminal serialize() 快照
|
|
2506
|
-
|
|
2507
|
-
type:
|
|
2508
|
-
sessionId:
|
|
2509
|
-
requestId:
|
|
2516
|
+
z14.object({
|
|
2517
|
+
type: z14.literal("pty_subscribe"),
|
|
2518
|
+
sessionId: z14.string(),
|
|
2519
|
+
requestId: z14.string()
|
|
2510
2520
|
}),
|
|
2511
2521
|
// terminal → serve:serialize() 结果
|
|
2512
|
-
|
|
2513
|
-
type:
|
|
2514
|
-
sessionId:
|
|
2515
|
-
cols:
|
|
2516
|
-
rows:
|
|
2517
|
-
data:
|
|
2518
|
-
outputSeq:
|
|
2519
|
-
requestId:
|
|
2522
|
+
z14.object({
|
|
2523
|
+
type: z14.literal("pty_snapshot"),
|
|
2524
|
+
sessionId: z14.string(),
|
|
2525
|
+
cols: z14.number(),
|
|
2526
|
+
rows: z14.number(),
|
|
2527
|
+
data: z14.string(),
|
|
2528
|
+
outputSeq: z14.number().int().nonnegative(),
|
|
2529
|
+
requestId: z14.string()
|
|
2520
2530
|
}),
|
|
2521
2531
|
// serve → terminal:relay 连接状态变更,供终端给用户显示 remote viewing 是否通畅
|
|
2522
|
-
|
|
2523
|
-
type:
|
|
2524
|
-
connected:
|
|
2532
|
+
z14.object({
|
|
2533
|
+
type: z14.literal("bridge_status"),
|
|
2534
|
+
connected: z14.boolean()
|
|
2525
2535
|
})
|
|
2526
2536
|
]);
|
|
2527
|
-
var WorkerMessageSchema =
|
|
2537
|
+
var WorkerMessageSchema = z14.discriminatedUnion("type", [
|
|
2528
2538
|
// worker → serve: every socket connection begins with this protocol and process identity.
|
|
2529
2539
|
// Readiness is reported separately because provider bootstrap can fail after IPC negotiation.
|
|
2530
|
-
|
|
2531
|
-
type:
|
|
2532
|
-
protocolVersion:
|
|
2533
|
-
sessionId:
|
|
2534
|
-
provider:
|
|
2535
|
-
pid:
|
|
2540
|
+
z14.object({
|
|
2541
|
+
type: z14.literal("worker_protocol_hello"),
|
|
2542
|
+
protocolVersion: z14.literal(WORKER_IPC_PROTOCOL_VERSION),
|
|
2543
|
+
sessionId: z14.string().min(1),
|
|
2544
|
+
provider: z14.enum(providerValues),
|
|
2545
|
+
pid: z14.number().int().positive().max(Number.MAX_SAFE_INTEGER)
|
|
2536
2546
|
}).strict(),
|
|
2537
2547
|
// serve → worker: the worker also rejects a daemon from another IPC generation.
|
|
2538
|
-
|
|
2539
|
-
type:
|
|
2540
|
-
protocolVersion:
|
|
2541
|
-
sessionId:
|
|
2542
|
-
pid:
|
|
2548
|
+
z14.object({
|
|
2549
|
+
type: z14.literal("serve_protocol_hello"),
|
|
2550
|
+
protocolVersion: z14.literal(WORKER_IPC_PROTOCOL_VERSION),
|
|
2551
|
+
sessionId: z14.string().min(1),
|
|
2552
|
+
pid: z14.number().int().positive().max(Number.MAX_SAFE_INTEGER)
|
|
2543
2553
|
}).strict(),
|
|
2544
2554
|
// serve → worker: 发送用户输入给 claude
|
|
2545
|
-
|
|
2546
|
-
type:
|
|
2547
|
-
content:
|
|
2555
|
+
z14.object({
|
|
2556
|
+
type: z14.literal("worker_input"),
|
|
2557
|
+
content: z14.string()
|
|
2548
2558
|
}),
|
|
2549
2559
|
// serve → worker: 停止 claude 进程(终止整个 JSON 会话)
|
|
2550
|
-
|
|
2551
|
-
type:
|
|
2560
|
+
z14.object({
|
|
2561
|
+
type: z14.literal("worker_stop")
|
|
2552
2562
|
}),
|
|
2553
2563
|
// serve → worker: 只中断当前 provider turn,worker 进程保持可复用。
|
|
2554
|
-
|
|
2555
|
-
type:
|
|
2564
|
+
z14.object({
|
|
2565
|
+
type: z14.literal("worker_interrupt")
|
|
2556
2566
|
}),
|
|
2557
2567
|
// serve → worker: 工具审批响应
|
|
2558
|
-
|
|
2559
|
-
type:
|
|
2560
|
-
requestId:
|
|
2561
|
-
behavior:
|
|
2562
|
-
message:
|
|
2563
|
-
remember:
|
|
2564
|
-
optionId:
|
|
2568
|
+
z14.object({
|
|
2569
|
+
type: z14.literal("worker_approval_response"),
|
|
2570
|
+
requestId: z14.string(),
|
|
2571
|
+
behavior: z14.enum(["allow", "deny"]),
|
|
2572
|
+
message: z14.string().optional(),
|
|
2573
|
+
remember: z14.boolean().optional(),
|
|
2574
|
+
optionId: z14.string().optional()
|
|
2565
2575
|
}),
|
|
2566
2576
|
// worker → serve: provider 输出事件(带序列号)
|
|
2567
|
-
|
|
2568
|
-
type:
|
|
2569
|
-
seq:
|
|
2570
|
-
event:
|
|
2577
|
+
z14.object({
|
|
2578
|
+
type: z14.literal("worker_event"),
|
|
2579
|
+
seq: z14.number(),
|
|
2580
|
+
event: z14.record(z14.string(), z14.unknown())
|
|
2571
2581
|
}),
|
|
2572
2582
|
// worker → serve: provider 进程退出
|
|
2573
|
-
|
|
2574
|
-
type:
|
|
2575
|
-
code:
|
|
2576
|
-
errorTail:
|
|
2583
|
+
z14.object({
|
|
2584
|
+
type: z14.literal("worker_exit"),
|
|
2585
|
+
code: z14.number(),
|
|
2586
|
+
errorTail: z14.string().max(2048).optional()
|
|
2577
2587
|
}),
|
|
2578
2588
|
// worker → serve: 当前 turn 已中断,JSON 会话仍可继续接收后续输入。
|
|
2579
|
-
|
|
2580
|
-
type:
|
|
2589
|
+
z14.object({
|
|
2590
|
+
type: z14.literal("worker_interrupted")
|
|
2581
2591
|
}),
|
|
2582
2592
|
// worker → serve: provider 真正开始执行一个排队中的 turn(区别于仅接收输入)。
|
|
2583
|
-
|
|
2584
|
-
type:
|
|
2593
|
+
z14.object({
|
|
2594
|
+
type: z14.literal("worker_turn_started")
|
|
2585
2595
|
}),
|
|
2586
2596
|
// worker → serve: 工具审批请求
|
|
2587
|
-
|
|
2588
|
-
type:
|
|
2589
|
-
requestId:
|
|
2590
|
-
toolName:
|
|
2591
|
-
input:
|
|
2592
|
-
options:
|
|
2597
|
+
z14.object({
|
|
2598
|
+
type: z14.literal("worker_approval_request"),
|
|
2599
|
+
requestId: z14.string(),
|
|
2600
|
+
toolName: z14.string(),
|
|
2601
|
+
input: z14.record(z14.string(), z14.unknown()),
|
|
2602
|
+
options: z14.array(ApprovalOptionSchema).optional()
|
|
2593
2603
|
}),
|
|
2594
2604
|
// worker → serve: worker 就绪。Claude 在进程启动后发送;Codex/Kimi 分别在
|
|
2595
2605
|
// app-server/ACP initialize + native session start|resume 完成后发送。
|
|
2596
|
-
|
|
2597
|
-
type:
|
|
2598
|
-
pid:
|
|
2599
|
-
nativeSession:
|
|
2600
|
-
provider:
|
|
2601
|
-
sessionId:
|
|
2606
|
+
z14.object({
|
|
2607
|
+
type: z14.literal("worker_ready"),
|
|
2608
|
+
pid: z14.number(),
|
|
2609
|
+
nativeSession: z14.object({
|
|
2610
|
+
provider: z14.enum(providerValues),
|
|
2611
|
+
sessionId: z14.string()
|
|
2602
2612
|
}).optional()
|
|
2603
2613
|
}),
|
|
2604
2614
|
// Provider 在 worker_ready 之前失败时保留一小段脱敏后的诊断;可识别错误同时携带
|
|
2605
2615
|
// 结构化 code,serve 不再只能把它降级成笼统的 WORKER_START_FAILED。
|
|
2606
|
-
|
|
2607
|
-
type:
|
|
2608
|
-
provider:
|
|
2609
|
-
message:
|
|
2610
|
-
errorCode:
|
|
2611
|
-
nativeSessionId:
|
|
2616
|
+
z14.object({
|
|
2617
|
+
type: z14.literal("worker_startup_error"),
|
|
2618
|
+
provider: z14.enum(providerValues),
|
|
2619
|
+
message: z14.string().max(2048),
|
|
2620
|
+
errorCode: z14.literal(ControlErrorCode.SESSION_ALREADY_ACTIVE).optional(),
|
|
2621
|
+
nativeSessionId: z14.string().optional()
|
|
2612
2622
|
}),
|
|
2613
2623
|
// worker → serve: provider 原生会话 ID。
|
|
2614
|
-
|
|
2615
|
-
type:
|
|
2616
|
-
provider:
|
|
2617
|
-
sessionId:
|
|
2624
|
+
z14.object({
|
|
2625
|
+
type: z14.literal("worker_native_session_id"),
|
|
2626
|
+
provider: z14.enum(providerValues),
|
|
2627
|
+
sessionId: z14.string()
|
|
2618
2628
|
}),
|
|
2619
2629
|
// serve → worker: 将指定工具加入会话白名单,后续同名工具自动审批
|
|
2620
|
-
|
|
2621
|
-
type:
|
|
2622
|
-
toolName:
|
|
2630
|
+
z14.object({
|
|
2631
|
+
type: z14.literal("worker_whitelist_add"),
|
|
2632
|
+
toolName: z14.string()
|
|
2623
2633
|
})
|
|
2624
2634
|
]);
|
|
2625
2635
|
function serializeWorkerMsg(msg) {
|
|
@@ -2710,6 +2720,7 @@ export {
|
|
|
2710
2720
|
PTY_INITIAL_MAX_COLS,
|
|
2711
2721
|
PTY_INITIAL_MAX_ROWS,
|
|
2712
2722
|
MessageEnvelopeSchema,
|
|
2723
|
+
ProxyUpgradeBootstrapResponseSchema,
|
|
2713
2724
|
WebPreviewNameSchema,
|
|
2714
2725
|
TunnelProviderSchema,
|
|
2715
2726
|
PreviewSourceSchema,
|
|
@@ -2742,4 +2753,4 @@ export {
|
|
|
2742
2753
|
serializeIpc,
|
|
2743
2754
|
createIpcReader
|
|
2744
2755
|
};
|
|
2745
|
-
//# sourceMappingURL=chunk-
|
|
2756
|
+
//# sourceMappingURL=chunk-NTL4CXBA.js.map
|