@dev-anywhere/proxy 0.3.13 → 0.4.2

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