@dev-anywhere/proxy 0.3.14 → 0.4.3

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.
@@ -325,8 +325,60 @@ function defineFSM(transitions) {
325
325
  };
326
326
  }
327
327
 
328
- // ../../packages/shared/dist/schemas/relay-control.js
328
+ // ../../packages/shared/dist/schemas/voice.js
329
329
  import { z as z7 } from "zod";
330
+ var voiceProviderValues = ["aliyun-bailian"];
331
+ var voiceRegionValues = ["cn", "intl"];
332
+ var voiceOptionSourceValues = ["official", "custom"];
333
+ var voiceOptionGenderValues = ["male", "female", "unknown"];
334
+ var VoiceProviderConfigSchema = z7.object({
335
+ provider: z7.enum(voiceProviderValues),
336
+ configured: z7.boolean(),
337
+ region: z7.enum(voiceRegionValues),
338
+ asrModel: z7.string().min(1),
339
+ ttsModel: z7.string().min(1),
340
+ ttsVoice: z7.string().min(1),
341
+ turnIdleSeconds: z7.number().int().positive().safe().default(3)
342
+ }).strict();
343
+ var VoiceConfigUpdateSchema = z7.object({
344
+ provider: z7.enum(voiceProviderValues).optional(),
345
+ apiKey: z7.string().min(1).optional(),
346
+ clearApiKey: z7.boolean().optional(),
347
+ region: z7.enum(voiceRegionValues).optional(),
348
+ asrModel: z7.string().min(1).optional(),
349
+ ttsModel: z7.string().min(1).optional(),
350
+ ttsVoice: z7.string().min(1).optional(),
351
+ turnIdleSeconds: z7.number().int().positive().safe().optional()
352
+ }).strict();
353
+ var VoiceOptionSchema = z7.object({
354
+ value: z7.string().min(1),
355
+ label: z7.string().min(1),
356
+ description: z7.string().min(1).optional(),
357
+ gender: z7.enum(voiceOptionGenderValues).optional(),
358
+ age: z7.string().min(1).optional(),
359
+ model: z7.string().min(1).optional(),
360
+ source: z7.enum(voiceOptionSourceValues)
361
+ }).strict();
362
+ var VoiceCapabilitiesSchema = z7.object({
363
+ asrModels: z7.array(VoiceOptionSchema),
364
+ ttsModels: z7.array(VoiceOptionSchema),
365
+ ttsVoices: z7.array(VoiceOptionSchema),
366
+ fetchedAt: z7.number().optional()
367
+ }).strict();
368
+ var VoiceSummaryReasonSchema = z7.enum([
369
+ "code",
370
+ "table",
371
+ "diff",
372
+ "log",
373
+ "stack_trace",
374
+ "long_list",
375
+ "long_text",
376
+ "mixed",
377
+ "approval"
378
+ ]);
379
+
380
+ // ../../packages/shared/dist/schemas/relay-control.js
381
+ import { z as z8 } from "zod";
330
382
 
331
383
  // ../../packages/shared/dist/constants/relay-errors.js
332
384
  var RelayErrorCode = {
@@ -353,59 +405,60 @@ var ControlErrorCode = {
353
405
  };
354
406
 
355
407
  // ../../packages/shared/dist/schemas/relay-control.js
356
- var ProxyInfoSchema = z7.object({
408
+ var ProxyInfoSchema = z8.object({
357
409
  proxyId: IdSchema,
358
- name: z7.string().optional(),
359
- online: z7.boolean(),
360
- sessions: z7.array(z7.string()).optional()
410
+ name: z8.string().optional(),
411
+ online: z8.boolean(),
412
+ sessions: z8.array(z8.string()).optional()
361
413
  });
362
- var AgentCliAvailabilitySchema = z7.object({
363
- available: z7.boolean(),
364
- command: z7.string().optional(),
365
- error: z7.string().optional(),
366
- suggestions: z7.array(z7.string()).optional()
414
+ var AgentCliAvailabilitySchema = z8.object({
415
+ available: z8.boolean(),
416
+ command: z8.string().optional(),
417
+ error: z8.string().optional(),
418
+ suggestions: z8.array(z8.string()).optional()
367
419
  });
368
- var AgentCliStatusSchema = z7.object({
420
+ var AgentCliStatusSchema = z8.object({
369
421
  claude: AgentCliAvailabilitySchema,
370
422
  codex: AgentCliAvailabilitySchema
371
423
  });
372
- var DirEntrySchema = z7.object({ name: z7.string(), isDir: z7.boolean() });
373
- var FileTreeGroupSchema = z7.object({
374
- path: z7.string(),
375
- entries: z7.array(DirEntrySchema)
424
+ var DirEntrySchema = z8.object({ name: z8.string(), isDir: z8.boolean() });
425
+ var FileTreeGroupSchema = z8.object({
426
+ path: z8.string(),
427
+ entries: z8.array(DirEntrySchema)
376
428
  });
377
- var CommandEntrySchema = z7.object({
378
- name: z7.string(),
379
- description: z7.string(),
380
- argumentHint: z7.string().optional(),
381
- source: z7.string()
429
+ var CommandEntrySchema = z8.object({
430
+ name: z8.string(),
431
+ description: z8.string(),
432
+ argumentHint: z8.string().optional(),
433
+ source: z8.string()
382
434
  });
383
- var HistorySessionSchema = z7.object({
384
- id: z7.string(),
385
- title: z7.string(),
386
- projectDir: z7.string(),
387
- updatedAt: z7.number(),
388
- provider: z7.enum(providerValues).optional()
435
+ var HistorySessionSchema = z8.object({
436
+ id: z8.string(),
437
+ title: z8.string(),
438
+ projectDir: z8.string(),
439
+ updatedAt: z8.number(),
440
+ provider: z8.enum(providerValues).optional()
389
441
  });
390
- var SessionHistoryMessageSchema = z7.object({
391
- role: z7.enum(["user", "assistant"]),
392
- text: z7.string(),
393
- timestamp: z7.number().optional(),
394
- cursor: z7.string().optional()
442
+ var SessionHistoryMessageSchema = z8.object({
443
+ role: z8.enum(["user", "assistant"]),
444
+ text: z8.string(),
445
+ timestamp: z8.number().optional(),
446
+ cursor: z8.string().optional()
395
447
  });
396
448
  var RequestIdShape = { requestId: IdSchema.optional() };
397
- var ControlErrorCodeSchema = z7.enum(Object.values(ControlErrorCode));
449
+ var RequiredRequestIdShape = { requestId: IdSchema };
450
+ var ControlErrorCodeSchema = z8.enum(Object.values(ControlErrorCode));
398
451
  var RequestErrorShape = {
399
- error: z7.string().optional(),
452
+ error: z8.string().optional(),
400
453
  errorCode: ControlErrorCodeSchema.optional()
401
454
  };
402
- var ClipboardImageMimeTypeSchema = z7.enum(["image/png", "image/jpeg", "image/webp", "image/gif"]);
455
+ var ClipboardImageMimeTypeSchema = z8.enum(["image/png", "image/jpeg", "image/webp", "image/gif"]);
403
456
  function control(type, shape, directions) {
404
457
  return {
405
458
  type,
406
459
  directions: new Set(Array.isArray(directions) ? directions : directions ? [directions] : []),
407
- schema: z7.object({
408
- type: z7.literal(type),
460
+ schema: z8.object({
461
+ type: z8.literal(type),
409
462
  ...shape ?? {}
410
463
  })
411
464
  };
@@ -413,36 +466,99 @@ function control(type, shape, directions) {
413
466
  var relayControlDefinitions = [
414
467
  control("proxy_register", {
415
468
  proxyId: IdSchema,
416
- name: z7.string().optional()
469
+ name: z8.string().optional()
417
470
  }),
418
471
  control("proxy_register_response", {
419
- status: z7.enum(["new", "reconnected"])
472
+ status: z8.enum(["new", "reconnected"])
420
473
  }),
421
474
  control("proxy_list_request", RequestIdShape),
422
475
  control("proxy_list_response", {
423
476
  ...RequestIdShape,
424
- proxies: z7.array(ProxyInfoSchema)
477
+ proxies: z8.array(ProxyInfoSchema)
425
478
  }),
426
479
  control("proxy_select", { ...RequestIdShape, proxyId: IdSchema }),
427
480
  control("proxy_select_response", {
428
481
  ...RequestIdShape,
429
- success: z7.boolean(),
482
+ success: z8.boolean(),
430
483
  proxyId: IdSchema.optional(),
431
484
  ...RequestErrorShape
432
485
  }),
433
486
  control("relay_error", {
434
- code: z7.enum(Object.values(RelayErrorCode)),
435
- message: z7.string(),
487
+ code: z8.enum(Object.values(RelayErrorCode)),
488
+ message: z8.string(),
436
489
  // 可选 requestId: relay 把 client 发来 raw 的 requestId 字段透传回来,
437
490
  // client 侧 waitForMessage 据此把对应 pending request 立即拒掉而不必等到 timeout。
438
491
  requestId: IdSchema.optional()
439
492
  }),
493
+ // Voice Pilot config is relay-local: client reads/updates the relay's stored provider settings.
494
+ control("voice_config_request", RequestIdShape),
495
+ control("voice_config_response", {
496
+ ...RequestIdShape,
497
+ ...RequestErrorShape,
498
+ config: VoiceProviderConfigSchema.optional()
499
+ }),
500
+ control("voice_config_update", {
501
+ ...RequestIdShape,
502
+ config: VoiceConfigUpdateSchema
503
+ }),
504
+ control("voice_config_update_response", {
505
+ ...RequestIdShape,
506
+ ...RequestErrorShape,
507
+ success: z8.boolean(),
508
+ config: VoiceProviderConfigSchema.optional()
509
+ }),
510
+ control("voice_config_test", {
511
+ ...RequestIdShape,
512
+ config: VoiceConfigUpdateSchema.optional()
513
+ }),
514
+ control("voice_config_test_response", {
515
+ ...RequestIdShape,
516
+ ...RequestErrorShape,
517
+ success: z8.boolean(),
518
+ audioBase64: z8.string().optional(),
519
+ audioSampleRate: z8.number().int().positive().optional(),
520
+ audioEncoding: z8.literal("pcm_s16le").optional(),
521
+ transcript: z8.string().optional()
522
+ }),
523
+ control("voice_capabilities_request", {
524
+ ...RequestIdShape,
525
+ region: z8.enum(voiceRegionValues).optional()
526
+ }),
527
+ control("voice_capabilities_response", {
528
+ ...RequestIdShape,
529
+ ...RequestErrorShape,
530
+ capabilities: VoiceCapabilitiesSchema.optional()
531
+ }),
532
+ // Lightweight latency probes. These measure synthetic round-trip latency for the transport
533
+ // segments and intentionally stay separate from PTY input echo tracing.
534
+ control("latency_web_relay_ping", RequiredRequestIdShape),
535
+ control("latency_web_relay_pong", {
536
+ ...RequiredRequestIdShape,
537
+ relayNow: z8.number().optional()
538
+ }),
539
+ control("latency_relay_proxy_request", RequiredRequestIdShape),
540
+ control("latency_relay_proxy_response", {
541
+ ...RequiredRequestIdShape,
542
+ success: z8.boolean(),
543
+ rttMs: z8.number().nonnegative().optional(),
544
+ error: z8.string().optional()
545
+ }),
546
+ control("latency_relay_proxy_ping", {
547
+ ...RequiredRequestIdShape,
548
+ relayNow: z8.number().optional()
549
+ }),
550
+ control("latency_relay_proxy_pong", {
551
+ ...RequiredRequestIdShape,
552
+ proxyNow: z8.number().optional()
553
+ }),
554
+ control("latency_web_proxy_ping", RequiredRequestIdShape, "client_to_proxy"),
555
+ control("latency_web_proxy_pong", { ...RequiredRequestIdShape, proxyNow: z8.number().optional() }, "proxy_to_client"),
440
556
  // 客户端注册协议
441
557
  control("client_register", {
442
558
  clientId: IdSchema
443
559
  }),
444
560
  control("client_register_response", {
445
- status: z7.enum(["restored", "proxy_offline", "new"]),
561
+ status: z8.enum(["restored", "proxy_offline", "new"]),
446
562
  proxyId: IdSchema.optional()
447
563
  }),
448
564
  // Proxy 离线通知
@@ -461,51 +577,51 @@ var relayControlDefinitions = [
461
577
  control("dir_list_request", {
462
578
  proxyId: IdSchema.optional(),
463
579
  ...RequestIdShape,
464
- path: z7.string()
580
+ path: z8.string()
465
581
  }, "client_to_proxy"),
466
- control("dir_list_response", { ...RequestIdShape, ...RequestErrorShape, entries: z7.array(DirEntrySchema), path: z7.string() }, "proxy_to_client"),
582
+ control("dir_list_response", { ...RequestIdShape, ...RequestErrorShape, entries: z8.array(DirEntrySchema), path: z8.string() }, "proxy_to_client"),
467
583
  // 目录创建请求与响应
468
- control("dir_create_request", { ...RequestIdShape, path: z7.string() }, "client_to_proxy"),
584
+ control("dir_create_request", { ...RequestIdShape, path: z8.string() }, "client_to_proxy"),
469
585
  control("dir_create_response", {
470
586
  ...RequestIdShape,
471
587
  ...RequestErrorShape,
472
- path: z7.string(),
473
- success: z7.boolean()
588
+ path: z8.string(),
589
+ success: z8.boolean()
474
590
  }, "proxy_to_client"),
475
591
  // 命令列表推送,proxy 将可用命令列表推给 client
476
- control("command_list_push", { commands: z7.array(CommandEntrySchema) }, "proxy_to_client"),
592
+ control("command_list_push", { commands: z8.array(CommandEntrySchema) }, "proxy_to_client"),
477
593
  // 文件树推送: 按目录分组, 首组 path 即为 session cwd
478
594
  // 前端直接把每组写入 tree[path], 与 dir_list_response 共享 cache slot
479
595
  control("file_tree_push", {
480
- groups: z7.array(FileTreeGroupSchema)
596
+ groups: z8.array(FileTreeGroupSchema)
481
597
  }, "proxy_to_client"),
482
598
  // 会话列表请求与权限模式变更
483
599
  control("session_list", void 0, ["client_to_proxy", "proxy_to_client"]),
484
600
  control("permission_mode_change", {
485
- mode: z7.enum(["default", "auto_accept", "plan"]),
601
+ mode: z8.enum(["default", "auto_accept", "plan"]),
486
602
  // sessionId 可选:传入时 proxy 按该会话的 mode 分叉(PTY 发 Tab ANSI),未传走全局日志行为
487
603
  sessionId: IdSchema.optional()
488
604
  }, "client_to_proxy"),
489
605
  // 会话历史浏览
490
606
  control("session_history_request", RequestIdShape, "client_to_proxy"),
491
- control("session_history_response", { ...RequestIdShape, sessions: z7.array(HistorySessionSchema) }, "proxy_to_client"),
607
+ control("session_history_response", { ...RequestIdShape, sessions: z8.array(HistorySessionSchema) }, "proxy_to_client"),
492
608
  // PTY 语义状态,从 Envelope 迁移到 Control 层
493
609
  control("pty_state", { sessionId: IdSchema, payload: PtyStatePayloadSchema }, "proxy_to_client"),
494
610
  // Provider 语义状态,来自 Claude/Codex hook 等结构化事件,不从 PTY 字节推断
495
611
  control("agent_status", { sessionId: IdSchema, payload: AgentStatusPayloadSchema }, "proxy_to_client"),
496
612
  // 终端标题变化,proxy -> client
497
- control("terminal_title", { sessionId: IdSchema, title: z7.string() }, "proxy_to_client"),
613
+ control("terminal_title", { sessionId: IdSchema, title: z8.string() }, "proxy_to_client"),
498
614
  // 终端尺寸变化,proxy -> client
499
- control("terminal_resize", { sessionId: IdSchema, cols: z7.number().int().positive(), rows: z7.number().int().positive() }, "proxy_to_client"),
500
- control("terminal_resize_request", { sessionId: IdSchema, cols: z7.number().int().positive(), rows: z7.number().int().positive() }, "client_to_proxy"),
615
+ control("terminal_resize", { sessionId: IdSchema, cols: z8.number().int().positive(), rows: z8.number().int().positive() }, "proxy_to_client"),
616
+ control("terminal_resize_request", { sessionId: IdSchema, cols: z8.number().int().positive(), rows: z8.number().int().positive() }, "client_to_proxy"),
501
617
  // 远程终止 JSON 会话,client -> proxy
502
618
  control("session_terminate", { sessionId: IdSchema }, "client_to_proxy"),
503
- control("session_rename", { ...RequestIdShape, sessionId: IdSchema, name: z7.string() }, "client_to_proxy"),
619
+ control("session_rename", { ...RequestIdShape, sessionId: IdSchema, name: z8.string() }, "client_to_proxy"),
504
620
  control("session_rename_response", {
505
621
  ...RequestIdShape,
506
622
  sessionId: IdSchema,
507
- success: z7.boolean(),
508
- name: z7.string().optional(),
623
+ success: z8.boolean(),
624
+ name: z8.string().optional(),
509
625
  ...RequestErrorShape
510
626
  }, "proxy_to_client"),
511
627
  // 中断当前 turn,client -> proxy,SIGINT 到 worker 进程让 claude CLI abort 当前流
@@ -513,114 +629,117 @@ var relayControlDefinitions = [
513
629
  // turn 完成信号,proxy -> client,对应 claude stream-json 的 result 事件
514
630
  control("turn_result", {
515
631
  sessionId: IdSchema,
516
- success: z7.boolean(),
517
- isError: z7.boolean(),
632
+ success: z8.boolean(),
633
+ isError: z8.boolean(),
518
634
  // stream-json result.result 是本轮最终文本。assistant_message 流丢失或 CLI 未发增量时,
519
635
  // Web 用它作为 JSON 模式兜底展示,避免 turn 已结束但界面空白。
520
- result: z7.string().optional()
636
+ result: z8.string().optional()
521
637
  }, "proxy_to_client"),
522
638
  // 客户端发送到 PTY 的原始字节(ANSI 序列),不追加换行
523
- control("remote_input_raw", { sessionId: IdSchema, data: z7.string() }, "client_to_proxy"),
639
+ control("remote_input_raw", { sessionId: IdSchema, data: z8.string(), traceId: IdSchema.optional() }, "client_to_proxy"),
524
640
  control("clipboard_image_upload", {
525
641
  ...RequestIdShape,
526
642
  sessionId: IdSchema,
527
643
  mimeType: ClipboardImageMimeTypeSchema,
528
- dataBase64: z7.string().min(1),
529
- fileName: z7.string().optional()
644
+ dataBase64: z8.string().min(1),
645
+ fileName: z8.string().optional()
530
646
  }, "client_to_proxy"),
531
647
  control("clipboard_image_upload_response", {
532
648
  ...RequestIdShape,
533
649
  ...RequestErrorShape,
534
650
  sessionId: IdSchema,
535
- success: z7.boolean(),
651
+ success: z8.boolean(),
536
652
  // success=false 时 proxy 没有有效 path 可填;保持 optional 以避免占位空字符串通过校验。
537
- path: z7.string().optional()
653
+ path: z8.string().optional()
538
654
  }, "proxy_to_client"),
539
655
  control("image_preview_request", {
540
656
  ...RequestIdShape,
541
657
  sessionId: IdSchema,
542
- path: z7.string().min(1)
658
+ path: z8.string().min(1)
543
659
  }, "client_to_proxy"),
544
660
  control("image_preview_response", {
545
661
  ...RequestIdShape,
546
662
  ...RequestErrorShape,
547
663
  sessionId: IdSchema,
548
- success: z7.boolean(),
664
+ success: z8.boolean(),
549
665
  // 同 clipboard_image_upload_response:失败时 proxy 不一定有路径。
550
- path: z7.string().optional(),
666
+ path: z8.string().optional(),
551
667
  mimeType: ClipboardImageMimeTypeSchema.optional(),
552
- dataBase64: z7.string().optional(),
553
- size: z7.number().int().nonnegative().optional()
668
+ dataBase64: z8.string().optional(),
669
+ size: z8.number().int().nonnegative().optional()
554
670
  }, "proxy_to_client"),
555
671
  // 任意文件下载: 与 image_preview 形状对称, 只是 mimeType 不限定为图片;
556
672
  // 单租户场景下 path 任意 (不受 previewRoots 限制), 由 proxy 端 size cap 兜底。
557
673
  control("file_download_request", {
558
674
  ...RequestIdShape,
559
675
  sessionId: IdSchema,
560
- path: z7.string().min(1)
676
+ path: z8.string().min(1)
561
677
  }, "client_to_proxy"),
562
678
  control("file_download_response", {
563
679
  ...RequestIdShape,
564
680
  ...RequestErrorShape,
565
681
  sessionId: IdSchema,
566
- success: z7.boolean(),
567
- path: z7.string().optional(),
568
- mimeType: z7.string().optional(),
569
- dataBase64: z7.string().optional(),
570
- size: z7.number().int().nonnegative().optional()
682
+ success: z8.boolean(),
683
+ path: z8.string().optional(),
684
+ mimeType: z8.string().optional(),
685
+ dataBase64: z8.string().optional(),
686
+ size: z8.number().int().nonnegative().optional()
571
687
  }, "proxy_to_client"),
572
688
  // 任意文件上传: 复用 clipboard_image_upload 的形状, mimeType 放开 + fileName 必填,
573
689
  // 由 proxy 端写入 session cwd 的 .dev-anywhere/uploads/ 子目录, 返回相对路径供 web 拼成 @path。
574
690
  control("file_upload_request", {
575
691
  ...RequestIdShape,
576
692
  sessionId: IdSchema,
577
- mimeType: z7.string().min(1),
578
- dataBase64: z7.string().min(1),
579
- fileName: z7.string().min(1)
693
+ mimeType: z8.string().min(1),
694
+ dataBase64: z8.string().min(1),
695
+ fileName: z8.string().min(1)
580
696
  }, "client_to_proxy"),
581
697
  control("file_upload_response", {
582
698
  ...RequestIdShape,
583
699
  ...RequestErrorShape,
584
700
  sessionId: IdSchema,
585
- success: z7.boolean(),
586
- path: z7.string().optional()
701
+ success: z8.boolean(),
702
+ path: z8.string().optional()
587
703
  }, "proxy_to_client"),
588
704
  // 客户端询问 proxy 的环境信息 (home 路径等), client -> proxy -> response
589
705
  // FilePathPicker 用 homePath 作为 select 模式下的默认起点, 新建会话时打开即可浏览
590
706
  control("proxy_info_request", RequestIdShape, "client_to_proxy"),
591
- control("proxy_info", { ...RequestIdShape, homePath: z7.string(), agentCli: AgentCliStatusSchema }, "proxy_to_client"),
592
- control("agent_cli_config_update", { ...RequestIdShape, provider: z7.enum(providerValues), path: z7.string().min(1) }, "client_to_proxy"),
707
+ control("proxy_info", { ...RequestIdShape, homePath: z8.string(), agentCli: AgentCliStatusSchema }, "proxy_to_client"),
708
+ control("agent_cli_config_update", { ...RequestIdShape, provider: z8.enum(providerValues), path: z8.string().min(1) }, "client_to_proxy"),
593
709
  control("agent_cli_config_update_response", {
594
710
  ...RequestIdShape,
595
- provider: z7.enum(providerValues),
711
+ provider: z8.enum(providerValues),
596
712
  agentCli: AgentCliStatusSchema.optional(),
597
713
  ...RequestErrorShape
598
714
  }, "proxy_to_client"),
599
715
  // 远程创建 JSON 会话,client -> proxy -> response
600
716
  control("session_create", {
601
717
  ...RequestIdShape,
602
- cwd: z7.string(),
603
- provider: z7.enum(providerValues),
604
- mode: z7.enum(sessionModeValues).optional(),
605
- resumeSessionId: z7.string().optional(),
718
+ cwd: z8.string(),
719
+ name: z8.string().optional(),
720
+ provider: z8.enum(providerValues),
721
+ mode: z8.enum(sessionModeValues).optional(),
722
+ resumeSessionId: z8.string().optional(),
606
723
  // 透传给 claude CLI 的 --permission-mode, undefined 时 proxy 兜底为 "default"
607
- permissionMode: z7.enum(["default", "auto", "acceptEdits", "plan", "bypassPermissions", "dontAsk"]).optional()
724
+ permissionMode: z8.enum(["default", "auto", "acceptEdits", "plan", "bypassPermissions", "dontAsk"]).optional()
608
725
  }, "client_to_proxy"),
609
726
  control("session_create_response", {
610
727
  ...RequestIdShape,
611
728
  // 失败路径只送 errorCode/error, sessionId 此时无语义。成功路径才有 id。
612
729
  sessionId: IdSchema.optional(),
613
- mode: z7.enum(sessionModeValues).optional(),
614
- provider: z7.enum(providerValues).optional(),
615
- ptyOwner: z7.enum(ptyOwnerValues).optional(),
730
+ name: z8.string().optional(),
731
+ nameLocked: z8.boolean().optional(),
732
+ mode: z8.enum(sessionModeValues).optional(),
733
+ provider: z8.enum(providerValues).optional(),
734
+ ptyOwner: z8.enum(ptyOwnerValues).optional(),
616
735
  ...RequestErrorShape
617
736
  }, "proxy_to_client"),
618
737
  // 客户端请求会话历史消息,client -> proxy
619
738
  control("session_messages_request", {
620
739
  ...RequestIdShape,
621
740
  sessionId: IdSchema,
622
- limit: z7.number().int().min(1).max(200).optional(),
623
- before: z7.string().optional()
741
+ limit: z8.number().int().min(1).max(200).optional(),
742
+ before: z8.string().optional()
624
743
  }, "client_to_proxy"),
625
744
  // 客户端请求会话资源(命令列表 + 文件树),client -> proxy
626
745
  control("session_resources_request", { ...RequestIdShape, sessionId: IdSchema }, "client_to_proxy"),
@@ -628,14 +747,14 @@ var relayControlDefinitions = [
628
747
  ...RequestIdShape,
629
748
  ...RequestErrorShape,
630
749
  sessionId: IdSchema,
631
- commands: z7.array(CommandEntrySchema),
632
- groups: z7.array(FileTreeGroupSchema)
750
+ commands: z8.array(CommandEntrySchema),
751
+ groups: z8.array(FileTreeGroupSchema)
633
752
  }, "proxy_to_client"),
634
753
  // 客户端请求当前 provider 语义状态;不经 relay 缓存,由 proxy 返回当前值
635
754
  control("agent_status_request", { ...RequestIdShape, sessionId: IdSchema.optional() }, "client_to_proxy"),
636
755
  control("agent_status_response", {
637
756
  ...RequestIdShape,
638
- statuses: z7.array(z7.object({ sessionId: IdSchema, payload: AgentStatusPayloadSchema }))
757
+ statuses: z8.array(z8.object({ sessionId: IdSchema, payload: AgentStatusPayloadSchema }))
639
758
  }, "proxy_to_client"),
640
759
  // 客户端确认已收到审批请求;proxy 只记录送达状态,不把它当成用户决策
641
760
  control("permission_request_delivered", { sessionId: IdSchema, requestId: IdSchema }, "client_to_proxy"),
@@ -645,40 +764,56 @@ var relayControlDefinitions = [
645
764
  control("permission_decision_result", {
646
765
  sessionId: IdSchema,
647
766
  requestId: IdSchema,
648
- outcome: z7.enum(["allow", "deny"]),
649
- delivered: z7.boolean(),
650
- message: z7.string().optional()
767
+ outcome: z8.enum(["allow", "deny"]),
768
+ delivered: z8.boolean(),
769
+ message: z8.string().optional()
651
770
  }, "proxy_to_client"),
652
771
  // proxy 推送当前 pending 的工具审批列表,client 据此恢复审批卡片
653
772
  control("pending_approvals_push", {
654
773
  sessionId: IdSchema,
655
- approvals: z7.array(z7.object({
774
+ approvals: z8.array(z8.object({
656
775
  requestId: IdSchema,
657
- toolName: z7.string(),
658
- input: z7.record(z7.string(), z7.unknown())
776
+ toolName: z8.string(),
777
+ input: z8.record(z8.string(), z8.unknown())
659
778
  }))
660
779
  }, "proxy_to_client"),
780
+ // Voice Pilot speech summaries are produced by proxy-side Claude Code so it can read project context.
781
+ control("voice_summary_request", {
782
+ ...RequestIdShape,
783
+ sessionId: IdSchema,
784
+ messageId: IdSchema,
785
+ text: z8.string().min(1),
786
+ reason: VoiceSummaryReasonSchema
787
+ }, "client_to_proxy"),
788
+ control("voice_summary_response", {
789
+ ...RequestIdShape,
790
+ ...RequestErrorShape,
791
+ sessionId: IdSchema,
792
+ messageId: IdSchema,
793
+ success: z8.boolean(),
794
+ summary: z8.string().min(1).optional()
795
+ }, "proxy_to_client"),
661
796
  // 恢复会话时推送历史消息,proxy -> client
662
797
  control("session_history_messages", {
663
798
  ...RequestIdShape,
664
799
  sessionId: IdSchema,
665
- before: z7.string().optional(),
666
- messages: z7.array(SessionHistoryMessageSchema),
667
- hasMore: z7.boolean().optional(),
668
- nextBefore: z7.string().optional()
800
+ before: z8.string().optional(),
801
+ messages: z8.array(SessionHistoryMessageSchema),
802
+ hasMore: z8.boolean().optional(),
803
+ nextBefore: z8.string().optional()
669
804
  }, "proxy_to_client"),
670
805
  // proxy 重连后同步活跃 session 列表给 relay。session_sync 由 relay 自消费(更新 proxy-session
671
806
  // 关联)不转发给 client,因此**没有** direction 标注——RelayControlDirection 只描述转发流。
672
807
  control("session_sync", {
673
- sessions: z7.array(z7.object({
674
- id: z7.string(),
675
- mode: z7.enum(sessionModeValues),
676
- provider: z7.enum(providerValues),
677
- ptyOwner: z7.enum(ptyOwnerValues).optional(),
678
- cwd: z7.string().optional(),
679
- name: z7.string().optional(),
680
- nameLocked: z7.boolean().optional(),
681
- state: z7.enum(sessionStateValues)
808
+ sessions: z8.array(z8.object({
809
+ id: z8.string(),
810
+ mode: z8.enum(sessionModeValues),
811
+ provider: z8.enum(providerValues),
812
+ ptyOwner: z8.enum(ptyOwnerValues).optional(),
813
+ cwd: z8.string().optional(),
814
+ name: z8.string().optional(),
815
+ nameLocked: z8.boolean().optional(),
816
+ state: z8.enum(sessionStateValues)
682
817
  }))
683
818
  }),
684
819
  // PTY 会话订阅,client -> proxy,触发 terminal serialize() 返回当前状态
@@ -686,15 +821,15 @@ var relayControlDefinitions = [
686
821
  // PTY 会话快照,proxy -> client,serialize() 的全量终端状态
687
822
  control("session_snapshot", {
688
823
  sessionId: IdSchema,
689
- cols: z7.number().int().positive(),
690
- rows: z7.number().int().positive(),
691
- data: z7.string(),
692
- outputSeq: z7.number().int().nonnegative(),
824
+ cols: z8.number().int().positive(),
825
+ rows: z8.number().int().positive(),
826
+ data: z8.string(),
827
+ outputSeq: z8.number().int().nonnegative(),
693
828
  requestId: IdSchema.optional()
694
829
  }, "proxy_to_client")
695
830
  ];
696
831
  var relayControlSchemas = relayControlDefinitions.map((definition) => definition.schema);
697
- var RelayControlSchema = z7.discriminatedUnion("type", relayControlSchemas);
832
+ var RelayControlSchema = z8.discriminatedUnion("type", relayControlSchemas);
698
833
  var ProxyToClientRelayControlTypes = new Set(relayControlDefinitions.filter((definition) => definition.directions.has("proxy_to_client")).map((definition) => definition.type));
699
834
  var ClientToProxyRelayControlTypes = new Set(relayControlDefinitions.filter((definition) => definition.directions.has("client_to_proxy")).map((definition) => definition.type));
700
835
 
@@ -743,7 +878,7 @@ function decodeBinaryFrame(view) {
743
878
  }
744
879
 
745
880
  // src/ipc/ipc-protocol.ts
746
- import { z as z8 } from "zod";
881
+ import { z as z9 } from "zod";
747
882
 
748
883
  // src/ipc/line-buffer.ts
749
884
  import { Transform } from "stream";
@@ -784,203 +919,204 @@ function encodeBinaryIpcFrame(sessionId, data, outputSeq) {
784
919
  return frame;
785
920
  }
786
921
  var sessionStateValues2 = Object.values(SessionState);
787
- var ProviderHookContextSchema = z8.object({
788
- provider: z8.enum(["claude", "codex"]),
789
- sessionId: z8.string(),
790
- hookUrl: z8.string(),
791
- marker: z8.string(),
792
- token: z8.string()
922
+ var ProviderHookContextSchema = z9.object({
923
+ provider: z9.enum(["claude", "codex"]),
924
+ sessionId: z9.string(),
925
+ hookUrl: z9.string(),
926
+ marker: z9.string(),
927
+ token: z9.string()
793
928
  });
794
- var IpcMessageSchema = z8.discriminatedUnion("type", [
929
+ var IpcMessageSchema = z9.discriminatedUnion("type", [
795
930
  // 客户端请求创建新会话,sessionId 可选用于重连时复用
796
- z8.object({
797
- type: z8.literal("session_create_request"),
798
- name: z8.string().optional(),
799
- mode: z8.enum(["pty", "json"]),
800
- provider: z8.enum(["claude", "codex"]),
801
- cwd: z8.string(),
802
- pid: z8.number(),
803
- sessionId: z8.string().optional()
931
+ z9.object({
932
+ type: z9.literal("session_create_request"),
933
+ name: z9.string().optional(),
934
+ mode: z9.enum(["pty", "json"]),
935
+ provider: z9.enum(["claude", "codex"]),
936
+ cwd: z9.string(),
937
+ pid: z9.number(),
938
+ sessionId: z9.string().optional()
804
939
  }),
805
940
  // 服务端响应创建会话
806
- z8.object({
807
- type: z8.literal("session_create_response"),
808
- sessionId: z8.string(),
809
- error: z8.string().optional(),
941
+ z9.object({
942
+ type: z9.literal("session_create_response"),
943
+ sessionId: z9.string(),
944
+ error: z9.string().optional(),
810
945
  hook: ProviderHookContextSchema.optional()
811
946
  }),
812
947
  // 客户端请求终止会话
813
- z8.object({
814
- type: z8.literal("session_terminate_request"),
815
- sessionId: z8.string()
948
+ z9.object({
949
+ type: z9.literal("session_terminate_request"),
950
+ sessionId: z9.string()
816
951
  }),
817
952
  // 服务端响应终止会话
818
- z8.object({
819
- type: z8.literal("session_terminate_response"),
820
- sessionId: z8.string(),
821
- success: z8.boolean()
953
+ z9.object({
954
+ type: z9.literal("session_terminate_response"),
955
+ sessionId: z9.string(),
956
+ success: z9.boolean()
822
957
  }),
823
958
  // 客户端向服务端注册 PTY 会话
824
- z8.object({
825
- type: z8.literal("pty_register"),
826
- sessionId: z8.string(),
827
- pid: z8.number()
959
+ z9.object({
960
+ type: z9.literal("pty_register"),
961
+ sessionId: z9.string(),
962
+ pid: z9.number()
828
963
  }),
829
964
  // 客户端取消注册 PTY 会话
830
- z8.object({
831
- type: z8.literal("pty_deregister"),
832
- sessionId: z8.string()
965
+ z9.object({
966
+ type: z9.literal("pty_deregister"),
967
+ sessionId: z9.string()
833
968
  }),
834
969
  // 输入,从服务端转发到客户端的 PTY stdin(手机远程输入注入)
835
- z8.object({
836
- type: z8.literal("pty_input"),
837
- sessionId: z8.string(),
838
- data: z8.string()
970
+ z9.object({
971
+ type: z9.literal("pty_input"),
972
+ sessionId: z9.string(),
973
+ data: z9.string(),
974
+ traceId: z9.string().optional()
839
975
  }),
840
976
  // serve → terminal:Web 端移除本地终端会话时,只断开远程视图,不杀本地 CLI。
841
- z8.object({
842
- type: z8.literal("pty_detach"),
843
- sessionId: z8.string()
977
+ z9.object({
978
+ type: z9.literal("pty_detach"),
979
+ sessionId: z9.string()
844
980
  }),
845
981
  // 服务端广播会话状态变更
846
- z8.object({
847
- type: z8.literal("session_status_update"),
848
- sessionId: z8.string(),
849
- state: z8.enum(sessionStateValues2)
982
+ z9.object({
983
+ type: z9.literal("session_status_update"),
984
+ sessionId: z9.string(),
985
+ state: z9.enum(sessionStateValues2)
850
986
  }),
851
987
  // 错误响应
852
- z8.object({
853
- type: z8.literal("error"),
854
- message: z8.string(),
855
- code: z8.string().optional()
988
+ z9.object({
989
+ type: z9.literal("error"),
990
+ message: z9.string(),
991
+ code: z9.string().optional()
856
992
  }),
857
993
  // 客户端请求服务状态(含 relay 连接信息和 worker 状态)
858
- z8.object({
859
- type: z8.literal("service_status_request")
994
+ z9.object({
995
+ type: z9.literal("service_status_request")
860
996
  }),
861
997
  // 服务端响应增强版服务状态
862
- z8.object({
863
- type: z8.literal("service_status_response"),
864
- config: z8.object({
865
- profile: z8.string().optional(),
866
- relayName: z8.string(),
867
- relayNameSource: z8.enum(["cli", "profile"]),
868
- relayUrl: z8.string().optional(),
869
- relayUrlSource: z8.enum(["env", "file", "none"]),
870
- relayTokenSource: z8.enum(["env", "file", "none"]),
871
- hookPort: z8.number(),
872
- hookPortSource: z8.enum(["env", "file", "default"])
998
+ z9.object({
999
+ type: z9.literal("service_status_response"),
1000
+ config: z9.object({
1001
+ profile: z9.string().optional(),
1002
+ relayName: z9.string(),
1003
+ relayNameSource: z9.enum(["cli", "profile"]),
1004
+ relayUrl: z9.string().optional(),
1005
+ relayUrlSource: z9.enum(["env", "file", "none"]),
1006
+ relayTokenSource: z9.enum(["env", "file", "none"]),
1007
+ hookPort: z9.number(),
1008
+ hookPortSource: z9.enum(["env", "file", "default"])
873
1009
  }),
874
- relay: z8.object({
875
- connected: z8.boolean(),
876
- proxyId: z8.string(),
877
- reconnectAttempt: z8.number(),
878
- queueDepth: z8.number()
1010
+ relay: z9.object({
1011
+ connected: z9.boolean(),
1012
+ proxyId: z9.string(),
1013
+ reconnectAttempt: z9.number(),
1014
+ queueDepth: z9.number()
879
1015
  }).nullable(),
880
- sessions: z8.array(
881
- z8.object({
882
- id: z8.string(),
883
- mode: z8.enum(["pty", "json"]),
884
- state: z8.enum(sessionStateValues2),
885
- createdAt: z8.string(),
886
- name: z8.string().optional(),
887
- hasWorker: z8.boolean()
1016
+ sessions: z9.array(
1017
+ z9.object({
1018
+ id: z9.string(),
1019
+ mode: z9.enum(["pty", "json"]),
1020
+ state: z9.enum(sessionStateValues2),
1021
+ createdAt: z9.string(),
1022
+ name: z9.string().optional(),
1023
+ hasWorker: z9.boolean()
888
1024
  })
889
1025
  )
890
1026
  }),
891
1027
  // terminal → serve:终端标题变化,由 xterm onTitleChange 触发
892
- z8.object({
893
- type: z8.literal("pty_title_change"),
894
- sessionId: z8.string(),
895
- title: z8.string()
1028
+ z9.object({
1029
+ type: z9.literal("pty_title_change"),
1030
+ sessionId: z9.string(),
1031
+ title: z9.string()
896
1032
  }),
897
1033
  // terminal → serve:local runtime 观察到的 PTY 语义事件。
898
- z8.object({
899
- type: z8.literal("pty_semantic_event"),
900
- sessionId: z8.string(),
901
- state: z8.enum(ptySemanticStateValues),
902
- title: z8.string().optional(),
903
- tool: z8.string().optional()
1034
+ z9.object({
1035
+ type: z9.literal("pty_semantic_event"),
1036
+ sessionId: z9.string(),
1037
+ state: z9.enum(ptySemanticStateValues),
1038
+ title: z9.string().optional(),
1039
+ tool: z9.string().optional()
904
1040
  }),
905
1041
  // terminal → serve:终端尺寸变化
906
- z8.object({
907
- type: z8.literal("pty_resize"),
908
- sessionId: z8.string(),
909
- cols: z8.number(),
910
- rows: z8.number()
1042
+ z9.object({
1043
+ type: z9.literal("pty_resize"),
1044
+ sessionId: z9.string(),
1045
+ cols: z9.number(),
1046
+ rows: z9.number()
911
1047
  }),
912
1048
  // serve → terminal:请求 HeadlessTerminal serialize() 快照
913
- z8.object({
914
- type: z8.literal("pty_subscribe"),
915
- sessionId: z8.string(),
916
- requestId: z8.string().optional()
1049
+ z9.object({
1050
+ type: z9.literal("pty_subscribe"),
1051
+ sessionId: z9.string(),
1052
+ requestId: z9.string().optional()
917
1053
  }),
918
1054
  // terminal → serve:serialize() 结果
919
- z8.object({
920
- type: z8.literal("pty_snapshot"),
921
- sessionId: z8.string(),
922
- cols: z8.number(),
923
- rows: z8.number(),
924
- data: z8.string(),
925
- outputSeq: z8.number().int().nonnegative(),
926
- requestId: z8.string().optional()
1055
+ z9.object({
1056
+ type: z9.literal("pty_snapshot"),
1057
+ sessionId: z9.string(),
1058
+ cols: z9.number(),
1059
+ rows: z9.number(),
1060
+ data: z9.string(),
1061
+ outputSeq: z9.number().int().nonnegative(),
1062
+ requestId: z9.string().optional()
927
1063
  }),
928
1064
  // serve → terminal:relay 连接状态变更,供终端给用户显示 remote viewing 是否通畅
929
- z8.object({
930
- type: z8.literal("bridge_status"),
931
- connected: z8.boolean()
1065
+ z9.object({
1066
+ type: z9.literal("bridge_status"),
1067
+ connected: z9.boolean()
932
1068
  })
933
1069
  ]);
934
- var WorkerMessageSchema = z8.discriminatedUnion("type", [
1070
+ var WorkerMessageSchema = z9.discriminatedUnion("type", [
935
1071
  // serve → worker: 发送用户输入给 claude
936
- z8.object({
937
- type: z8.literal("worker_input"),
938
- content: z8.string()
1072
+ z9.object({
1073
+ type: z9.literal("worker_input"),
1074
+ content: z9.string()
939
1075
  }),
940
1076
  // serve → worker: 停止 claude 进程
941
- z8.object({
942
- type: z8.literal("worker_stop")
1077
+ z9.object({
1078
+ type: z9.literal("worker_stop")
943
1079
  }),
944
1080
  // serve → worker: 工具审批响应
945
- z8.object({
946
- type: z8.literal("worker_approval_response"),
947
- requestId: z8.string(),
948
- behavior: z8.enum(["allow", "deny"]),
949
- message: z8.string().optional()
1081
+ z9.object({
1082
+ type: z9.literal("worker_approval_response"),
1083
+ requestId: z9.string(),
1084
+ behavior: z9.enum(["allow", "deny"]),
1085
+ message: z9.string().optional()
950
1086
  }),
951
1087
  // worker → serve: claude 输出事件(带序列号)
952
- z8.object({
953
- type: z8.literal("worker_event"),
954
- seq: z8.number(),
955
- event: z8.record(z8.string(), z8.unknown())
1088
+ z9.object({
1089
+ type: z9.literal("worker_event"),
1090
+ seq: z9.number(),
1091
+ event: z9.record(z9.string(), z9.unknown())
956
1092
  }),
957
1093
  // worker → serve: claude 进程退出
958
- z8.object({
959
- type: z8.literal("worker_exit"),
960
- code: z8.number()
1094
+ z9.object({
1095
+ type: z9.literal("worker_exit"),
1096
+ code: z9.number()
961
1097
  }),
962
1098
  // worker → serve: 工具审批请求
963
- z8.object({
964
- type: z8.literal("worker_approval_request"),
965
- requestId: z8.string(),
966
- toolName: z8.string(),
967
- input: z8.record(z8.string(), z8.unknown())
1099
+ z9.object({
1100
+ type: z9.literal("worker_approval_request"),
1101
+ requestId: z9.string(),
1102
+ toolName: z9.string(),
1103
+ input: z9.record(z9.string(), z9.unknown())
968
1104
  }),
969
1105
  // worker → serve: worker 就绪,claude 已启动
970
- z8.object({
971
- type: z8.literal("worker_ready"),
972
- pid: z8.number()
1106
+ z9.object({
1107
+ type: z9.literal("worker_ready"),
1108
+ pid: z9.number()
973
1109
  }),
974
1110
  // worker → serve: 从 stream-json 的 system.init 事件捕获 Claude CLI 侧的 session ID
975
1111
  // proxy 拿它来读 ~/.claude/projects/.../<id>.jsonl 历史或后续 --resume
976
- z8.object({
977
- type: z8.literal("worker_claude_session_id"),
978
- sessionId: z8.string()
1112
+ z9.object({
1113
+ type: z9.literal("worker_claude_session_id"),
1114
+ sessionId: z9.string()
979
1115
  }),
980
1116
  // serve → worker: 将指定工具加入会话白名单,后续同名工具自动审批
981
- z8.object({
982
- type: z8.literal("worker_whitelist_add"),
983
- toolName: z8.string()
1117
+ z9.object({
1118
+ type: z9.literal("worker_whitelist_add"),
1119
+ toolName: z9.string()
984
1120
  })
985
1121
  ]);
986
1122
  function serializeWorkerMsg(msg) {
@@ -1080,4 +1216,4 @@ export {
1080
1216
  serializeIpc,
1081
1217
  createIpcReader
1082
1218
  };
1083
- //# sourceMappingURL=chunk-JYPJ7PQ3.js.map
1219
+ //# sourceMappingURL=chunk-IWWADGYM.js.map