@ensocode/server 0.3.12 → 0.3.13

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.
Files changed (222) hide show
  1. package/out/phone/assets/EditDiff-B3HxLrbF.js +28 -0
  2. package/out/phone/assets/ReadFileView-BFpGH-kK.js +7 -0
  3. package/out/phone/assets/{abnfDiagram-VCTEODGH-D-9apHOZ.js → abnfDiagram-VCTEODGH-BNvyPGoF.js} +1 -1
  4. package/out/phone/assets/architecture-7GRP2DOG-Duql1LsL.js +1 -0
  5. package/out/phone/assets/{architectureDiagram-5GKGNRK7-B7ti5Yuy.js → architectureDiagram-5GKGNRK7-1bhpTEFA.js} +1 -1
  6. package/out/phone/assets/{blockDiagram-I7D4REHJ-CMg6PHJB.js → blockDiagram-I7D4REHJ-Bo9UMudu.js} +1 -1
  7. package/out/phone/assets/{c4Diagram-7LVT6UL2-YtDbC01g.js → c4Diagram-7LVT6UL2-YS11cig2.js} +1 -1
  8. package/out/phone/assets/channel-BPoIHov1.js +1 -0
  9. package/out/phone/assets/{chunk-4HAMMTFA-Djg6ctlZ.js → chunk-4HAMMTFA-gA-CzNGD.js} +1 -1
  10. package/out/phone/assets/{chunk-75Z2AOVW-Be2kq0FP.js → chunk-75Z2AOVW-BL_5b1Dw.js} +1 -1
  11. package/out/phone/assets/{chunk-DU6HZSFF-d5JZiOMy.js → chunk-DU6HZSFF-BpNlAs9R.js} +1 -1
  12. package/out/phone/assets/{chunk-F27PBJKO-DHBQ6nrV.js → chunk-F27PBJKO-lsKx96Nt.js} +1 -1
  13. package/out/phone/assets/{chunk-GMAD6QVW-BatU6uXC.js → chunk-GMAD6QVW-CxbljbtE.js} +1 -1
  14. package/out/phone/assets/{chunk-GVQU2GXP-CiyvoRIy.js → chunk-GVQU2GXP-CTO3kTOF.js} +1 -1
  15. package/out/phone/assets/{chunk-IMKFNOWR-vOQaK90i.js → chunk-IMKFNOWR-Cq8XlkcB.js} +1 -1
  16. package/out/phone/assets/{chunk-L3NEJ4N5-CPykFzBy.js → chunk-L3NEJ4N5-CvIm0JX7.js} +1 -1
  17. package/out/phone/assets/{chunk-OSK3NFVY-q4NiGH59.js → chunk-OSK3NFVY-Cj3ilTL-.js} +1 -1
  18. package/out/phone/assets/{chunk-P2QGCYS3-DUV9S_qP.js → chunk-P2QGCYS3-B-twI_Fz.js} +1 -1
  19. package/out/phone/assets/{chunk-POPQ4Y6H-CjycswNE.js → chunk-POPQ4Y6H-lPQttJ5s.js} +1 -1
  20. package/out/phone/assets/{chunk-PWAF6VOD-Dben6plA.js → chunk-PWAF6VOD-DjwqZuIR.js} +1 -1
  21. package/out/phone/assets/{chunk-SHT3W25Y-D2hK_jmb.js → chunk-SHT3W25Y-BWRVin1H.js} +1 -1
  22. package/out/phone/assets/{chunk-SVP7TREG-DLtgLN89.js → chunk-SVP7TREG-CGLhvnsS.js} +1 -1
  23. package/out/phone/assets/{chunk-TICWLB2K-BeBB0_0w.js → chunk-TICWLB2K-DkFUa03q.js} +1 -1
  24. package/out/phone/assets/classDiagram-ZZMXUADV-CIR76lHP.js +1 -0
  25. package/out/phone/assets/classDiagram-v2-VYDZK3BY-CIR76lHP.js +1 -0
  26. package/out/phone/assets/codeHighlighter-jQti-W31.js +1346 -0
  27. package/out/phone/assets/{cynefin-OW5HDTMX-CsDdLZPP.js → cynefin-OW5HDTMX-L8oWVu5S.js} +1 -1
  28. package/out/phone/assets/{cynefinDiagram-5FMLGOSQ-BcaPty-s.js → cynefinDiagram-5FMLGOSQ-DH8-4p4N.js} +1 -1
  29. package/out/phone/assets/{dagre-GXQ25YYZ-o7dqm5ri.js → dagre-GXQ25YYZ-HhLDmcu9.js} +1 -1
  30. package/out/phone/assets/desk-CixRGdTk.js +52 -0
  31. package/out/phone/assets/{diagram-S7CK7UJ4-B5m8q3yP.js → diagram-S7CK7UJ4-CeIbR3Ir.js} +1 -1
  32. package/out/phone/assets/{diagram-UQ7AKVKN-_lP617OW.js → diagram-UQ7AKVKN-BQ84Qnq6.js} +1 -1
  33. package/out/phone/assets/{diagram-VSXAHHWV-D16twHR0.js → diagram-VSXAHHWV-aF_J57fD.js} +1 -1
  34. package/out/phone/assets/{diagram-VX7I27RA-BT8YSil1.js → diagram-VX7I27RA-Bg1ZqM4Y.js} +1 -1
  35. package/out/phone/assets/{diagram-Z3DM3KII-CiSuhrxd.js → diagram-Z3DM3KII-DjTkPAqa.js} +1 -1
  36. package/out/phone/assets/{ebnfDiagram-PWID7BFC-BbCXn4HA.js → ebnfDiagram-PWID7BFC-DPsH5Eky.js} +1 -1
  37. package/out/phone/assets/{erDiagram-RLTQ6QDP-5-xE_bP2.js → erDiagram-RLTQ6QDP-ExvY7e6T.js} +1 -1
  38. package/out/phone/assets/eventmodeling-NTZA5JFV-DYp-zWcL.js +1 -0
  39. package/out/phone/assets/flowDiagram-HODETNUW-CIU32By5.js +1 -0
  40. package/out/phone/assets/{ganttDiagram-EL5Y4UJY-Rqgggqg_.js → ganttDiagram-EL5Y4UJY-hCe06ucl.js} +1 -1
  41. package/out/phone/assets/{gitGraph-4MIJSDKK-Drt18ZKK.js → gitGraph-4MIJSDKK-BuZ6lDat.js} +1 -1
  42. package/out/phone/assets/{gitGraphDiagram-WWUBYQGX-BQ5y4d2H.js → gitGraphDiagram-WWUBYQGX-D-8aVxvj.js} +1 -1
  43. package/out/phone/assets/{info-A6RAGUB7-CpPeSHE0.js → info-A6RAGUB7-CrZtdoYs.js} +1 -1
  44. package/out/phone/assets/{infoDiagram-27XIBGKW-D3d9S0Y6.js → infoDiagram-27XIBGKW-BLRFHxtO.js} +1 -1
  45. package/out/phone/assets/{ishikawaDiagram-5VMMS53U-plFMqx62.js → ishikawaDiagram-5VMMS53U-D7SYWKoj.js} +1 -1
  46. package/out/phone/assets/{journeyDiagram-3NMN7TZE-CX-n-XXx.js → journeyDiagram-3NMN7TZE-BPsg7CQD.js} +1 -1
  47. package/out/phone/assets/{kanban-definition-UXKFOSKX-DrdTzKIc.js → kanban-definition-UXKFOSKX-CbPuNr-E.js} +1 -1
  48. package/out/phone/assets/{line-CqyaArNm.js → line-CkpKMiqK.js} +1 -1
  49. package/out/phone/assets/main-BCnf7dVM.js +264 -0
  50. package/out/phone/assets/main-nqB-uD3v.css +2 -0
  51. package/out/phone/assets/{mermaid-parser.core-CERMa6fg.js → mermaid-parser.core-RTq_mEm1.js} +3 -3
  52. package/out/phone/assets/{mermaid.core-CbGP2wFn.js → mermaid.core-D9LtIKua.js} +4 -4
  53. package/out/phone/assets/{mindmap-definition-YA3MSWOX-BxaIrov6.js → mindmap-definition-YA3MSWOX-8cGgRiRD.js} +1 -1
  54. package/out/phone/assets/{packet-AYTQ26CC-DguFQxPm.js → packet-AYTQ26CC-D9-eSn0v.js} +1 -1
  55. package/out/phone/assets/{pegDiagram-XKGWAZYB-t3td03dz.js → pegDiagram-XKGWAZYB-DztU_rIE.js} +1 -1
  56. package/out/phone/assets/{pie-WAS4IAKB-DoFu2rhu.js → pie-WAS4IAKB-Bk2Tqaq_.js} +1 -1
  57. package/out/phone/assets/{pieDiagram-E7YTZNPT-DctHLSL8.js → pieDiagram-E7YTZNPT-Dm_3mJ9_.js} +1 -1
  58. package/out/phone/assets/{quadrantDiagram-AXDQQJYC-Br7-ImNr.js → quadrantDiagram-AXDQQJYC-lKskzjzu.js} +1 -1
  59. package/out/phone/assets/{radar-RG4KPBEZ-BDjTOHD8.js → radar-RG4KPBEZ-B2z8Txd8.js} +1 -1
  60. package/out/phone/assets/{railroad-74A4TZTK-v8vsrpxb.js → railroad-74A4TZTK-11VmdALq.js} +1 -1
  61. package/out/phone/assets/railroad-abnf-HS5TGJTU-BkSycwye.js +1 -0
  62. package/out/phone/assets/railroad-ebnf-LZEXJU2U-BsPIU3iV.js +1 -0
  63. package/out/phone/assets/railroad-peg-WCYAUIDC-Cy8G7u5C.js +1 -0
  64. package/out/phone/assets/{railroadDiagram-O6MQD6OU-DtH4qQrr.js → railroadDiagram-O6MQD6OU-Dr0NTIA6.js} +1 -1
  65. package/out/phone/assets/{requirementDiagram-BXWQKSXE-BSqejjZP.js → requirementDiagram-BXWQKSXE-C0W6h_5I.js} +1 -1
  66. package/out/phone/assets/{sankeyDiagram-P5KCCOFB-DsTWuNtL.js → sankeyDiagram-P5KCCOFB-CVJDathY.js} +1 -1
  67. package/out/phone/assets/{sequenceDiagram-WJ2MYXX4-zLMvPyPC.js → sequenceDiagram-WJ2MYXX4-BxHQTG6x.js} +1 -1
  68. package/out/phone/assets/shellUpdate-DPSfgHG3.js +36 -0
  69. package/out/phone/assets/{stateDiagram-D77RDMKH-DrBC05BN.js → stateDiagram-D77RDMKH-BO5MAjhs.js} +1 -1
  70. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-B8IHc2bm.js +1 -0
  71. package/out/phone/assets/{swimlanes-42K2YHIH-B27-qSm5.js → swimlanes-42K2YHIH-DnhDPyy6.js} +1 -1
  72. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-dmSDAN2F.js +8 -0
  73. package/out/phone/assets/{timeline-definition-24CTP7MA-8NDkGf5U.js → timeline-definition-24CTP7MA-bLEjS7re.js} +1 -1
  74. package/out/phone/assets/{treeView-Q6P3EWNA-B9BXwCDC.js → treeView-Q6P3EWNA-Ci-sA9wK.js} +1 -1
  75. package/out/phone/assets/{treemap-WGGIJYW6-B0IqbwdT.js → treemap-WGGIJYW6-BXCjzK65.js} +1 -1
  76. package/out/phone/assets/{vennDiagram-4TSXK5OY-Dp-aKgNa.js → vennDiagram-4TSXK5OY-DHsj5dRx.js} +1 -1
  77. package/out/phone/assets/{wardley-WFR3VGLG-B7FlADZf.js → wardley-WFR3VGLG-d8TdCu-H.js} +1 -1
  78. package/out/phone/assets/{wardleyDiagram-VM6X3IG4-BVntjQNl.js → wardleyDiagram-VM6X3IG4-DQFVP9qu.js} +1 -1
  79. package/out/phone/assets/{xychartDiagram-S5SC5T6Z-kgVJvkgO.js → xychartDiagram-S5SC5T6Z-Dni2Y0ov.js} +1 -1
  80. package/out/phone/desk.html +81 -2
  81. package/out/phone/index.html +51 -3
  82. package/out/phone/manifest.webmanifest +1 -0
  83. package/out/phone/splash/1125x2436-dark.png +0 -0
  84. package/out/phone/splash/1125x2436-light.png +0 -0
  85. package/out/phone/splash/1170x2532-dark.png +0 -0
  86. package/out/phone/splash/1170x2532-light.png +0 -0
  87. package/out/phone/splash/1179x2556-dark.png +0 -0
  88. package/out/phone/splash/1179x2556-light.png +0 -0
  89. package/out/phone/splash/1206x2622-dark.png +0 -0
  90. package/out/phone/splash/1206x2622-light.png +0 -0
  91. package/out/phone/splash/1242x2208-dark.png +0 -0
  92. package/out/phone/splash/1242x2208-light.png +0 -0
  93. package/out/phone/splash/1242x2688-dark.png +0 -0
  94. package/out/phone/splash/1242x2688-light.png +0 -0
  95. package/out/phone/splash/1260x2736-dark.png +0 -0
  96. package/out/phone/splash/1260x2736-light.png +0 -0
  97. package/out/phone/splash/1284x2778-dark.png +0 -0
  98. package/out/phone/splash/1284x2778-light.png +0 -0
  99. package/out/phone/splash/1290x2796-dark.png +0 -0
  100. package/out/phone/splash/1290x2796-light.png +0 -0
  101. package/out/phone/splash/1320x2868-dark.png +0 -0
  102. package/out/phone/splash/1320x2868-light.png +0 -0
  103. package/out/phone/splash/750x1334-dark.png +0 -0
  104. package/out/phone/splash/750x1334-light.png +0 -0
  105. package/out/phone/splash/828x1792-dark.png +0 -0
  106. package/out/phone/splash/828x1792-light.png +0 -0
  107. package/out/phone/sw.js +219 -6
  108. package/out/renderer/assets/EditDiff-DxxLuCEI.js +1 -0
  109. package/out/renderer/assets/File-Tz3MUtN6.js +1 -0
  110. package/out/renderer/assets/ReadFileView-DFoLPU04.js +4 -0
  111. package/out/renderer/assets/SidePanel-CL40W2RY.js +47 -0
  112. package/out/renderer/assets/SidePanel-D0m4IYxS.css +1 -0
  113. package/out/renderer/assets/Virtualizer-B0uwx_XV.js +1345 -0
  114. package/out/renderer/assets/{abnfDiagram-VCTEODGH-Bp0r3dKm.js → abnfDiagram-VCTEODGH-CJ9nn9eH.js} +1 -1
  115. package/out/renderer/assets/{arc-BD5HnhIt.js → arc-B8im8n0O.js} +1 -1
  116. package/out/renderer/assets/{architectureDiagram-5GKGNRK7-CgJHjETB.js → architectureDiagram-5GKGNRK7-BRSi5FBk.js} +1 -1
  117. package/out/renderer/assets/{blockDiagram-I7D4REHJ-5le9vk4G.js → blockDiagram-I7D4REHJ-CQ1wirIl.js} +1 -1
  118. package/out/renderer/assets/{c4Diagram-7LVT6UL2-B4DCe-qN.js → c4Diagram-7LVT6UL2-9HyLIioe.js} +1 -1
  119. package/out/renderer/assets/channel-DjB0ww6b.js +1 -0
  120. package/out/renderer/assets/{chunk-2Q5K7J3B-DIxWfJHE.js → chunk-2Q5K7J3B-BwC9g3bx.js} +1 -1
  121. package/out/renderer/assets/{chunk-5VM5RSS4-D9j4om1l.js → chunk-5VM5RSS4-DMtgxPBL.js} +1 -1
  122. package/out/renderer/assets/{chunk-F27PBJKO-B_tGbKyc.js → chunk-F27PBJKO-DSi_XV5v.js} +1 -1
  123. package/out/renderer/assets/{chunk-IMKFNOWR-Cfffd1p9.js → chunk-IMKFNOWR-Dctc6Apj.js} +1 -1
  124. package/out/renderer/assets/{chunk-JWPE2WC7-BABZOPGb.js → chunk-JWPE2WC7-I2BD5qM7.js} +1 -1
  125. package/out/renderer/assets/{chunk-POPQ4Y6H-D-QyVpSn.js → chunk-POPQ4Y6H-k60pc4eT.js} +1 -1
  126. package/out/renderer/assets/{chunk-SVP7TREG-BghyPSd6.js → chunk-SVP7TREG-zCGemfqm.js} +1 -1
  127. package/out/renderer/assets/{chunk-TICWLB2K-CQmthy6z.js → chunk-TICWLB2K-CdDiHIq-.js} +1 -1
  128. package/out/renderer/assets/{chunk-XXDRQBXY-CDKsbyR7.js → chunk-XXDRQBXY-GYVDxVfN.js} +1 -1
  129. package/out/renderer/assets/classDiagram-ZZMXUADV-6SiAw1np.js +1 -0
  130. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-6SiAw1np.js +1 -0
  131. package/out/renderer/assets/{cose-bilkent-JH36ORCC-oajViFnN.js → cose-bilkent-JH36ORCC-BnSAtUh-.js} +1 -1
  132. package/out/renderer/assets/{cynefin-OW5HDTMX-DMH1CUmI.js → cynefin-OW5HDTMX-DnQaS9VN.js} +1 -1
  133. package/out/renderer/assets/{cynefinDiagram-5FMLGOSQ-DVUJf9t0.js → cynefinDiagram-5FMLGOSQ-BNQdw0PV.js} +1 -1
  134. package/out/renderer/assets/{cytoscape-fcose-adTZ191M.js → cytoscape-fcose-CzkrRInm.js} +1 -1
  135. package/out/renderer/assets/{dagre-GXQ25YYZ-BXRWWNje.js → dagre-GXQ25YYZ-fG1vMsyn.js} +1 -1
  136. package/out/renderer/assets/{diagram-S7CK7UJ4-Dg7f2Dan.js → diagram-S7CK7UJ4-BcfAFVc2.js} +1 -1
  137. package/out/renderer/assets/{diagram-UQ7AKVKN-DsLRyZAt.js → diagram-UQ7AKVKN-D8f3Tsx9.js} +1 -1
  138. package/out/renderer/assets/{diagram-VSXAHHWV-3_LoodSS.js → diagram-VSXAHHWV-B-U9CIWt.js} +1 -1
  139. package/out/renderer/assets/{diagram-VX7I27RA-DQeZp2Cz.js → diagram-VX7I27RA-CX6ifTkJ.js} +1 -1
  140. package/out/renderer/assets/{diagram-Z3DM3KII-Dwil6g5m.js → diagram-Z3DM3KII-49dS9s3L.js} +1 -1
  141. package/out/renderer/assets/{ebnfDiagram-PWID7BFC-DecVNxpu.js → ebnfDiagram-PWID7BFC-CraGJRI7.js} +1 -1
  142. package/out/renderer/assets/{erDiagram-RLTQ6QDP-D2rmo2nP.js → erDiagram-RLTQ6QDP-CfMNvEoW.js} +1 -1
  143. package/out/renderer/assets/{flowDiagram-HODETNUW-_SF2dRBl.js → flowDiagram-HODETNUW-C8XM3p4T.js} +1 -1
  144. package/out/renderer/assets/{ganttDiagram-EL5Y4UJY-BoYWs5Ev.js → ganttDiagram-EL5Y4UJY-DlJBMKFX.js} +1 -1
  145. package/out/renderer/assets/{gitGraphDiagram-WWUBYQGX-BqRbZ3V0.js → gitGraphDiagram-WWUBYQGX-DvEzDsKF.js} +1 -1
  146. package/out/renderer/assets/globals-BFf1P-Y5.js +715 -0
  147. package/out/renderer/assets/globals-DUBhAVpU.css +1 -0
  148. package/out/renderer/assets/index-L4TTIP10.js +89 -0
  149. package/out/renderer/assets/{infoDiagram-27XIBGKW-CFt6xyuD.js → infoDiagram-27XIBGKW-CckfBO-R.js} +1 -1
  150. package/out/renderer/assets/{ishikawaDiagram-5VMMS53U-CZB8G4dD.js → ishikawaDiagram-5VMMS53U-mUoXchkB.js} +1 -1
  151. package/out/renderer/assets/{journeyDiagram-3NMN7TZE-CO2VRmpx.js → journeyDiagram-3NMN7TZE-zzLL0HFW.js} +1 -1
  152. package/out/renderer/assets/{kanban-definition-UXKFOSKX-DIqEnfMM.js → kanban-definition-UXKFOSKX-BJ_9aIhB.js} +1 -1
  153. package/out/renderer/assets/{layout-DXRKfO_Y.js → layout-3SRMHY7n.js} +1 -1
  154. package/out/renderer/assets/{linear-Cdx1AdZJ.js → linear-CWpclK_R.js} +1 -1
  155. package/out/renderer/assets/manifest-DOzTaB8J.js +525 -0
  156. package/out/renderer/assets/{mermaid.core-DuIO2jsm.js → mermaid.core-DORpmVi3.js} +5 -5
  157. package/out/renderer/assets/{mindmap-definition-YA3MSWOX-B5lvxG2M.js → mindmap-definition-YA3MSWOX-CYBlCqIB.js} +1 -1
  158. package/out/renderer/assets/{pegDiagram-XKGWAZYB-DCwHp-K3.js → pegDiagram-XKGWAZYB-DhWwLs4v.js} +1 -1
  159. package/out/renderer/assets/{pieDiagram-E7YTZNPT-Dq048Wh7.js → pieDiagram-E7YTZNPT-Bzpc57-A.js} +1 -1
  160. package/out/renderer/assets/{quadrantDiagram-AXDQQJYC-DwkFkAi_.js → quadrantDiagram-AXDQQJYC-spKXEbds.js} +1 -1
  161. package/out/renderer/assets/{railroadDiagram-O6MQD6OU-2NKvwLP-.js → railroadDiagram-O6MQD6OU-Br553px3.js} +1 -1
  162. package/out/renderer/assets/{requirementDiagram-BXWQKSXE-Bp44tNQ0.js → requirementDiagram-BXWQKSXE-CX-Dqij_.js} +1 -1
  163. package/out/renderer/assets/{sankeyDiagram-P5KCCOFB-C3TFp1NK.js → sankeyDiagram-P5KCCOFB-Bgx1W6B9.js} +1 -1
  164. package/out/renderer/assets/{sequenceDiagram-WJ2MYXX4-BTPoYQeW.js → sequenceDiagram-WJ2MYXX4-CKQv6pcU.js} +1 -1
  165. package/out/renderer/assets/sessionChanges-BLzNhRuv.js +31 -0
  166. package/out/renderer/assets/settings-Bsrw4ERp.js +25 -0
  167. package/out/renderer/assets/{sizeCapture-INFHLROL-DvNj5TDT.js → sizeCapture-INFHLROL-DtRedfRe.js} +1 -1
  168. package/out/renderer/assets/{stateDiagram-D77RDMKH-DC8YykNp.js → stateDiagram-D77RDMKH-CMP5owem.js} +1 -1
  169. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-6-731AqJ.js +1 -0
  170. package/out/renderer/assets/{swimlanes-42K2YHIH-0yL1nNkg.js → swimlanes-42K2YHIH-D30AvvmW.js} +1 -1
  171. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-B8KijqIT.js +8 -0
  172. package/out/renderer/assets/{timeline-definition-24CTP7MA-Pg-2roGv.js → timeline-definition-24CTP7MA-CsZAMmMZ.js} +1 -1
  173. package/out/renderer/assets/{vennDiagram-4TSXK5OY-D0af5K4E.js → vennDiagram-4TSXK5OY-COQ7L1f7.js} +1 -1
  174. package/out/renderer/assets/{wardleyDiagram-VM6X3IG4-CB_nIy_l.js → wardleyDiagram-VM6X3IG4-dqMWLTCs.js} +1 -1
  175. package/out/renderer/assets/{xychartDiagram-S5SC5T6Z-A26Yld8R.js → xychartDiagram-S5SC5T6Z-DX4clIYP.js} +1 -1
  176. package/out/renderer/index.html +3 -4
  177. package/out/renderer/plugin-view.html +37 -0
  178. package/out/renderer/settings.html +7 -4
  179. package/out/renderer/web-preload.js +28 -28
  180. package/out/server/agent.js +663 -124
  181. package/out/server/chunks/{agent-D33nI7fP.js → agent-BbNq8i9j.js} +909 -592
  182. package/out/server/chunks/conversationsMove-CvFPFHaa.js +587 -0
  183. package/out/server/chunks/{gpuBackendInstall-CRzfB150.js → gpuBackendInstall-jAzoFq7U.js} +3 -3
  184. package/out/server/chunks/{loadProvider-4Y15KP7W.js → loadProvider-NdOVbsHi.js} +2 -2
  185. package/out/server/chunks/{manifest-wlfh-NN5.js → manifest-BPXFscqI.js} +9 -3
  186. package/out/server/chunks/registry-BhoHPSKn.js +3353 -0
  187. package/out/server/chunks/{resources-DzUshg1j.js → resources-BfbTkFP0.js} +21 -10
  188. package/out/server/chunks/sendImage-BCNW9JRV.js +418 -0
  189. package/out/server/chunks/{storageScanWorker-CuttDIGS.js → storageScanWorker-CR7HbOWG.js} +2 -2
  190. package/out/server/chunks/{storageScanWorker-CX8O_DlF.js → storageScanWorker-DjFyHTye.js} +2 -2
  191. package/out/server/chunks/{workflowPresets-CAA0AY6f.js → workflowPresets-C2T1BzA2.js} +863 -662
  192. package/out/server/index.js +13584 -15047
  193. package/out/server/memory-service.js +5008 -0
  194. package/out/server/plugin-host.js +2 -2
  195. package/package.json +1 -1
  196. package/out/phone/assets/EnsoNerdSymbolsMono-Regular-TdeMQojc.ttf +0 -0
  197. package/out/phone/assets/architecture-7GRP2DOG-ihVIDRRt.js +0 -1
  198. package/out/phone/assets/channel-BQsoblXW.js +0 -1
  199. package/out/phone/assets/classDiagram-ZZMXUADV-rwnxFDXp.js +0 -1
  200. package/out/phone/assets/classDiagram-v2-VYDZK3BY-rwnxFDXp.js +0 -1
  201. package/out/phone/assets/desk-DNf6lCoq.js +0 -2
  202. package/out/phone/assets/eventmodeling-NTZA5JFV-BVS2RGt-.js +0 -1
  203. package/out/phone/assets/flowDiagram-HODETNUW-BSlxj9Uk.js +0 -1
  204. package/out/phone/assets/main-BGlFv7yA.js +0 -1658
  205. package/out/phone/assets/main-BS1SSCau.css +0 -1
  206. package/out/phone/assets/railroad-abnf-HS5TGJTU-CUELjEtC.js +0 -1
  207. package/out/phone/assets/railroad-ebnf-LZEXJU2U-DdIokM4i.js +0 -1
  208. package/out/phone/assets/railroad-peg-WCYAUIDC-DYyy0B-_.js +0 -1
  209. package/out/phone/assets/stateDiagram-v2-MP3YSRHH-DT7BlwvF.js +0 -1
  210. package/out/phone/assets/storage-BeJvYXAx.js +0 -36
  211. package/out/phone/assets/swimlanesDiagram-VR7AAH4N-CWnm4v0A.js +0 -8
  212. package/out/renderer/assets/channel-D-HltTAP.js +0 -1
  213. package/out/renderer/assets/classDiagram-ZZMXUADV-BCWhgMul.js +0 -1
  214. package/out/renderer/assets/classDiagram-v2-VYDZK3BY-BCWhgMul.js +0 -1
  215. package/out/renderer/assets/globals-BEwCf508.css +0 -1
  216. package/out/renderer/assets/globals-C3zxoqqH.js +0 -2603
  217. package/out/renderer/assets/index-9vqh4wxi.js +0 -133
  218. package/out/renderer/assets/index-F_0FxVZ_.css +0 -1
  219. package/out/renderer/assets/settings-DlDHkOe2.js +0 -25
  220. package/out/renderer/assets/stateDiagram-v2-MP3YSRHH-B4rCEEYH.js +0 -1
  221. package/out/renderer/assets/swimlanesDiagram-VR7AAH4N-zQqW8MJ5.js +0 -8
  222. package/out/server/chunks/conversationsMove-CJZfkj55.js +0 -57
@@ -1195,6 +1195,7 @@ const POSIX_HOST = "posix";
1195
1195
  const REMOTE_FETCH_HOST = "remote-fetch";
1196
1196
  const BOT_AVATAR_HOST = "bot-avatar";
1197
1197
  const SECRETARY_AVATAR_HOST = "secretary-avatar";
1198
+ const SECRETARY_REPORT_HOST = "secretary-report";
1198
1199
  const PLUGIN_ASSET_HOST = "plugin-asset";
1199
1200
  const IMAGE_EXTENSIONS = [
1200
1201
  "png",
@@ -1223,7 +1224,7 @@ function isVideoPath(pathOrUrl) {
1223
1224
  }
1224
1225
  function localImageUrlToPath(url) {
1225
1226
  const host = url.hostname;
1226
- if (!host || host === REMOTE_FETCH_HOST || host === BOT_AVATAR_HOST || host === SECRETARY_AVATAR_HOST || host === PLUGIN_ASSET_HOST)
1227
+ if (!host || host === REMOTE_FETCH_HOST || host === BOT_AVATAR_HOST || host === SECRETARY_AVATAR_HOST || host === SECRETARY_REPORT_HOST || host === PLUGIN_ASSET_HOST)
1227
1228
  return null;
1228
1229
  const segments = url.pathname.split("/").filter(Boolean).map(decodeURIComponent);
1229
1230
  if (host === POSIX_HOST) {
@@ -1590,14 +1591,14 @@ function warnDroppedHeader(name) {
1590
1591
  droppedHeaderWarnings.add(name);
1591
1592
  console.warn(`[provider-headers] dropped ${name}: value cannot be sent as a header`);
1592
1593
  }
1593
- function parseProviderHeaders(value) {
1594
+ function parseProviderHeaders(value, { warn = true } = {}) {
1594
1595
  if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
1595
1596
  const headers = {};
1596
1597
  for (const [name, headerValue] of Object.entries(value)) {
1597
1598
  if (!HEADER_NAME_RE.test(name)) continue;
1598
1599
  if (typeof headerValue !== "string") continue;
1599
1600
  if (!isSendableHeaderValue(headerValue)) {
1600
- warnDroppedHeader(name);
1601
+ if (warn) warnDroppedHeader(name);
1601
1602
  continue;
1602
1603
  }
1603
1604
  headers[name] = headerValue;
@@ -1826,6 +1827,7 @@ function childProfileToolIds(tools, options = {}) {
1826
1827
  ids.push(shell);
1827
1828
  if (editMode === "apply_patch") ids.push("apply_patch");
1828
1829
  else ids.push("edit", "write");
1830
+ ids.push("task_output", "task_stop", "task_settle");
1829
1831
  }
1830
1832
  ids.push("message_main_agent", "message_coworker");
1831
1833
  if (options.exploreFold) ids.push("explore_mark", "explore_fold");
@@ -2024,8 +2026,8 @@ function messageText(message) {
2024
2026
  }).join("");
2025
2027
  }
2026
2028
  function isPureSessionUpdate(text) {
2027
- if (!/<session-updates>|<secretary-schedule>/.test(text)) return false;
2028
- const stripped = text.replace(/<session-updates>[\s\S]*?<\/session-updates>/g, "").replace(/<secretary-schedule>[\s\S]*?<\/secretary-schedule>/g, "").trim();
2029
+ if (!/<session-updates>|<secretary-schedule>|<secretary-message>/.test(text)) return false;
2030
+ const stripped = text.replace(/<session-updates>[\s\S]*?<\/session-updates>/g, "").replace(/<secretary-schedule>[\s\S]*?<\/secretary-schedule>/g, "").replace(/<secretary-message>[\s\S]*?<\/secretary-message>/g, "").trim();
2029
2031
  return stripped.length === 0;
2030
2032
  }
2031
2033
  function isSilentMarker(text) {
@@ -2099,7 +2101,9 @@ const SECRETARY_OPS = [
2099
2101
  "schedule_remove",
2100
2102
  "secretary_profile_propose",
2101
2103
  "skill_propose",
2102
- "tool_propose"
2104
+ "tool_propose",
2105
+ "secretary_list",
2106
+ "secretary_message"
2103
2107
  ];
2104
2108
  const SECRETARY_SEND_MODES = ["queue", "steer"];
2105
2109
  const SECRETARY_INTERNAL_OPS = ["tool_run"];
@@ -2470,6 +2474,7 @@ const APPROVAL_DECISIONS = ["allow", "allowSession", "deny", "revise", "review"]
2470
2474
  function isApprovalDecision(value) {
2471
2475
  return APPROVAL_DECISIONS.includes(value);
2472
2476
  }
2477
+ const TASK_KEEP_REASON_MAX = 200;
2473
2478
  const SHELL_FAILURE_KINDS = [
2474
2479
  "exit_nonzero",
2475
2480
  "deadline",
@@ -2497,6 +2502,18 @@ function parseShellFailure(value) {
2497
2502
  }
2498
2503
  const AGENT_WAIT_DEFAULT_MS = 30 * 1e3;
2499
2504
  const AGENT_WAIT_MAX_MS = 5 * 60 * 1e3;
2505
+ const AGENT_TASK_MAX_RESUMES = 3;
2506
+ function parseClosed(table, type, value) {
2507
+ if (!Object.hasOwn(table, type)) return null;
2508
+ return table[type](value);
2509
+ }
2510
+ function requireEventIdentity(kind, parse2) {
2511
+ return (value) => {
2512
+ const identity = kind === "child" ? parseChildSessionIdentity(value.identity) : kind === "parent" ? parseSessionIdentity(value.identity) : parseAnySessionIdentity(value.identity);
2513
+ if (!identity || !isSequence(value.seq)) return null;
2514
+ return parse2(value);
2515
+ };
2516
+ }
2500
2517
  function parseAgentControlToolRequest(value) {
2501
2518
  if (!isRecord(value) || typeof value.operation !== "string") return null;
2502
2519
  const nonEmpty2 = (input) => typeof input === "string" && input.trim().length > 0;
@@ -2507,9 +2524,15 @@ function parseAgentControlToolRequest(value) {
2507
2524
  return hasExactKeys(gate, ["commandRef"]) && nonEmpty2(gate.commandRef);
2508
2525
  };
2509
2526
  const optionalGate = value.gate === void 0 || gateValid(value.gate);
2510
- switch (value.operation) {
2511
- case "spawn":
2512
- return hasOnlyKeys(value, [
2527
+ const parseRunIdOperation = (value2) => {
2528
+ return hasExactKeys(value2, ["operation", "runId"]) && nonEmpty2(value2.runId) ? value2 : null;
2529
+ };
2530
+ const parseAgentIdOperation = (value2) => {
2531
+ return hasExactKeys(value2, ["operation", "agentId"]) && nonEmpty2(value2.agentId) ? value2 : null;
2532
+ };
2533
+ const parsers = {
2534
+ spawn: (value2) => {
2535
+ return hasOnlyKeys(value2, [
2513
2536
  "operation",
2514
2537
  "mode",
2515
2538
  "name",
@@ -2521,9 +2544,10 @@ function parseAgentControlToolRequest(value) {
2521
2544
  "wait",
2522
2545
  "schema",
2523
2546
  "gate"
2524
- ]) && (value.mode === "task" || value.mode === "coworker") && optionalString(value.name) && nonEmpty2(value.description) && nonEmpty2(value.prompt) && optionalString(value.agentType) && optionalString(value.model) && (value.thinking === void 0 || value.thinking === "off" || THINKING_LEVELS.includes(value.thinking)) && typeof value.wait === "boolean" && schemaValid && optionalGate ? value : null;
2525
- case "send":
2526
- return hasOnlyKeys(value, [
2547
+ ]) && (value2.mode === "task" || value2.mode === "coworker") && optionalString(value2.name) && nonEmpty2(value2.description) && nonEmpty2(value2.prompt) && optionalString(value2.agentType) && optionalString(value2.model) && (value2.thinking === void 0 || value2.thinking === "off" || THINKING_LEVELS.includes(value2.thinking)) && typeof value2.wait === "boolean" && schemaValid && optionalGate ? value2 : null;
2548
+ },
2549
+ send: (value2) => {
2550
+ return hasOnlyKeys(value2, [
2527
2551
  "operation",
2528
2552
  "agentId",
2529
2553
  "message",
@@ -2532,21 +2556,23 @@ function parseAgentControlToolRequest(value) {
2532
2556
  "wait",
2533
2557
  "schema",
2534
2558
  "gate"
2535
- ]) && nonEmpty2(value.agentId) && nonEmpty2(value.message) && (value.delivery === "auto" || value.delivery === "steer" || value.delivery === "next") && optionalString(value.expectedRunId) && typeof value.wait === "boolean" && schemaValid && optionalGate ? value : null;
2536
- case "wait":
2537
- return hasOnlyKeys(value, ["operation", "runIds", "until", "timeoutMs"]) && Array.isArray(value.runIds) && value.runIds.length > 0 && value.runIds.every((runId) => nonEmpty2(runId)) && new Set(value.runIds).size === value.runIds.length && (value.until === "all" || value.until === "any") && (value.timeoutMs === void 0 || Number.isInteger(value.timeoutMs) && value.timeoutMs >= 0 && value.timeoutMs <= AGENT_WAIT_MAX_MS) ? value : null;
2538
- case "report":
2539
- case "stop":
2540
- return hasExactKeys(value, ["operation", "runId"]) && nonEmpty2(value.runId) ? value : null;
2541
- case "list":
2542
- return hasOnlyKeys(value, ["operation", "status", "cursor", "limit"]) && (value.status === void 0 || ["creating", "ready", "active", "parked", "closed"].includes(value.status)) && optionalString(value.cursor) && Number.isInteger(value.limit) && value.limit >= 1 && value.limit <= 100 ? value : null;
2543
- case "message":
2544
- return hasExactKeys(value, ["operation", "to", "text"]) && nonEmpty2(value.to) && nonEmpty2(value.text) ? value : null;
2545
- case "dismiss":
2546
- return hasExactKeys(value, ["operation", "agentId"]) && nonEmpty2(value.agentId) ? value : null;
2547
- default:
2548
- return null;
2549
- }
2559
+ ]) && nonEmpty2(value2.agentId) && nonEmpty2(value2.message) && (value2.delivery === "auto" || value2.delivery === "steer" || value2.delivery === "next") && optionalString(value2.expectedRunId) && typeof value2.wait === "boolean" && schemaValid && optionalGate ? value2 : null;
2560
+ },
2561
+ wait: (value2) => {
2562
+ return hasOnlyKeys(value2, ["operation", "runIds", "until", "timeoutMs"]) && Array.isArray(value2.runIds) && value2.runIds.length > 0 && value2.runIds.every((runId) => nonEmpty2(runId)) && new Set(value2.runIds).size === value2.runIds.length && (value2.until === "all" || value2.until === "any") && (value2.timeoutMs === void 0 || Number.isInteger(value2.timeoutMs) && value2.timeoutMs >= 0 && value2.timeoutMs <= AGENT_WAIT_MAX_MS) ? value2 : null;
2563
+ },
2564
+ report: parseRunIdOperation,
2565
+ stop: parseRunIdOperation,
2566
+ list: (value2) => {
2567
+ return hasOnlyKeys(value2, ["operation", "status", "cursor", "limit"]) && (value2.status === void 0 || ["creating", "ready", "active", "parked", "closed"].includes(value2.status)) && optionalString(value2.cursor) && Number.isInteger(value2.limit) && value2.limit >= 1 && value2.limit <= 100 ? value2 : null;
2568
+ },
2569
+ message: (value2) => {
2570
+ return hasExactKeys(value2, ["operation", "to", "text"]) && nonEmpty2(value2.to) && nonEmpty2(value2.text) ? value2 : null;
2571
+ },
2572
+ dismiss: parseAgentIdOperation,
2573
+ resume: parseAgentIdOperation
2574
+ };
2575
+ return parseClosed(parsers, value.operation, value);
2550
2576
  }
2551
2577
  function parseAgentControlToolResponse(value) {
2552
2578
  if (!isRecord(value)) return null;
@@ -2558,6 +2584,8 @@ function parseAgentControlToolResponse(value) {
2558
2584
  "forbidden",
2559
2585
  "mode-disabled",
2560
2586
  "not-found",
2587
+ "restart-lost",
2588
+ "other-owner",
2561
2589
  "invalid-state",
2562
2590
  "run-mismatch",
2563
2591
  "runtime-unavailable"
@@ -2778,13 +2806,24 @@ function hasValidProjectedMetadata(value) {
2778
2806
  const isMcpOAuthAccess = (value) => isRecord(value) && hasOnlyKeys(value, ["access_token", "expires_at"]) && isNonEmptyString(value.access_token) && (value.expires_at === void 0 || typeof value.expires_at === "number" && Number.isFinite(value.expires_at));
2779
2807
  const isMcpOAuthRefreshResult = (value) => isRecord(value) && (value.ok === true ? hasOnlyKeys(value, ["ok", "access"]) && isMcpOAuthAccess(value.access) : value.ok === false && hasOnlyKeys(value, ["ok", "unauthorized", "error"]) && typeof value.unauthorized === "boolean" && typeof value.error === "string");
2780
2808
  function parseTurnDigest(value) {
2781
- if (!isRecord(value) || !hasExactKeys(value, ["firstUserText", "userText", "assistantText"])) {
2809
+ if (!isRecord(value) || !hasOnlyKeys(value, ["firstUserText", "userText", "assistantText", "lastTool"])) {
2782
2810
  return null;
2783
2811
  }
2784
2812
  if (typeof value.firstUserText !== "string" || typeof value.userText !== "string" || typeof value.assistantText !== "string") {
2785
2813
  return null;
2786
2814
  }
2787
- return value;
2815
+ const digest = {
2816
+ firstUserText: value.firstUserText,
2817
+ userText: value.userText,
2818
+ assistantText: value.assistantText
2819
+ };
2820
+ if (value.lastTool !== void 0) {
2821
+ if (!isRecord(value.lastTool) || !hasExactKeys(value.lastTool, ["name", "ok"]) || typeof value.lastTool.name !== "string" || value.lastTool.name.trim().length === 0 || typeof value.lastTool.ok !== "boolean") {
2822
+ return null;
2823
+ }
2824
+ digest.lastTool = { name: value.lastTool.name, ok: value.lastTool.ok };
2825
+ }
2826
+ return digest;
2788
2827
  }
2789
2828
  function parseTurnReport(value) {
2790
2829
  if (!isRecord(value) || !hasOnlyKeys(value, ["text", "omitted"])) return null;
@@ -3036,9 +3075,8 @@ function parseSafeChildRef(value) {
3036
3075
  const typeKey = parseAgentTypeKey(value.typeKey);
3037
3076
  return isNonEmptyString(value.sessionId) && isUuid(value.generation) && isUuid(value.instanceId) && isNonEmptyString(value.instanceName) && typeKey ? value : null;
3038
3077
  }
3039
- function parseAgentSessionCustomEntry(value) {
3040
- if (!isRecord(value)) return null;
3041
- if (value.kind === "oauth-account-selected") {
3078
+ const agentSessionCustomEntryParsers = {
3079
+ "oauth-account-selected": (value) => {
3042
3080
  return hasOnlyKeys(value, [
3043
3081
  "kind",
3044
3082
  "accountKey",
@@ -3047,27 +3085,37 @@ function parseAgentSessionCustomEntry(value) {
3047
3085
  "modelId",
3048
3086
  "at"
3049
3087
  ]) && isCodexAccountKey(value.accountKey) && (value.previousAccountKey === void 0 || isCodexAccountKey(value.previousAccountKey)) && (value.settingsProviderId === void 0 && value.modelId === void 0 || isNonEmptyString(value.settingsProviderId) && isNonEmptyString(value.modelId)) && typeof value.at === "number" && Number.isFinite(value.at) ? value : null;
3050
- }
3051
- if (value.kind === "capability-receipt") {
3088
+ },
3089
+ "capability-receipt": (value) => {
3052
3090
  if (!hasExactKeys(value, ["kind", "receipt"])) return null;
3053
3091
  const receipt = parseCapabilityReceipt(value.receipt);
3054
3092
  return receipt ? { kind: "capability-receipt", receipt } : null;
3055
- }
3056
- if (value.kind === "tool-batch-label") {
3093
+ },
3094
+ "task-wrap-up-nudge": (value) => {
3095
+ return hasExactKeys(value, ["kind", "count", "at"]) && Number.isInteger(value.count) && value.count > 0 && typeof value.at === "number" && Number.isFinite(value.at) ? value : null;
3096
+ },
3097
+ "tool-batch-label": (value) => {
3057
3098
  return hasExactKeys(value, ["kind", "callId", "label", "at"]) && isNonEmptyString(value.callId) && isNonEmptyString(value.label) && value.label.length <= 200 && typeof value.at === "number" && Number.isFinite(value.at) ? value : null;
3099
+ },
3100
+ "agent-dispatch": (value) => {
3101
+ const child = parseSafeChildRef(value.child);
3102
+ if (!child || typeof value.at !== "number" || !Number.isFinite(value.at)) return null;
3103
+ return hasExactKeys(value, ["kind", "child", "at"]) ? value : null;
3104
+ },
3105
+ "agent-completed": (value) => {
3106
+ const child = parseSafeChildRef(value.child);
3107
+ if (!child || typeof value.at !== "number" || !Number.isFinite(value.at)) return null;
3108
+ return hasOnlyKeys(value, ["kind", "child", "receiptSummary", "at"]) && (value.receiptSummary === void 0 || typeof value.receiptSummary === "string") ? value : null;
3109
+ },
3110
+ "agent-failed": (value) => {
3111
+ const child = parseSafeChildRef(value.child);
3112
+ if (!child || typeof value.at !== "number" || !Number.isFinite(value.at)) return null;
3113
+ return hasExactKeys(value, ["kind", "child", "errorCode", "message", "at"]) && isNonEmptyString(value.errorCode) && isNonEmptyString(value.message) ? value : null;
3058
3114
  }
3059
- const child = parseSafeChildRef(value.child);
3060
- if (!child || typeof value.at !== "number" || !Number.isFinite(value.at)) return null;
3061
- if (value.kind === "agent-dispatch" && hasExactKeys(value, ["kind", "child", "at"])) {
3062
- return value;
3063
- }
3064
- if (value.kind === "agent-completed" && hasOnlyKeys(value, ["kind", "child", "receiptSummary", "at"]) && (value.receiptSummary === void 0 || typeof value.receiptSummary === "string")) {
3065
- return value;
3066
- }
3067
- if (value.kind === "agent-failed" && hasExactKeys(value, ["kind", "child", "errorCode", "message", "at"]) && isNonEmptyString(value.errorCode) && isNonEmptyString(value.message)) {
3068
- return value;
3069
- }
3070
- return null;
3115
+ };
3116
+ function parseAgentSessionCustomEntry(value) {
3117
+ if (!isRecord(value) || typeof value.kind !== "string") return null;
3118
+ return parseClosed(agentSessionCustomEntryParsers, value.kind, value);
3071
3119
  }
3072
3120
  function parseResolvedChildProfileProof(value) {
3073
3121
  if (!isRecord(value) || !hasExactKeys(value, [
@@ -3083,23 +3131,26 @@ function parseResolvedChildProfileProof(value) {
3083
3131
  }
3084
3132
  return value;
3085
3133
  }
3086
- function parseSafeJournalRecord(value) {
3087
- if (!isRecord(value) || typeof value.at !== "number" || !Number.isFinite(value.at)) {
3088
- return null;
3089
- }
3090
- switch (value.type) {
3091
- case "safe-user-text":
3092
- case "safe-assistant-text":
3093
- return hasExactKeys(value, ["type", "text", "at"]) && typeof value.text === "string" ? value : null;
3094
- case "enso-operation":
3095
- return hasExactKeys(value, ["type", "operationId", "capabilityId", "toolCallId", "at"]) && isNonEmptyString(value.operationId) && isProductSurfaceId(value.capabilityId) && isNonEmptyString(value.toolCallId) ? value : null;
3096
- case "safe-model-result":
3097
- return hasExactKeys(value, ["type", "toolCallId", "modelResult", "at"]) && isNonEmptyString(value.toolCallId) && parseCapabilityResult(value.modelResult) ? value : null;
3098
- case "capability-receipt":
3099
- return hasExactKeys(value, ["type", "receipt", "at"]) && parseCapabilityReceipt(value.receipt) ? value : null;
3100
- default:
3101
- return null;
3134
+ const parseSafeTextRecord = (value) => {
3135
+ return hasExactKeys(value, ["type", "text", "at"]) && typeof value.text === "string" ? value : null;
3136
+ };
3137
+ const safeJournalRecordParsers = {
3138
+ "safe-user-text": parseSafeTextRecord,
3139
+ "safe-assistant-text": parseSafeTextRecord,
3140
+ "enso-operation": (value) => {
3141
+ return hasExactKeys(value, ["type", "operationId", "capabilityId", "toolCallId", "at"]) && isNonEmptyString(value.operationId) && isProductSurfaceId(value.capabilityId) && isNonEmptyString(value.toolCallId) ? value : null;
3142
+ },
3143
+ "safe-model-result": (value) => {
3144
+ return hasExactKeys(value, ["type", "toolCallId", "modelResult", "at"]) && isNonEmptyString(value.toolCallId) && parseCapabilityResult(value.modelResult) ? value : null;
3145
+ },
3146
+ "capability-receipt": (value) => {
3147
+ return hasExactKeys(value, ["type", "receipt", "at"]) && parseCapabilityReceipt(value.receipt) ? value : null;
3102
3148
  }
3149
+ };
3150
+ function parseSafeJournalRecord(value) {
3151
+ if (!isRecord(value) || typeof value.at !== "number" || !Number.isFinite(value.at)) return null;
3152
+ if (typeof value.type !== "string") return null;
3153
+ return parseClosed(safeJournalRecordParsers, value.type, value);
3103
3154
  }
3104
3155
  function parseSafeJournalProjection(value) {
3105
3156
  if (!isRecord(value) || !hasExactKeys(value, ["records", "partial"]) || !Array.isArray(value.records) || value.records.some((record2) => parseSafeJournalRecord(record2) === null) || typeof value.partial !== "boolean") {
@@ -3168,353 +3219,433 @@ function parseSessionSnapshot(value) {
3168
3219
  }
3169
3220
  return value;
3170
3221
  }
3171
- function parseAgentCommand(value) {
3172
- if (!isRecord(value) || !isNonEmptyString(value.type)) return null;
3173
- if (value.type === "oauth-pool-result") {
3174
- return hasOnlyKeys(value, ["type", "requestId", "accountKey", "selectionReceipt", "error"]) && isNonEmptyString(value.requestId) && (isCodexAccountKey(value.accountKey) && value.error === void 0 && (value.selectionReceipt === void 0 || isUuid(value.selectionReceipt)) || value.accountKey === void 0 && value.selectionReceipt === void 0 && isNonEmptyString(value.error)) ? value : null;
3222
+ const parseWorkspaceLockCommand = (value) => {
3223
+ return hasOnlyKeys(
3224
+ value,
3225
+ value.type === "lock-workspace" ? ["type", "requestId", "conversationIds"] : ["type", "requestId", "conversationIds", "branch"]
3226
+ ) && isNonEmptyString(value.requestId) && Array.isArray(value.conversationIds) && value.conversationIds.length > 0 && value.conversationIds.every(isNonEmptyString) && new Set(value.conversationIds).size === value.conversationIds.length && (value.branch === void 0 || isNonEmptyString(value.branch)) ? value : null;
3227
+ };
3228
+ const parsePromptOrSteer = (value) => {
3229
+ const images = value.images === void 0 ? [] : parseAttachedImages(value.images);
3230
+ return hasOnlyKeys(value, [
3231
+ "type",
3232
+ "identity",
3233
+ "text",
3234
+ "images",
3235
+ "deliveryId",
3236
+ "activeOnly",
3237
+ "resume",
3238
+ "instanceId"
3239
+ ]) && parseAnySessionIdentity(value.identity) && typeof value.text === "string" && images !== null && (value.text.length > 0 || images.length > 0) && (value.activeOnly === void 0 || value.type === "steer" && value.activeOnly === true && isDeliveryId(value.deliveryId)) && (value.resume === void 0 || value.type === "prompt" && value.resume === true) && (value.type === "steer" && value.deliveryId === void 0 || isDeliveryId(value.deliveryId)) && (value.instanceId === void 0 || isUuid(value.instanceId) && parseSessionIdentity(value.identity) !== null) ? value : null;
3240
+ };
3241
+ const parseHostResultCommand = (value) => {
3242
+ if (!hasOnlyKeys(value, ["type", "identity", "requestId", "ok", "result", "error"]) || !parseAnySessionIdentity(value.identity) || !isNonEmptyString(value.requestId) || typeof value.ok !== "boolean") {
3243
+ return null;
3175
3244
  }
3176
- if (value.type === "mcp-oauth-refresh-result") {
3245
+ const shapeOk = value.ok ? value.error === void 0 : isNonEmptyString(value.error) && value.result === void 0;
3246
+ return shapeOk ? value : null;
3247
+ };
3248
+ const parseIdentityOnlyCommand = (value) => {
3249
+ return hasExactKeys(value, ["type", "identity"]) && parseAnySessionIdentity(value.identity) ? value : null;
3250
+ };
3251
+ const agentCommandParsers = {
3252
+ "oauth-pool-result": (value) => {
3253
+ return hasOnlyKeys(value, ["type", "requestId", "accountKey", "selectionReceipt", "error"]) && isNonEmptyString(value.requestId) && (isCodexAccountKey(value.accountKey) && value.error === void 0 && (value.selectionReceipt === void 0 || isUuid(value.selectionReceipt)) || value.accountKey === void 0 && value.selectionReceipt === void 0 && isNonEmptyString(value.error)) ? value : null;
3254
+ },
3255
+ "mcp-oauth-refresh-result": (value) => {
3177
3256
  return hasOnlyKeys(value, ["type", "requestId", "result"]) && isNonEmptyString(value.requestId) && isMcpOAuthRefreshResult(value.result) ? value : null;
3178
- }
3179
- switch (value.type) {
3180
- case "lock-workspace":
3181
- case "unlock-workspace":
3182
- return hasOnlyKeys(
3183
- value,
3184
- value.type === "lock-workspace" ? ["type", "requestId", "conversationIds"] : ["type", "requestId", "conversationIds", "branch"]
3185
- ) && isNonEmptyString(value.requestId) && Array.isArray(value.conversationIds) && value.conversationIds.length > 0 && value.conversationIds.every(isNonEmptyString) && new Set(value.conversationIds).size === value.conversationIds.length && (value.branch === void 0 || isNonEmptyString(value.branch)) ? value : null;
3186
- case "spawn-parent": {
3187
- if (!hasOnlyKeys(value, [
3188
- "type",
3189
- "identity",
3190
- "cwd",
3191
- "model",
3192
- "resumeFile",
3193
- "reasoningEnabled",
3194
- "thinkingLevel",
3195
- "loadLocalSkills",
3196
- "loadHarnessAssets",
3197
- "trustedProjectCode",
3198
- "exploreFoldEnabled",
3199
- "editMode",
3200
- "hashlineEditEnabled",
3201
- "compactStrategy",
3202
- "smartCompactEnabled",
3203
- "smartCompactSummaryModel",
3204
- "smartCompactMode",
3205
- "memoryLanguage",
3206
- "skillPaths",
3207
- "mcpServers",
3208
- "pluginTools",
3209
- "secretaryTools",
3210
- "workflowPresetFiles",
3211
- "pluginEvents",
3212
- "instruction",
3213
- "approvalMode",
3214
- "autoRejectApprovals",
3215
- "askRelay",
3216
- "approvalReviewer",
3217
- "approvalReviewerClassifier",
3218
- "approvalReviewerManaged",
3219
- "approvalReviewerAllowThreshold",
3220
- "agentTypes",
3221
- "subagentModels",
3222
- "disabledTools",
3223
- "windowsLocalShell",
3224
- "rtkEnabled",
3225
- "dcgPath",
3226
- "remote",
3227
- "rolePrompt",
3228
- "systemPrompt",
3229
- "systemPromptAppend",
3230
- "systemPromptBoost",
3231
- "refusalRetryPrompt",
3232
- "botMode",
3233
- "botGroupTasks",
3234
- "botDiscussMode",
3235
- "botRoutines",
3236
- "secretaryMode",
3237
- "botDelegationTask",
3238
- "botWriteLock",
3239
- "protectedActions",
3240
- "planMode",
3241
- "instanceId"
3242
- ]) || !parseSessionIdentity(value.identity) || typeof value.cwd !== "string" || !parseSessionModelConfig(value.model) || value.resumeFile !== void 0 && !isNonEmptyString(value.resumeFile) || value.loadHarnessAssets !== void 0 && typeof value.loadHarnessAssets !== "boolean" || value.trustedProjectCode !== void 0 && !(Array.isArray(value.trustedProjectCode) && value.trustedProjectCode.length <= 500 && value.trustedProjectCode.every(
3243
- (entry) => typeof entry === "string" && entry.length > 0 && entry.length <= 1024
3244
- )) || value.pluginTools !== void 0 && !isPluginToolList(value.pluginTools) || value.secretaryTools !== void 0 && parseSecretaryToolDescriptors(value.secretaryTools) === null || value.workflowPresetFiles !== void 0 && !(Array.isArray(value.workflowPresetFiles) && value.workflowPresetFiles.length <= 500 && value.workflowPresetFiles.every(
3245
- (entry) => typeof entry === "string" && entry.length > 0 && entry.length <= 1024
3246
- )) || value.pluginEvents !== void 0 && !isPluginEventPlan(value.pluginEvents) || value.rtkEnabled !== void 0 && typeof value.rtkEnabled !== "boolean" || value.dcgPath !== void 0 && !isNonEmptyString(value.dcgPath) || value.planMode !== void 0 && typeof value.planMode !== "boolean" || value.windowsLocalShell !== void 0 && !WINDOWS_LOCAL_SHELLS.includes(
3247
- value.windowsLocalShell
3248
- ) || value.exploreFoldEnabled !== void 0 && typeof value.exploreFoldEnabled !== "boolean" || value.editMode !== void 0 && !isEditMode(value.editMode) || value.hashlineEditEnabled !== void 0 && typeof value.hashlineEditEnabled !== "boolean" || value.compactStrategy !== void 0 && parseCompactStrategy(value.compactStrategy) === null || value.smartCompactEnabled !== void 0 && typeof value.smartCompactEnabled !== "boolean" || value.smartCompactSummaryModel !== void 0 && parseSpawnModelConfig(value.smartCompactSummaryModel) === null || value.smartCompactMode !== void 0 && parseSmartCompactMode(value.smartCompactMode) === null || value.memoryLanguage !== void 0 && typeof value.memoryLanguage !== "string" || value.remote !== void 0 && parseAgentRemoteConfig(value.remote) === null || value.subagentModels !== void 0 && (!Array.isArray(value.subagentModels) || value.subagentModels.some((entry) => parseSubagentModelOption(entry) === null)) || value.approvalReviewer !== void 0 && parseSpawnModelConfig(value.approvalReviewer) === null || value.askRelay !== void 0 && (!isRecord(value.askRelay) || !isNonEmptyString(value.askRelay.name)) || value.approvalReviewerAllowThreshold !== void 0 && (!isApprovalAllowThreshold(value.approvalReviewerAllowThreshold) || value.approvalReviewerClassifier === void 0) || value.approvalReviewerManaged !== void 0 && (value.approvalReviewerManaged !== true || value.approvalReviewerClassifier === void 0) || value.approvalReviewerClassifier !== void 0 && (value.approvalReviewer !== void 0 || !parseClassifierCredentials(value.approvalReviewerClassifier)) || value.rolePrompt !== void 0 && !isNonEmptyString(value.rolePrompt) || value.systemPrompt !== void 0 && !isNonEmptyString(value.systemPrompt) || value.systemPromptAppend !== void 0 && !isNonEmptyString(value.systemPromptAppend) || value.systemPromptBoost !== void 0 && !isNonEmptyString(value.systemPromptBoost) || value.refusalRetryPrompt !== void 0 && !isNonEmptyString(value.refusalRetryPrompt) || value.botMode !== void 0 && typeof value.botMode !== "boolean" || value.botGroupTasks !== void 0 && typeof value.botGroupTasks !== "boolean" || value.botDiscussMode !== void 0 && typeof value.botDiscussMode !== "boolean" || value.botDiscussMode === true && (value.botMode !== true || value.botGroupTasks !== true) || value.botRoutines !== void 0 && typeof value.botRoutines !== "boolean" || value.secretaryMode !== void 0 && typeof value.secretaryMode !== "boolean" || value.botDelegationTask !== void 0 && typeof value.botDelegationTask !== "boolean" || value.botWriteLock !== void 0 && (!isRecord(value.botWriteLock) || !isNonEmptyString(value.botWriteLock.label) || !Array.isArray(value.botWriteLock.ancestors) || !value.botWriteLock.ancestors.every(isNonEmptyString)) || value.protectedActions !== void 0 && typeof value.protectedActions !== "boolean" || value.instanceId !== void 0 && !isUuid(value.instanceId)) {
3249
- return null;
3250
- }
3251
- return value;
3252
- }
3253
- case "spawn-child":
3254
- return hasOnlyKeys(value, ["type", "identity", "cwd", "config", "resumeFile"]) && parseChildSessionIdentity(value.identity) && typeof value.cwd === "string" && parseResolvedAgentTypeSpawnConfig(value.config) && (value.resumeFile === void 0 || isNonEmptyString(value.resumeFile)) ? value : null;
3255
- case "prompt-child":
3256
- return hasOnlyKeys(value, ["type", "identity", "requestId", "task", "requestBudget"]) && parseChildSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && parseAgentDispatchTask(value.task) && (value.requestBudget === void 0 || value.requestBudget === true) ? value : null;
3257
- case "agent-control-result":
3258
- return hasExactKeys(value, ["type", "identity", "requestId", "response"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.requestId) && parseAgentControlToolResponse(value.response) ? value : null;
3259
- case "dismiss-child": {
3260
- const parent = parseSessionIdentity(value.parent);
3261
- const child = parseChildSessionIdentity(value.child);
3262
- return hasOnlyKeys(value, ["type", "parent", "child", "notify"]) && parent && child && child.parent.sessionId === parent.sessionId && child.parent.generation === parent.generation && (value.notify === void 0 || typeof value.notify === "boolean") ? value : null;
3263
- }
3264
- case "dismiss-coworker": {
3265
- const parent = parseSessionIdentity(value.parent);
3266
- return hasOnlyKeys(value, ["type", "parent", "coworkerId", "notify"]) && parent && isNonEmptyString(value.coworkerId) && // 归属校验:coworker id 恒为 `父id::cw-…`,防跨会话误解雇
3267
- value.coworkerId.startsWith(`${parent.sessionId}::cw-`) && (value.notify === void 0 || typeof value.notify === "boolean") ? value : null;
3268
- }
3269
- case "resume-coworker": {
3270
- const parent = parseSessionIdentity(value.parent);
3271
- return hasOnlyKeys(value, [
3272
- "type",
3273
- "parent",
3274
- "coworkerId",
3275
- "name",
3276
- "agentType",
3277
- "resumeFile"
3278
- ]) && parent && isNonEmptyString(value.coworkerId) && value.coworkerId.startsWith(`${parent.sessionId}::cw-`) && isNonEmptyString(value.name) && (value.agentType === void 0 || isNonEmptyString(value.agentType)) && isNonEmptyString(value.resumeFile) ? value : null;
3279
- }
3280
- case "complete-text":
3281
- return hasOnlyKeys(value, [
3282
- "type",
3283
- "requestId",
3284
- "systemPrompt",
3285
- "userText",
3286
- "candidates",
3287
- "timeoutMs",
3288
- "maxTokens",
3289
- "stream",
3290
- "reasoning",
3291
- "probe"
3292
- ]) && isNonEmptyString(value.requestId) && typeof value.systemPrompt === "string" && typeof value.userText === "string" && typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs) && value.timeoutMs > 0 && (value.maxTokens === void 0 || typeof value.maxTokens === "number" && Number.isInteger(value.maxTokens) && value.maxTokens > 0) && (value.stream === void 0 || value.stream === true) && (value.reasoning === void 0 || value.reasoning === "off" || THINKING_LEVELS.includes(value.reasoning)) && (value.probe === void 0 || value.probe === true) && Array.isArray(value.candidates) && value.candidates.length >= 1 && value.candidates.length <= TITLE_SUMMARY_MAX_CANDIDATES && value.candidates.every((candidate) => parseSpawnModelConfig(candidate)) ? value : null;
3293
- case "abort-complete-text":
3294
- return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3295
- case "classify-choice":
3296
- return hasExactKeys(value, [
3297
- "type",
3298
- "requestId",
3299
- "classifier",
3300
- "state",
3301
- "instructions",
3302
- "criteria",
3303
- "timeoutMs"
3304
- ]) && isNonEmptyString(value.requestId) && parseClassifierCredentials(value.classifier) && isRecord(value.state) && isNonEmptyString(value.instructions) && isRecord(value.criteria) && Object.keys(value.criteria).length > 0 && Object.values(value.criteria).every(isNonEmptyString) && typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs) && value.timeoutMs > 0 ? value : null;
3305
- case "abort-classify-choice":
3306
- return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3307
- case "summarize-title":
3308
- return hasExactKeys(value, ["type", "conversationId", "input", "candidates"]) && isNonEmptyString(value.conversationId) && parseTitleSummaryInput(value.input) && Array.isArray(value.candidates) && value.candidates.length >= 1 && value.candidates.length <= TITLE_SUMMARY_MAX_CANDIDATES && value.candidates.every((candidate) => parseSpawnModelConfig(candidate)) ? value : null;
3309
- case "prompt":
3310
- case "steer": {
3311
- const images = value.images === void 0 ? [] : parseAttachedImages(value.images);
3312
- return hasOnlyKeys(value, [
3313
- "type",
3314
- "identity",
3315
- "text",
3316
- "images",
3317
- "deliveryId",
3318
- "activeOnly",
3319
- "resume",
3320
- "instanceId"
3321
- ]) && parseAnySessionIdentity(value.identity) && typeof value.text === "string" && images !== null && (value.text.length > 0 || images.length > 0) && (value.activeOnly === void 0 || value.type === "steer" && value.activeOnly === true && isDeliveryId(value.deliveryId)) && (value.resume === void 0 || value.type === "prompt" && value.resume === true) && (value.deliveryId === void 0 || isDeliveryId(value.deliveryId)) && (value.instanceId === void 0 || isUuid(value.instanceId) && parseSessionIdentity(value.identity) !== null) ? value : null;
3322
- }
3323
- case "set-model":
3324
- return hasExactKeys(value, ["type", "identity", "model"]) && parseAnySessionIdentity(value.identity) && parseSessionModelConfig(value.model) ? value : null;
3325
- case "set-thinking":
3326
- return hasExactKeys(value, ["type", "identity", "level"]) && parseAnySessionIdentity(value.identity) && THINKING_LEVELS.includes(value.level) ? value : null;
3327
- case "set-system-prompt":
3328
- return hasExactKeys(value, ["type", "identity", "systemPrompt"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.systemPrompt) ? value : null;
3329
- case "set-reasoning":
3330
- return hasOnlyKeys(value, ["type", "identity", "enabled", "level"]) && parseAnySessionIdentity(value.identity) && typeof value.enabled === "boolean" && (value.level === void 0 || THINKING_LEVELS.includes(value.level)) ? value : null;
3331
- case "approval-respond":
3332
- return hasExactKeys(value, ["type", "identity", "requestId", "decision"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.requestId) && isApprovalDecision(value.decision) ? value : null;
3333
- case "request-timeout":
3334
- return hasExactKeys(value, ["type", "identity", "kind", "requestId"]) && parseAnySessionIdentity(value.identity) && (value.kind === "approval" || value.kind === "ask") && isNonEmptyString(value.requestId) ? value : null;
3335
- case "agent-notify":
3336
- return hasExactKeys(value, ["type", "identity", "text", "urgent"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.text) && typeof value.urgent === "boolean" ? value : null;
3337
- case "set-approval-mode":
3338
- return hasOnlyKeys(value, ["type", "identity", "mode", "autoReject"]) && parseAnySessionIdentity(value.identity) && APPROVAL_MODES.includes(value.mode) && (value.autoReject === void 0 || typeof value.autoReject === "boolean") ? value : null;
3339
- case "set-ask-relay":
3340
- return hasOnlyKeys(value, ["type", "identity", "relay"]) && parseAnySessionIdentity(value.identity) && (value.relay === void 0 || isRecord(value.relay) && isNonEmptyString(value.relay.name)) ? value : null;
3341
- case "set-plan-mode":
3342
- return hasExactKeys(value, ["type", "identity", "active"]) && parseSessionIdentity(value.identity) && typeof value.active === "boolean" ? value : null;
3343
- case "plan-respond":
3344
- return hasOnlyKeys(value, ["type", "identity", "planId", "action", "feedback"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.planId) && PLAN_RESPOND_ACTIONS.includes(value.action) && (value.feedback === void 0 || typeof value.feedback === "string" && value.feedback.length <= PLAN_FEEDBACK_MAX) ? value : null;
3345
- case "set-approval-reviewer":
3346
- return hasOnlyKeys(value, ["type", "model", "classifier", "managed", "allowThreshold"]) && (value.allowThreshold === void 0 || isApprovalAllowThreshold(value.allowThreshold) && value.classifier !== void 0) && (value.model === void 0 || parseSpawnModelConfig(value.model)) && (value.classifier === void 0 || value.model === void 0 && parseClassifierCredentials(value.classifier)) && (value.managed === void 0 || value.managed === true && value.classifier !== void 0) ? value : null;
3347
- case "set-compact-route":
3348
- return hasOnlyKeys(value, ["type", "model", "mode"]) && (value.model === void 0 || parseSpawnModelConfig(value.model) !== null) && (value.mode === void 0 || parseSmartCompactMode(value.mode) !== null) ? value : null;
3349
- case "set-max-active-coworkers":
3350
- return hasExactKeys(value, ["type", "limit"]) && parseMaxActiveCoworkers(value.limit) !== null ? value : null;
3351
- case "set-auto-retry-limit":
3352
- return hasExactKeys(value, ["type", "limit"]) && parseAutoRetryLimit(value.limit) !== null ? value : null;
3353
- case "set-shell-limits":
3354
- return hasExactKeys(value, ["type", "limits"]) && isRecord(value.limits) && JSON.stringify(resolveShellLimits(value.limits)) === JSON.stringify(value.limits) ? value : null;
3355
- case "set-privacy-masking":
3356
- return hasExactKeys(value, ["type", "settings"]) && JSON.stringify(parsePrivacyMaskSettings(value.settings)) === JSON.stringify(value.settings) ? value : null;
3357
- case "set-image-generation-config":
3358
- return hasOnlyKeys(value, ["type", "config", "error"]) && (value.config === null || parseImageGenerationConfig(value.config) !== null) && (value.error === void 0 || typeof value.error === "string" && value.error.length <= 1024) ? value : null;
3359
- case "set-web-search-config":
3360
- return hasOnlyKeys(value, ["type", "chain", "configured"]) && (value.configured === void 0 || typeof value.configured === "boolean") && Array.isArray(value.chain) && value.chain.length <= WEB_SEARCH_CHAIN_MAX && value.chain.every(isWebSearchChainEntry) ? value : null;
3361
- case "set-disabled-workflow-presets":
3362
- return hasExactKeys(value, ["type", "ids"]) && Array.isArray(value.ids) && value.ids.length <= 64 && value.ids.every((id) => typeof id === "string" && isWorkflowPresetId(id)) ? value : null;
3363
- case "set-builtin-tools":
3364
- return hasExactKeys(value, ["type", "identity", "disabledTools"]) && parseSessionIdentity(value.identity) && Array.isArray(value.disabledTools) && value.disabledTools.length <= 64 && value.disabledTools.every(
3365
- (id) => typeof id === "string" && id.length > 0 && id.length <= 64
3366
- ) ? value : null;
3367
- case "set-model-directory":
3368
- return hasExactKeys(value, ["type", "snapshot", "customProviders"]) ? value : null;
3369
- case "ask-respond":
3370
- return hasOnlyKeys(value, ["type", "identity", "requestId", "answer", "by", "name"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.requestId) && isNonEmptyString(value.answer) && (value.by === void 0 || value.by === "user" || value.by === "relay") && (value.name === void 0 || isNonEmptyString(value.name)) ? value : null;
3371
- case "browser-result":
3372
- case "memory-result":
3373
- case "delegation-result":
3374
- case "computer-result":
3375
- case "plugin-tool-result": {
3376
- if (!hasOnlyKeys(value, ["type", "identity", "requestId", "ok", "result", "error"]) || !parseAnySessionIdentity(value.identity) || !isNonEmptyString(value.requestId) || typeof value.ok !== "boolean") {
3377
- return null;
3378
- }
3379
- const shapeOk = value.ok ? value.error === void 0 : isNonEmptyString(value.error) && value.result === void 0;
3380
- return shapeOk ? value : null;
3381
- }
3382
- case "secretary-result": {
3383
- if (!hasOnlyKeys(value, ["type", "identity", "requestId", "ok", "result", "error"]) || !parseSessionIdentity(value.identity) || !isNonEmptyString(value.requestId) || typeof value.ok !== "boolean") {
3384
- return null;
3385
- }
3386
- const shapeOk = value.ok ? value.error === void 0 : isNonEmptyString(value.error) && value.result === void 0;
3387
- return shapeOk ? value : null;
3388
- }
3389
- case "plugin-intercept-result": {
3390
- if (!hasOnlyKeys(value, ["type", "identity", "requestId", "ok", "result", "error"]) || !parseSessionIdentity(value.identity) || !isNonEmptyString(value.requestId) || typeof value.ok !== "boolean") {
3391
- return null;
3392
- }
3393
- const shapeOk = value.ok ? value.error === void 0 : isNonEmptyString(value.error) && value.result === void 0;
3394
- return shapeOk ? value : null;
3395
- }
3396
- case "plugin-tool-progress":
3397
- return hasExactKeys(value, ["type", "identity", "requestId", "text"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && isBoundedText(value.text, PLUGIN_PROGRESS_MAX_CHARS) ? value : null;
3398
- case "plugin-inject":
3399
- return hasOnlyKeys(value, [...PLUGIN_INJECT_KEYS, "images"]) && PLUGIN_INJECT_KEYS.every((key) => key in value) && parsePluginInjectImages(value.images) !== null && parseSessionIdentity(value.identity) && isNonEmptyString(value.pluginId) && value.pluginId.length <= 128 && isNonEmptyString(value.pluginName) && value.pluginName.length <= 256 && isNonEmptyString(value.text) && isBoundedText(value.text, PLUGIN_INJECT_MAX_CHARS) && (value.deliverAs === "steer" || value.deliverAs === "followUp" || value.deliverAs === "nextTurn") && typeof value.triggerTurn === "boolean" ? value : null;
3400
- case "workflow-stop":
3401
- return hasExactKeys(value, ["type", "identity", "runId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.runId) && value.runId.length <= 80 ? value : null;
3402
- case "task-stop":
3403
- return hasExactKeys(value, ["type", "identity", "taskId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.taskId) ? value : null;
3404
- case "tool-background":
3405
- return hasExactKeys(value, ["type", "identity", "toolCallId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.toolCallId) && value.toolCallId.length <= 512 ? value : null;
3406
- case "subagent-stop":
3407
- return hasExactKeys(value, ["type", "identity", "agentId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.agentId) ? value : null;
3408
- case "compact":
3409
- return hasOnlyKeys(value, ["type", "identity", "instructions"]) && parseAnySessionIdentity(value.identity) && (value.instructions === void 0 || isNonEmptyString(value.instructions)) ? value : null;
3410
- case "rewind":
3411
- return hasOnlyKeys(value, [
3412
- "type",
3413
- "identity",
3414
- "entryId",
3415
- "userIndexFromEnd",
3416
- "restoreFiles"
3417
- ]) && parseAnySessionIdentity(value.identity) && (value.entryId !== void 0 ? isNonEmptyString(value.entryId) && value.entryId.trim().length > 0 && value.userIndexFromEnd === void 0 : isSequence(value.userIndexFromEnd)) && (value.restoreFiles === void 0 || typeof value.restoreFiles === "boolean") ? value : null;
3418
- case "fork": {
3419
- const hasEntry = typeof value.entryId === "string";
3420
- const hasIndex = typeof value.userIndexFromEnd === "number";
3421
- return hasOnlyKeys(value, [
3422
- "type",
3423
- "identity",
3424
- "targetConversationId",
3425
- "entryId",
3426
- "userIndexFromEnd"
3427
- ]) && parseAnySessionIdentity(value.identity) && isUuid(value.targetConversationId) && (hasEntry ? !hasIndex && isNonEmptyString(value.entryId) : hasIndex && isSequence(value.userIndexFromEnd)) ? value : null;
3428
- }
3429
- case "abort":
3430
- case "abort-retry":
3431
- case "release-parent":
3432
- return hasExactKeys(value, ["type", "identity"]) && parseAnySessionIdentity(value.identity) ? value : null;
3433
- case "withdraw-steer":
3434
- return hasExactKeys(value, ["type", "identity", "deliveryId"]) && parseAnySessionIdentity(value.identity) && isDeliveryId(value.deliveryId) ? value : null;
3435
- case "retry":
3436
- return hasOnlyKeys(value, ["type", "identity", "instanceId", "unfinishedOnly"]) && parseAnySessionIdentity(value.identity) && (value.unfinishedOnly === void 0 || value.unfinishedOnly === true) && (value.instanceId === void 0 || isUuid(value.instanceId) && parseSessionIdentity(value.identity) !== null) ? value : null;
3437
- case "append-session-custom-entry":
3438
- return hasExactKeys(value, ["type", "identity", "entry"]) && parseAnySessionIdentity(value.identity) && parseAgentSessionCustomEntry(value.entry) ? value : null;
3439
- case "reload-session":
3440
- return hasExactKeys(value, ["type", "requestId", "sessionId"]) && isNonEmptyString(value.requestId) && isNonEmptyString(value.sessionId) ? value : null;
3441
- case "snapshot":
3442
- if (hasExactKeys(value, ["type"])) return { type: "snapshot" };
3443
- return hasExactKeys(value, ["type", "sessionId"]) && isNonEmptyString(value.sessionId) ? { type: "snapshot", sessionId: value.sessionId } : null;
3444
- case "pin-sessions":
3445
- return hasExactKeys(value, ["type", "sessionIds"]) && Array.isArray(value.sessionIds) && value.sessionIds.every((id) => typeof id === "string") ? { type: "pin-sessions", sessionIds: value.sessionIds } : null;
3446
- case "graceful-restart":
3447
- if (hasExactKeys(value, ["type"])) return { type: "graceful-restart" };
3448
- return hasExactKeys(value, ["type", "keepBackgroundTasks"]) && value.keepBackgroundTasks === true ? { type: "graceful-restart", keepBackgroundTasks: true } : null;
3449
- case "detach-background-tasks":
3450
- return hasExactKeys(value, ["type"]) ? { type: "detach-background-tasks" } : null;
3451
- case "warm-mcp":
3452
- return hasExactKeys(value, ["type", "servers"]) && Array.isArray(value.servers) ? value : null;
3453
- case "plugin-mcp-list":
3454
- return hasExactKeys(value, ["type", "requestId", "servers"]) && isNonEmptyString(value.requestId) && Array.isArray(value.servers) ? value : null;
3455
- case "plugin-mcp-call":
3456
- return hasExactKeys(value, ["type", "requestId", "servers", "server", "tool", "args"]) && isNonEmptyString(value.requestId) && Array.isArray(value.servers) && isNonEmptyString(value.server) && isNonEmptyString(value.tool) && isRecord(value.args) ? value : null;
3457
- case "plugin-mcp-cancel":
3458
- return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? { type: "plugin-mcp-cancel", requestId: value.requestId } : null;
3459
- case "plugin-agent-run":
3460
- return hasOnlyKeys(value, [
3461
- "type",
3462
- "requestId",
3463
- "identity",
3464
- "prompt",
3465
- "systemPrompt",
3466
- "context",
3467
- "timeoutMs",
3468
- "model"
3469
- ]) && isNonEmptyString(value.requestId) && parseSessionIdentity(value.identity) && isNonEmptyString(value.prompt) && isBoundedText(value.prompt, PLUGIN_AGENT_PROMPT_MAX_CHARS) && (value.systemPrompt === void 0 || typeof value.systemPrompt === "string" && isBoundedText(value.systemPrompt, PLUGIN_AGENT_SYSTEM_MAX_CHARS)) && (value.context === "conversation" || value.context === "fork" || value.context === "none") && Number.isInteger(value.timeoutMs) && value.timeoutMs > 0 && value.timeoutMs <= PLUGIN_AGENT_MAX_TIMEOUT_MS && (value.model === void 0 || parseSpawnModelConfig(value.model) !== null) ? value : null;
3470
- case "plugin-agent-cancel":
3471
- return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? { type: "plugin-agent-cancel", requestId: value.requestId } : null;
3472
- case "set-proxy-env": {
3473
- if (!hasExactKeys(value, ["type", "env"]) || !isRecord(value.env)) return null;
3474
- for (const entry of Object.values(value.env)) {
3475
- if (entry !== null && typeof entry !== "string") return null;
3476
- }
3477
- return value;
3257
+ },
3258
+ "lock-workspace": parseWorkspaceLockCommand,
3259
+ "unlock-workspace": parseWorkspaceLockCommand,
3260
+ "spawn-parent": (value) => {
3261
+ if (!hasOnlyKeys(value, [
3262
+ "type",
3263
+ "identity",
3264
+ "cwd",
3265
+ "model",
3266
+ "resumeFile",
3267
+ "reasoningEnabled",
3268
+ "thinkingLevel",
3269
+ "loadLocalSkills",
3270
+ "loadHarnessAssets",
3271
+ "trustedProjectCode",
3272
+ "exploreFoldEnabled",
3273
+ "editMode",
3274
+ "hashlineEditEnabled",
3275
+ "compactStrategy",
3276
+ "smartCompactEnabled",
3277
+ "smartCompactSummaryModel",
3278
+ "smartCompactMode",
3279
+ "memoryLanguage",
3280
+ "skillPaths",
3281
+ "mcpServers",
3282
+ "pluginTools",
3283
+ "secretaryTools",
3284
+ "workflowPresetFiles",
3285
+ "pluginEvents",
3286
+ "instruction",
3287
+ "approvalMode",
3288
+ "autoRejectApprovals",
3289
+ "askRelay",
3290
+ "approvalReviewer",
3291
+ "approvalReviewerClassifier",
3292
+ "approvalReviewerManaged",
3293
+ "approvalReviewerAllowThreshold",
3294
+ "agentTypes",
3295
+ "subagentModels",
3296
+ "disabledTools",
3297
+ "windowsLocalShell",
3298
+ "rtkEnabled",
3299
+ "dcgPath",
3300
+ "remote",
3301
+ "rolePrompt",
3302
+ "systemPrompt",
3303
+ "systemPromptAppend",
3304
+ "systemPromptBoost",
3305
+ "refusalRetryPrompt",
3306
+ "botMode",
3307
+ "botGroupTasks",
3308
+ "botDiscussMode",
3309
+ "botRoutines",
3310
+ "secretaryMode",
3311
+ "botDelegationTask",
3312
+ "botWriteLock",
3313
+ "protectedActions",
3314
+ "planMode",
3315
+ "instanceId"
3316
+ ]) || !parseSessionIdentity(value.identity) || typeof value.cwd !== "string" || !parseSessionModelConfig(value.model) || value.resumeFile !== void 0 && !isNonEmptyString(value.resumeFile) || value.loadHarnessAssets !== void 0 && typeof value.loadHarnessAssets !== "boolean" || value.trustedProjectCode !== void 0 && !(Array.isArray(value.trustedProjectCode) && value.trustedProjectCode.length <= 500 && value.trustedProjectCode.every(
3317
+ (entry) => typeof entry === "string" && entry.length > 0 && entry.length <= 1024
3318
+ )) || value.pluginTools !== void 0 && !isPluginToolList(value.pluginTools) || value.secretaryTools !== void 0 && parseSecretaryToolDescriptors(value.secretaryTools) === null || value.workflowPresetFiles !== void 0 && !(Array.isArray(value.workflowPresetFiles) && value.workflowPresetFiles.length <= 500 && value.workflowPresetFiles.every(
3319
+ (entry) => typeof entry === "string" && entry.length > 0 && entry.length <= 1024
3320
+ )) || value.pluginEvents !== void 0 && !isPluginEventPlan(value.pluginEvents) || value.rtkEnabled !== void 0 && typeof value.rtkEnabled !== "boolean" || value.dcgPath !== void 0 && !isNonEmptyString(value.dcgPath) || value.planMode !== void 0 && typeof value.planMode !== "boolean" || value.windowsLocalShell !== void 0 && !WINDOWS_LOCAL_SHELLS.includes(value.windowsLocalShell) || value.exploreFoldEnabled !== void 0 && typeof value.exploreFoldEnabled !== "boolean" || value.editMode !== void 0 && !isEditMode(value.editMode) || value.hashlineEditEnabled !== void 0 && typeof value.hashlineEditEnabled !== "boolean" || value.compactStrategy !== void 0 && parseCompactStrategy(value.compactStrategy) === null || value.smartCompactEnabled !== void 0 && typeof value.smartCompactEnabled !== "boolean" || value.smartCompactSummaryModel !== void 0 && parseSpawnModelConfig(value.smartCompactSummaryModel) === null || value.smartCompactMode !== void 0 && parseSmartCompactMode(value.smartCompactMode) === null || value.memoryLanguage !== void 0 && typeof value.memoryLanguage !== "string" || value.remote !== void 0 && parseAgentRemoteConfig(value.remote) === null || value.subagentModels !== void 0 && (!Array.isArray(value.subagentModels) || value.subagentModels.some((entry) => parseSubagentModelOption(entry) === null)) || value.approvalReviewer !== void 0 && parseSpawnModelConfig(value.approvalReviewer) === null || value.askRelay !== void 0 && (!isRecord(value.askRelay) || !isNonEmptyString(value.askRelay.name)) || value.approvalReviewerAllowThreshold !== void 0 && (!isApprovalAllowThreshold(value.approvalReviewerAllowThreshold) || value.approvalReviewerClassifier === void 0) || value.approvalReviewerManaged !== void 0 && (value.approvalReviewerManaged !== true || value.approvalReviewerClassifier === void 0) || value.approvalReviewerClassifier !== void 0 && (value.approvalReviewer !== void 0 || !parseClassifierCredentials(value.approvalReviewerClassifier)) || value.rolePrompt !== void 0 && !isNonEmptyString(value.rolePrompt) || value.systemPrompt !== void 0 && !isNonEmptyString(value.systemPrompt) || value.systemPromptAppend !== void 0 && !isNonEmptyString(value.systemPromptAppend) || value.systemPromptBoost !== void 0 && !isNonEmptyString(value.systemPromptBoost) || value.refusalRetryPrompt !== void 0 && !isNonEmptyString(value.refusalRetryPrompt) || value.botMode !== void 0 && typeof value.botMode !== "boolean" || value.botGroupTasks !== void 0 && typeof value.botGroupTasks !== "boolean" || value.botDiscussMode !== void 0 && typeof value.botDiscussMode !== "boolean" || value.botDiscussMode === true && (value.botMode !== true || value.botGroupTasks !== true) || value.botRoutines !== void 0 && typeof value.botRoutines !== "boolean" || value.secretaryMode !== void 0 && typeof value.secretaryMode !== "boolean" || value.botDelegationTask !== void 0 && typeof value.botDelegationTask !== "boolean" || value.botWriteLock !== void 0 && (!isRecord(value.botWriteLock) || !isNonEmptyString(value.botWriteLock.label) || !Array.isArray(value.botWriteLock.ancestors) || !value.botWriteLock.ancestors.every(isNonEmptyString)) || value.protectedActions !== void 0 && typeof value.protectedActions !== "boolean" || value.instanceId !== void 0 && !isUuid(value.instanceId)) {
3321
+ return null;
3478
3322
  }
3479
- default:
3323
+ return value;
3324
+ },
3325
+ "spawn-child": (value) => {
3326
+ return hasOnlyKeys(value, ["type", "identity", "cwd", "config", "resumeFile"]) && parseChildSessionIdentity(value.identity) && typeof value.cwd === "string" && parseResolvedAgentTypeSpawnConfig(value.config) && (value.resumeFile === void 0 || isNonEmptyString(value.resumeFile)) ? value : null;
3327
+ },
3328
+ "prompt-child": (value) => {
3329
+ return hasOnlyKeys(value, ["type", "identity", "requestId", "task", "requestBudget"]) && parseChildSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && parseAgentDispatchTask(value.task) && (value.requestBudget === void 0 || value.requestBudget === true) ? value : null;
3330
+ },
3331
+ "agent-control-result": (value) => {
3332
+ return hasExactKeys(value, ["type", "identity", "requestId", "response"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.requestId) && parseAgentControlToolResponse(value.response) ? value : null;
3333
+ },
3334
+ "dismiss-child": (value) => {
3335
+ const parent = parseSessionIdentity(value.parent);
3336
+ const child = parseChildSessionIdentity(value.child);
3337
+ return hasOnlyKeys(value, ["type", "parent", "child", "notify"]) && parent && child && child.parent.sessionId === parent.sessionId && child.parent.generation === parent.generation && (value.notify === void 0 || typeof value.notify === "boolean") ? value : null;
3338
+ },
3339
+ "dismiss-coworker": (value) => {
3340
+ const parent = parseSessionIdentity(value.parent);
3341
+ return hasOnlyKeys(value, ["type", "parent", "coworkerId", "notify"]) && parent && isNonEmptyString(value.coworkerId) && // 归属校验:coworker id 恒为 `父id::cw-…`,防跨会话误解雇
3342
+ value.coworkerId.startsWith(`${parent.sessionId}::cw-`) && (value.notify === void 0 || typeof value.notify === "boolean") ? value : null;
3343
+ },
3344
+ "resume-coworker": (value) => {
3345
+ const parent = parseSessionIdentity(value.parent);
3346
+ return hasOnlyKeys(value, [
3347
+ "type",
3348
+ "parent",
3349
+ "coworkerId",
3350
+ "name",
3351
+ "agentType",
3352
+ "resumeFile"
3353
+ ]) && parent && isNonEmptyString(value.coworkerId) && value.coworkerId.startsWith(`${parent.sessionId}::cw-`) && isNonEmptyString(value.name) && (value.agentType === void 0 || isNonEmptyString(value.agentType)) && isNonEmptyString(value.resumeFile) ? value : null;
3354
+ },
3355
+ "complete-text": (value) => {
3356
+ return hasOnlyKeys(value, [
3357
+ "type",
3358
+ "requestId",
3359
+ "systemPrompt",
3360
+ "userText",
3361
+ "candidates",
3362
+ "timeoutMs",
3363
+ "maxTokens",
3364
+ "stream",
3365
+ "reasoning",
3366
+ "probe"
3367
+ ]) && isNonEmptyString(value.requestId) && typeof value.systemPrompt === "string" && typeof value.userText === "string" && typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs) && value.timeoutMs > 0 && (value.maxTokens === void 0 || typeof value.maxTokens === "number" && Number.isInteger(value.maxTokens) && value.maxTokens > 0) && (value.stream === void 0 || value.stream === true) && (value.reasoning === void 0 || value.reasoning === "off" || THINKING_LEVELS.includes(value.reasoning)) && (value.probe === void 0 || value.probe === true) && Array.isArray(value.candidates) && value.candidates.length >= 1 && value.candidates.length <= TITLE_SUMMARY_MAX_CANDIDATES && value.candidates.every((candidate) => parseSpawnModelConfig(candidate)) ? value : null;
3368
+ },
3369
+ "abort-complete-text": (value) => {
3370
+ return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3371
+ },
3372
+ "classify-choice": (value) => {
3373
+ return hasExactKeys(value, [
3374
+ "type",
3375
+ "requestId",
3376
+ "classifier",
3377
+ "state",
3378
+ "instructions",
3379
+ "criteria",
3380
+ "timeoutMs"
3381
+ ]) && isNonEmptyString(value.requestId) && parseClassifierCredentials(value.classifier) && isRecord(value.state) && isNonEmptyString(value.instructions) && isRecord(value.criteria) && Object.keys(value.criteria).length > 0 && Object.values(value.criteria).every(isNonEmptyString) && typeof value.timeoutMs === "number" && Number.isFinite(value.timeoutMs) && value.timeoutMs > 0 ? value : null;
3382
+ },
3383
+ "abort-classify-choice": (value) => {
3384
+ return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3385
+ },
3386
+ "summarize-title": (value) => {
3387
+ return hasExactKeys(value, ["type", "conversationId", "input", "candidates"]) && isNonEmptyString(value.conversationId) && parseTitleSummaryInput(value.input) && Array.isArray(value.candidates) && value.candidates.length >= 1 && value.candidates.length <= TITLE_SUMMARY_MAX_CANDIDATES && value.candidates.every((candidate) => parseSpawnModelConfig(candidate)) ? value : null;
3388
+ },
3389
+ prompt: parsePromptOrSteer,
3390
+ steer: parsePromptOrSteer,
3391
+ "set-model": (value) => {
3392
+ return hasExactKeys(value, ["type", "identity", "model"]) && parseAnySessionIdentity(value.identity) && parseSessionModelConfig(value.model) ? value : null;
3393
+ },
3394
+ "set-thinking": (value) => {
3395
+ return hasExactKeys(value, ["type", "identity", "level"]) && parseAnySessionIdentity(value.identity) && THINKING_LEVELS.includes(value.level) ? value : null;
3396
+ },
3397
+ "set-system-prompt": (value) => {
3398
+ return hasExactKeys(value, ["type", "identity", "systemPrompt"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.systemPrompt) ? value : null;
3399
+ },
3400
+ "set-reasoning": (value) => {
3401
+ return hasOnlyKeys(value, ["type", "identity", "enabled", "level"]) && parseAnySessionIdentity(value.identity) && typeof value.enabled === "boolean" && (value.level === void 0 || THINKING_LEVELS.includes(value.level)) ? value : null;
3402
+ },
3403
+ "approval-respond": (value) => {
3404
+ return hasExactKeys(value, ["type", "identity", "requestId", "decision"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.requestId) && isApprovalDecision(value.decision) ? value : null;
3405
+ },
3406
+ "request-timeout": (value) => {
3407
+ return hasExactKeys(value, ["type", "identity", "kind", "requestId"]) && parseAnySessionIdentity(value.identity) && (value.kind === "approval" || value.kind === "ask") && isNonEmptyString(value.requestId) ? value : null;
3408
+ },
3409
+ "agent-notify": (value) => {
3410
+ return hasExactKeys(value, ["type", "identity", "text", "urgent"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.text) && typeof value.urgent === "boolean" ? value : null;
3411
+ },
3412
+ "set-approval-mode": (value) => {
3413
+ return hasOnlyKeys(value, ["type", "identity", "mode", "autoReject"]) && parseAnySessionIdentity(value.identity) && APPROVAL_MODES.includes(value.mode) && (value.autoReject === void 0 || typeof value.autoReject === "boolean") ? value : null;
3414
+ },
3415
+ "set-ask-relay": (value) => {
3416
+ return hasOnlyKeys(value, ["type", "identity", "relay"]) && parseAnySessionIdentity(value.identity) && (value.relay === void 0 || isRecord(value.relay) && isNonEmptyString(value.relay.name)) ? value : null;
3417
+ },
3418
+ "set-plan-mode": (value) => {
3419
+ return hasExactKeys(value, ["type", "identity", "active"]) && parseSessionIdentity(value.identity) && typeof value.active === "boolean" ? value : null;
3420
+ },
3421
+ "plan-respond": (value) => {
3422
+ return hasOnlyKeys(value, ["type", "identity", "planId", "action", "feedback"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.planId) && PLAN_RESPOND_ACTIONS.includes(value.action) && (value.feedback === void 0 || typeof value.feedback === "string" && value.feedback.length <= PLAN_FEEDBACK_MAX) ? value : null;
3423
+ },
3424
+ "set-approval-reviewer": (value) => {
3425
+ return hasOnlyKeys(value, ["type", "model", "classifier", "managed", "allowThreshold"]) && (value.allowThreshold === void 0 || isApprovalAllowThreshold(value.allowThreshold) && value.classifier !== void 0) && (value.model === void 0 || parseSpawnModelConfig(value.model)) && (value.classifier === void 0 || value.model === void 0 && parseClassifierCredentials(value.classifier)) && (value.managed === void 0 || value.managed === true && value.classifier !== void 0) ? value : null;
3426
+ },
3427
+ "set-compact-route": (value) => {
3428
+ return hasOnlyKeys(value, ["type", "model", "mode"]) && (value.model === void 0 || parseSpawnModelConfig(value.model) !== null) && (value.mode === void 0 || parseSmartCompactMode(value.mode) !== null) ? value : null;
3429
+ },
3430
+ "set-max-active-coworkers": (value) => {
3431
+ return hasExactKeys(value, ["type", "limit"]) && parseMaxActiveCoworkers(value.limit) !== null ? value : null;
3432
+ },
3433
+ "set-auto-retry-limit": (value) => {
3434
+ return hasExactKeys(value, ["type", "limit"]) && parseAutoRetryLimit(value.limit) !== null ? value : null;
3435
+ },
3436
+ "set-long-cache-retention": (value) => {
3437
+ return hasExactKeys(value, ["type", "enabled"]) && typeof value.enabled === "boolean" ? value : null;
3438
+ },
3439
+ "set-shell-limits": (value) => {
3440
+ return hasExactKeys(value, ["type", "limits"]) && isRecord(value.limits) && JSON.stringify(resolveShellLimits(value.limits)) === JSON.stringify(value.limits) ? value : null;
3441
+ },
3442
+ "set-privacy-masking": (value) => {
3443
+ return hasExactKeys(value, ["type", "settings"]) && JSON.stringify(parsePrivacyMaskSettings(value.settings)) === JSON.stringify(value.settings) ? value : null;
3444
+ },
3445
+ "set-image-generation-config": (value) => {
3446
+ return hasOnlyKeys(value, ["type", "config", "error"]) && (value.config === null || parseImageGenerationConfig(value.config) !== null) && (value.error === void 0 || typeof value.error === "string" && value.error.length <= 1024) ? value : null;
3447
+ },
3448
+ "set-web-search-config": (value) => {
3449
+ return hasOnlyKeys(value, ["type", "chain", "configured"]) && (value.configured === void 0 || typeof value.configured === "boolean") && Array.isArray(value.chain) && value.chain.length <= WEB_SEARCH_CHAIN_MAX && value.chain.every(isWebSearchChainEntry) ? value : null;
3450
+ },
3451
+ "set-disabled-workflow-presets": (value) => {
3452
+ return hasExactKeys(value, ["type", "ids"]) && Array.isArray(value.ids) && value.ids.length <= 64 && value.ids.every((id) => typeof id === "string" && isWorkflowPresetId(id)) ? value : null;
3453
+ },
3454
+ "set-builtin-tools": (value) => {
3455
+ return hasExactKeys(value, ["type", "identity", "disabledTools"]) && parseSessionIdentity(value.identity) && Array.isArray(value.disabledTools) && value.disabledTools.length <= 64 && value.disabledTools.every((id) => typeof id === "string" && id.length > 0 && id.length <= 64) ? value : null;
3456
+ },
3457
+ "set-model-directory": (value) => {
3458
+ return hasExactKeys(value, ["type", "snapshot", "customProviders"]) ? value : null;
3459
+ },
3460
+ "ask-respond": (value) => {
3461
+ return hasOnlyKeys(value, ["type", "identity", "requestId", "answer", "by", "name"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.requestId) && isNonEmptyString(value.answer) && (value.by === void 0 || value.by === "user" || value.by === "relay") && (value.name === void 0 || isNonEmptyString(value.name)) ? value : null;
3462
+ },
3463
+ "browser-result": parseHostResultCommand,
3464
+ "memory-result": parseHostResultCommand,
3465
+ "delegation-result": parseHostResultCommand,
3466
+ "computer-result": parseHostResultCommand,
3467
+ "plugin-tool-result": parseHostResultCommand,
3468
+ "secretary-result": (value) => {
3469
+ if (!hasOnlyKeys(value, ["type", "identity", "requestId", "ok", "result", "error"]) || !parseSessionIdentity(value.identity) || !isNonEmptyString(value.requestId) || typeof value.ok !== "boolean") {
3480
3470
  return null;
3481
- }
3482
- }
3483
- function parseLifecycleEvent(value) {
3484
- const identity = value.type === "child-reserved" || value.type === "child-ready" || value.type === "child-rejected" || value.type === "child-ended" ? parseChildSessionIdentity(value.identity) : parseSessionIdentity(value.identity);
3485
- if (!identity || !isSequence(value.seq)) return null;
3486
- switch (value.type) {
3487
- case "parent-ready":
3488
- return isNonEmptyString(value.sessionFile) && parseModelRef(value.model) ? value : null;
3489
- case "model-changed":
3490
- return parseModelRef(value.model) ? value : null;
3491
- case "parent-rejected":
3492
- case "parent-ended":
3493
- return hasOnlyKeys(value, ["type", "identity", "seq", "reason", "instanceId"]) && isNonEmptyString(value.reason) && (value.instanceId === void 0 || isUuid(value.instanceId)) ? value : null;
3494
- case "child-rejected":
3495
- case "child-ended":
3496
- return isNonEmptyString(value.reason) ? value : null;
3497
- case "child-reserved":
3498
- return isNonEmptyString(value.requestId) && parseChildConversationMetadata(value.metadata) ? value : null;
3499
- case "child-ready": {
3500
- const proof = parseResolvedChildProfileProof(value.proof);
3501
- if (!hasExactKeys(value, ["type", "identity", "seq", "sessionFile", "proof"]) || !isNonEmptyString(value.sessionFile) || !proof || !("typeKey" in identity) || proof.typeKey !== identity.typeKey) {
3502
- return null;
3503
- }
3504
- return value;
3505
3471
  }
3506
- default:
3472
+ const shapeOk = value.ok ? value.error === void 0 : isNonEmptyString(value.error) && value.result === void 0;
3473
+ return shapeOk ? value : null;
3474
+ },
3475
+ "plugin-intercept-result": (value) => {
3476
+ if (!hasOnlyKeys(value, ["type", "identity", "requestId", "ok", "result", "error"]) || !parseSessionIdentity(value.identity) || !isNonEmptyString(value.requestId) || typeof value.ok !== "boolean") {
3507
3477
  return null;
3478
+ }
3479
+ const shapeOk = value.ok ? value.error === void 0 : isNonEmptyString(value.error) && value.result === void 0;
3480
+ return shapeOk ? value : null;
3481
+ },
3482
+ "plugin-tool-progress": (value) => {
3483
+ return hasExactKeys(value, ["type", "identity", "requestId", "text"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && isBoundedText(value.text, PLUGIN_PROGRESS_MAX_CHARS) ? value : null;
3484
+ },
3485
+ "plugin-inject": (value) => {
3486
+ return hasOnlyKeys(value, [...PLUGIN_INJECT_KEYS, "images"]) && PLUGIN_INJECT_KEYS.every((key) => key in value) && parsePluginInjectImages(value.images) !== null && parseSessionIdentity(value.identity) && isNonEmptyString(value.pluginId) && value.pluginId.length <= 128 && isNonEmptyString(value.pluginName) && value.pluginName.length <= 256 && isNonEmptyString(value.text) && isBoundedText(value.text, PLUGIN_INJECT_MAX_CHARS) && (value.deliverAs === "steer" || value.deliverAs === "followUp" || value.deliverAs === "nextTurn") && typeof value.triggerTurn === "boolean" ? value : null;
3487
+ },
3488
+ "workflow-stop": (value) => {
3489
+ return hasExactKeys(value, ["type", "identity", "runId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.runId) && value.runId.length <= 80 ? value : null;
3490
+ },
3491
+ "task-stop": (value) => {
3492
+ return hasExactKeys(value, ["type", "sessionId", "taskId"]) && isNonEmptyString(value.sessionId) && isNonEmptyString(value.taskId) ? value : null;
3493
+ },
3494
+ "task-keep": (value) => {
3495
+ return hasExactKeys(value, ["type", "sessionId", "taskId", "reason"]) && isNonEmptyString(value.sessionId) && isNonEmptyString(value.taskId) && (value.reason === null || typeof value.reason === "string" && value.reason.length <= TASK_KEEP_REASON_MAX) ? value : null;
3496
+ },
3497
+ "tool-background": (value) => {
3498
+ return hasExactKeys(value, ["type", "identity", "toolCallId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.toolCallId) && value.toolCallId.length <= 512 ? value : null;
3499
+ },
3500
+ "subagent-stop": (value) => {
3501
+ return hasExactKeys(value, ["type", "identity", "agentId"]) && parseAnySessionIdentity(value.identity) && isNonEmptyString(value.agentId) ? value : null;
3502
+ },
3503
+ compact: (value) => {
3504
+ return hasOnlyKeys(value, ["type", "identity", "instructions"]) && parseAnySessionIdentity(value.identity) && (value.instructions === void 0 || isNonEmptyString(value.instructions)) ? value : null;
3505
+ },
3506
+ rewind: (value) => {
3507
+ return hasOnlyKeys(value, [
3508
+ "type",
3509
+ "identity",
3510
+ "entryId",
3511
+ "userIndexFromEnd",
3512
+ "restoreFiles"
3513
+ ]) && parseAnySessionIdentity(value.identity) && (value.entryId !== void 0 ? isNonEmptyString(value.entryId) && value.entryId.trim().length > 0 && value.userIndexFromEnd === void 0 : isSequence(value.userIndexFromEnd)) && (value.restoreFiles === void 0 || typeof value.restoreFiles === "boolean") ? value : null;
3514
+ },
3515
+ fork: (value) => {
3516
+ const hasEntry = typeof value.entryId === "string";
3517
+ const hasIndex = typeof value.userIndexFromEnd === "number";
3518
+ return hasOnlyKeys(value, [
3519
+ "type",
3520
+ "identity",
3521
+ "targetConversationId",
3522
+ "entryId",
3523
+ "userIndexFromEnd"
3524
+ ]) && parseAnySessionIdentity(value.identity) && isUuid(value.targetConversationId) && (hasEntry ? !hasIndex && isNonEmptyString(value.entryId) : hasIndex && isSequence(value.userIndexFromEnd)) ? value : null;
3525
+ },
3526
+ abort: parseIdentityOnlyCommand,
3527
+ "abort-retry": parseIdentityOnlyCommand,
3528
+ "release-parent": parseIdentityOnlyCommand,
3529
+ "withdraw-steer": (value) => {
3530
+ return hasExactKeys(value, ["type", "identity", "deliveryId"]) && parseAnySessionIdentity(value.identity) && isDeliveryId(value.deliveryId) ? value : null;
3531
+ },
3532
+ retry: (value) => {
3533
+ return hasOnlyKeys(value, [
3534
+ "type",
3535
+ "identity",
3536
+ "instanceId",
3537
+ "unfinishedOnly",
3538
+ "turnId",
3539
+ "requestBudget",
3540
+ "requestsUsed"
3541
+ ]) && parseAnySessionIdentity(value.identity) && (value.unfinishedOnly === void 0 || value.unfinishedOnly === true) && (value.turnId === void 0 || isNonEmptyString(value.turnId)) && (value.requestBudget === void 0 || value.requestBudget === true) && (value.requestsUsed === void 0 || Number.isInteger(value.requestsUsed) && value.requestsUsed >= 0) && (value.instanceId === void 0 || isUuid(value.instanceId) && parseSessionIdentity(value.identity) !== null) ? value : null;
3542
+ },
3543
+ "append-session-custom-entry": (value) => {
3544
+ return hasExactKeys(value, ["type", "identity", "entry"]) && parseAnySessionIdentity(value.identity) && parseAgentSessionCustomEntry(value.entry) ? value : null;
3545
+ },
3546
+ "reload-session": (value) => {
3547
+ return hasExactKeys(value, ["type", "requestId", "sessionId"]) && isNonEmptyString(value.requestId) && isNonEmptyString(value.sessionId) ? value : null;
3548
+ },
3549
+ snapshot: (value) => {
3550
+ if (hasExactKeys(value, ["type"])) return { type: "snapshot" };
3551
+ return hasExactKeys(value, ["type", "sessionId"]) && isNonEmptyString(value.sessionId) ? { type: "snapshot", sessionId: value.sessionId } : null;
3552
+ },
3553
+ "pin-sessions": (value) => {
3554
+ return hasExactKeys(value, ["type", "sessionIds"]) && Array.isArray(value.sessionIds) && value.sessionIds.every((id) => typeof id === "string") ? { type: "pin-sessions", sessionIds: value.sessionIds } : null;
3555
+ },
3556
+ "graceful-restart": (value) => {
3557
+ if (hasExactKeys(value, ["type"])) return { type: "graceful-restart" };
3558
+ return hasExactKeys(value, ["type", "keepBackgroundTasks"]) && value.keepBackgroundTasks === true ? { type: "graceful-restart", keepBackgroundTasks: true } : null;
3559
+ },
3560
+ "detach-background-tasks": (value) => {
3561
+ return hasExactKeys(value, ["type"]) ? { type: "detach-background-tasks" } : null;
3562
+ },
3563
+ "warm-mcp": (value) => {
3564
+ return hasExactKeys(value, ["type", "servers"]) && Array.isArray(value.servers) ? value : null;
3565
+ },
3566
+ "plugin-mcp-list": (value) => {
3567
+ return hasExactKeys(value, ["type", "requestId", "servers"]) && isNonEmptyString(value.requestId) && Array.isArray(value.servers) ? value : null;
3568
+ },
3569
+ "plugin-mcp-call": (value) => {
3570
+ return hasExactKeys(value, ["type", "requestId", "servers", "server", "tool", "args"]) && isNonEmptyString(value.requestId) && Array.isArray(value.servers) && isNonEmptyString(value.server) && isNonEmptyString(value.tool) && isRecord(value.args) ? value : null;
3571
+ },
3572
+ "plugin-mcp-cancel": (value) => {
3573
+ return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? { type: "plugin-mcp-cancel", requestId: value.requestId } : null;
3574
+ },
3575
+ "plugin-agent-run": (value) => {
3576
+ return hasOnlyKeys(value, [
3577
+ "type",
3578
+ "requestId",
3579
+ "identity",
3580
+ "prompt",
3581
+ "systemPrompt",
3582
+ "context",
3583
+ "timeoutMs",
3584
+ "model"
3585
+ ]) && isNonEmptyString(value.requestId) && parseSessionIdentity(value.identity) && isNonEmptyString(value.prompt) && isBoundedText(value.prompt, PLUGIN_AGENT_PROMPT_MAX_CHARS) && (value.systemPrompt === void 0 || typeof value.systemPrompt === "string" && isBoundedText(value.systemPrompt, PLUGIN_AGENT_SYSTEM_MAX_CHARS)) && (value.context === "conversation" || value.context === "fork" || value.context === "none") && Number.isInteger(value.timeoutMs) && value.timeoutMs > 0 && value.timeoutMs <= PLUGIN_AGENT_MAX_TIMEOUT_MS && (value.model === void 0 || parseSpawnModelConfig(value.model) !== null) ? value : null;
3586
+ },
3587
+ "plugin-agent-cancel": (value) => {
3588
+ return hasExactKeys(value, ["type", "requestId"]) && isNonEmptyString(value.requestId) ? { type: "plugin-agent-cancel", requestId: value.requestId } : null;
3589
+ },
3590
+ "set-proxy-env": (value) => {
3591
+ if (!hasExactKeys(value, ["type", "env"]) || !isRecord(value.env)) return null;
3592
+ for (const entry of Object.values(value.env)) {
3593
+ if (entry !== null && typeof entry !== "string") return null;
3594
+ }
3595
+ return value;
3508
3596
  }
3597
+ };
3598
+ function parseAgentCommand(value) {
3599
+ if (!isRecord(value) || !isNonEmptyString(value.type)) return null;
3600
+ return parseClosed(agentCommandParsers, value.type, value);
3509
3601
  }
3510
3602
  const isOptionalTimestamp = (value) => value === void 0 || typeof value === "number" && Number.isFinite(value);
3511
- function parseAgentWorkerEvent(value) {
3512
- if (!isRecord(value) || !isNonEmptyString(value.type)) return null;
3513
- if (value.type === "privacy-mask-ledger") {
3603
+ const DEFERRED_SESSION_KEYS = /* @__PURE__ */ new Set([
3604
+ "identity",
3605
+ "reason",
3606
+ "toolsInFlight",
3607
+ "toolNames",
3608
+ "undetachableTasks",
3609
+ "reply"
3610
+ ]);
3611
+ function isRestartReplyProgress(value) {
3612
+ return isRecord(value) && Object.keys(value).every(
3613
+ (key) => key === "requestStartMs" || key === "firstTokenMs" || key === "lastOutputMs"
3614
+ ) && isNonNegativeNumber(value.requestStartMs) && (value.firstTokenMs === void 0 || isNonNegativeNumber(value.firstTokenMs)) && (value.lastOutputMs === void 0 || isNonNegativeNumber(value.lastOutputMs));
3615
+ }
3616
+ const parseWorkspaceLockResult = (value) => {
3617
+ return hasOnlyKeys(value, ["type", "requestId", "ok", "error"]) && isNonEmptyString(value.requestId) && (value.ok === true ? value.error === void 0 : value.ok === false && isNonEmptyString(value.error)) ? value : null;
3618
+ };
3619
+ const parseParentLifecycleEnd = requireEventIdentity(
3620
+ "parent",
3621
+ (value) => {
3622
+ return hasOnlyKeys(value, ["type", "identity", "seq", "reason", "instanceId"]) && isNonEmptyString(value.reason) && (value.instanceId === void 0 || isUuid(value.instanceId)) ? value : null;
3623
+ }
3624
+ );
3625
+ const parseChildLifecycleEnd = requireEventIdentity(
3626
+ "child",
3627
+ (value) => {
3628
+ return isNonEmptyString(value.reason) ? value : null;
3629
+ }
3630
+ );
3631
+ const parseDeliveryOutcome = requireEventIdentity(
3632
+ "any",
3633
+ (value) => {
3634
+ return hasExactKeys(value, ["type", "identity", "seq", "deliveryId"]) && isDeliveryId(value.deliveryId) ? value : null;
3635
+ }
3636
+ );
3637
+ const parseTaskEvent = requireEventIdentity(
3638
+ "any",
3639
+ (value) => {
3640
+ return isNonEmptyString(value.taskId) ? value : null;
3641
+ }
3642
+ );
3643
+ const agentWorkerEventParsers = {
3644
+ "privacy-mask-ledger": (value) => {
3514
3645
  const record2 = parsePrivacyMaskRecord(value.record);
3515
3646
  return hasExactKeys(value, ["type", "record"]) && record2 ? { type: "privacy-mask-ledger", record: record2 } : null;
3516
- }
3517
- if (value.type === "oauth-pool-select") {
3647
+ },
3648
+ "oauth-pool-select": (value) => {
3518
3649
  return hasOnlyKeys(value, [
3519
3650
  "type",
3520
3651
  "requestId",
@@ -3523,36 +3654,32 @@ function parseAgentWorkerEvent(value) {
3523
3654
  "failed",
3524
3655
  "excludedAccountKeys"
3525
3656
  ]) && isNonEmptyString(value.requestId) && isNonEmptyString(value.settingsProviderId) && isNonEmptyString(value.modelId) && (value.excludedAccountKeys === void 0 || Array.isArray(value.excludedAccountKeys) && value.excludedAccountKeys.length <= 100 && value.excludedAccountKeys.every(isCodexAccountKey)) && (value.failed === void 0 || parseOauthPoolFailure(value.failed) !== null) ? value : null;
3526
- }
3527
- if (value.type === "parent-ready" || value.type === "model-changed" || value.type === "parent-rejected" || value.type === "parent-ended" || value.type === "child-reserved" || value.type === "child-ready" || value.type === "child-rejected" || value.type === "child-ended") {
3528
- return parseLifecycleEvent(value);
3529
- }
3530
- if (value.type === "workspace-lock-result" || value.type === "workspace-unlock-result") {
3531
- return hasOnlyKeys(value, ["type", "requestId", "ok", "error"]) && isNonEmptyString(value.requestId) && (value.ok === true ? value.error === void 0 : value.ok === false && isNonEmptyString(value.error)) ? value : null;
3532
- }
3533
- if (value.type === "plugin-mcp-result") {
3657
+ },
3658
+ "workspace-lock-result": parseWorkspaceLockResult,
3659
+ "workspace-unlock-result": parseWorkspaceLockResult,
3660
+ "plugin-mcp-result": (value) => {
3534
3661
  if (!isNonEmptyString(value.requestId)) return null;
3535
3662
  if (value.ok === true)
3536
3663
  return hasExactKeys(value, ["type", "requestId", "ok", "value"]) ? value : null;
3537
3664
  return value.ok === false && hasExactKeys(value, ["type", "requestId", "ok", "error"]) && isNonEmptyString(value.error) ? value : null;
3538
- }
3539
- if (value.type === "plugin-agent-event") {
3665
+ },
3666
+ "plugin-agent-event": (value) => {
3540
3667
  if (!hasExactKeys(value, ["type", "requestId", "event"]) || !isNonEmptyString(value.requestId))
3541
3668
  return null;
3542
3669
  const event = parsePluginAgentRunEvent(value.event);
3543
3670
  return event ? { type: "plugin-agent-event", requestId: value.requestId, event } : null;
3544
- }
3545
- if (value.type === "session-reloaded") {
3671
+ },
3672
+ "session-reloaded": (value) => {
3546
3673
  if (!hasExactKeys(value, ["type", "requestId", "result"]) || !isNonEmptyString(value.requestId) || !isRecord(value.result))
3547
3674
  return null;
3548
3675
  const result = value.result;
3549
3676
  const valid = result.ok === true ? hasExactKeys(result, ["ok", "snapshot", "seq"]) && parseSessionSnapshot(result.snapshot) !== null && isSequence(result.seq) : result.ok === false && hasExactKeys(result, ["ok", "error"]) && isNonEmptyString(result.error);
3550
3677
  return valid ? value : null;
3551
- }
3552
- if (value.type === "snapshot") {
3678
+ },
3679
+ snapshot: (value) => {
3553
3680
  return Array.isArray(value.sessions) && value.sessions.every((session) => parseSessionSnapshot(session) !== null) ? value : null;
3554
- }
3555
- if (value.type === "mcp-status") {
3681
+ },
3682
+ "mcp-status": (value) => {
3556
3683
  return hasOnlyKeys(value, [
3557
3684
  "type",
3558
3685
  "serverId",
@@ -3562,72 +3689,146 @@ function parseAgentWorkerEvent(value) {
3562
3689
  "error",
3563
3690
  "scopeChallenge"
3564
3691
  ]) && (value.scopeChallenge === void 0 || isMcpScopeChallenge(value.scopeChallenge)) && isNonEmptyString(value.serverName) && (value.serverId === void 0 || isNonEmptyString(value.serverId)) && (value.toolCount === void 0 || isSequence(value.toolCount)) && (value.error === void 0 || typeof value.error === "string") && MCP_CONNECTION_STATES.includes(value.state) ? value : null;
3565
- }
3566
- if (value.type === "mcp-oauth-refresh") {
3692
+ },
3693
+ "mcp-oauth-refresh": (value) => {
3567
3694
  return hasOnlyKeys(value, ["type", "requestId", "serverId", "rejected"]) && isNonEmptyString(value.requestId) && isNonEmptyString(value.serverId) && (value.rejected === void 0 || isNonEmptyString(value.rejected)) ? value : null;
3568
- }
3569
- if (value.type === "title-generated") {
3695
+ },
3696
+ "title-generated": (value) => {
3570
3697
  return hasExactKeys(value, ["type", "conversationId", "title"]) && isNonEmptyString(value.conversationId) && isNonEmptyString(value.title) ? value : null;
3571
- }
3572
- if (value.type === "title-failed") {
3698
+ },
3699
+ "title-failed": (value) => {
3573
3700
  return hasExactKeys(value, ["type", "conversationId", "error"]) && isNonEmptyString(value.conversationId) && isNonEmptyString(value.error) ? value : null;
3574
- }
3575
- if (value.type === "tool-batch-completed") {
3701
+ },
3702
+ "tool-batch-completed": (value) => {
3576
3703
  return hasExactKeys(value, ["type", "identity", "digest"]) && parseSessionIdentity(value.identity) && parseToolBatchDigest(value.digest) ? value : null;
3577
- }
3578
- if (value.type === "graceful-restart-deferred") {
3704
+ },
3705
+ "graceful-restart-deferred": (value) => {
3579
3706
  return hasExactKeys(value, ["type", "sessions"]) && Array.isArray(value.sessions) && value.sessions.every(
3580
- (entry) => isRecord(entry) && (hasExactKeys(entry, ["identity", "reason", "toolsInFlight"]) || hasExactKeys(entry, ["identity", "reason", "toolsInFlight", "undetachableTasks"]) && Array.isArray(entry.undetachableTasks) && entry.undetachableTasks.every(isNonEmptyString)) && parseSessionIdentity(entry.identity) && (entry.reason === "tool-in-flight" || entry.reason === "turn-in-progress") && Array.isArray(entry.toolsInFlight) && entry.toolsInFlight.every(isNonEmptyString)
3707
+ (entry) => isRecord(entry) && Object.keys(entry).every((key) => DEFERRED_SESSION_KEYS.has(key)) && (entry.undetachableTasks === void 0 || Array.isArray(entry.undetachableTasks) && entry.undetachableTasks.every(isNonEmptyString)) && (entry.toolNames === void 0 || Array.isArray(entry.toolNames) && entry.toolNames.every(isNonEmptyString)) && (entry.reply === void 0 || isRestartReplyProgress(entry.reply)) && parseSessionIdentity(entry.identity) && (entry.reason === "tool-in-flight" || entry.reason === "turn-in-progress" || entry.reason === "session-starting") && Array.isArray(entry.toolsInFlight) && entry.toolsInFlight.every(isNonEmptyString)
3581
3708
  ) ? value : null;
3582
- }
3583
- if (value.type === "graceful-restart-ready") {
3709
+ },
3710
+ // 断点内容由 Main 用 parseRestartCheckpoint 细验(该函数带 node:fs,渲染层不能引)
3711
+ "graceful-restart-ready": (value) => {
3584
3712
  return hasExactKeys(value, ["type", "checkpoint"]) && isRecord(value.checkpoint) && Array.isArray(value.checkpoint.sessions) ? value : null;
3585
- }
3586
- if (value.type === "background-tasks-detached") {
3713
+ },
3714
+ "background-tasks-detached": (value) => {
3587
3715
  return hasExactKeys(value, ["type", "detached"]) && typeof value.detached === "number" && Number.isInteger(value.detached) && value.detached >= 0 ? value : null;
3588
- }
3589
- if (value.type === "session-wake-requested") {
3716
+ },
3717
+ "session-wake-requested": (value) => {
3590
3718
  return hasExactKeys(value, ["type", "sessionId"]) && isNonEmptyString(value.sessionId) ? value : null;
3591
- }
3592
- if (value.type === "text-delta") {
3719
+ },
3720
+ "unopened-background-tasks": (value) => {
3721
+ return hasExactKeys(value, ["type", "sessionId", "tasks"]) && isNonEmptyString(value.sessionId) && Array.isArray(value.tasks) && value.tasks.every((task) => isRecord(task) && isNonEmptyString(task.taskId)) ? value : null;
3722
+ },
3723
+ "text-delta": (value) => {
3593
3724
  return hasOnlyKeys(value, ["type", "requestId", "text", "thinking"]) && isNonEmptyString(value.requestId) && typeof value.text === "string" && (value.thinking === void 0 || typeof value.thinking === "string") ? value : null;
3594
- }
3595
- if (value.type === "text-completed") {
3725
+ },
3726
+ "text-completed": (value) => {
3596
3727
  return hasExactKeys(value, ["type", "requestId", "text"]) && isNonEmptyString(value.requestId) && typeof value.text === "string" ? value : null;
3597
- }
3598
- if (value.type === "text-failed") {
3728
+ },
3729
+ "text-failed": (value) => {
3599
3730
  return hasExactKeys(value, ["type", "requestId", "error"]) && isNonEmptyString(value.requestId) && isNonEmptyString(value.error) ? value : null;
3600
- }
3601
- if (value.type === "choice-classified") {
3731
+ },
3732
+ "choice-classified": (value) => {
3602
3733
  return hasExactKeys(value, ["type", "requestId", "probabilities"]) && isNonEmptyString(value.requestId) && isRecord(value.probabilities) && Object.values(value.probabilities).every((p) => typeof p === "number" && Number.isFinite(p)) ? value : null;
3603
- }
3604
- if (value.type === "choice-failed") {
3734
+ },
3735
+ "choice-failed": (value) => {
3605
3736
  return hasExactKeys(value, ["type", "requestId", "error"]) && isNonEmptyString(value.requestId) && isNonEmptyString(value.error) ? value : null;
3606
- }
3607
- const identity = parseAnySessionIdentity(value.identity);
3608
- if (!identity || !isSequence(value.seq)) return null;
3609
- switch (value.type) {
3610
- case "request-body": {
3737
+ },
3738
+ "parent-ready": requireEventIdentity(
3739
+ "parent",
3740
+ (value) => {
3741
+ return isNonEmptyString(value.sessionFile) && parseModelRef(value.model) && (value.imageInput === void 0 || typeof value.imageInput === "boolean") ? value : null;
3742
+ }
3743
+ ),
3744
+ "model-changed": requireEventIdentity(
3745
+ "parent",
3746
+ (value) => {
3747
+ return parseModelRef(value.model) && (value.imageInput === void 0 || typeof value.imageInput === "boolean") ? value : null;
3748
+ }
3749
+ ),
3750
+ "parent-rejected": parseParentLifecycleEnd,
3751
+ "parent-ended": parseParentLifecycleEnd,
3752
+ "child-rejected": parseChildLifecycleEnd,
3753
+ "child-ended": parseChildLifecycleEnd,
3754
+ "child-reserved": requireEventIdentity(
3755
+ "child",
3756
+ (value) => {
3757
+ return isNonEmptyString(value.requestId) && parseChildConversationMetadata(value.metadata) ? value : null;
3758
+ }
3759
+ ),
3760
+ "child-ready": requireEventIdentity(
3761
+ "child",
3762
+ (value) => {
3763
+ const proof = parseResolvedChildProfileProof(value.proof);
3764
+ const identity = parseChildSessionIdentity(value.identity);
3765
+ if (!identity) return null;
3766
+ if (!hasExactKeys(value, ["type", "identity", "seq", "sessionFile", "proof"]) || !isNonEmptyString(value.sessionFile) || !proof || !("typeKey" in identity) || proof.typeKey !== identity.typeKey) {
3767
+ return null;
3768
+ }
3769
+ return value;
3770
+ }
3771
+ ),
3772
+ "request-body": requireEventIdentity(
3773
+ "any",
3774
+ (value) => {
3775
+ const identity = parseAnySessionIdentity(value.identity);
3776
+ if (!identity || !isSequence(value.seq)) return null;
3611
3777
  const usage = parseRequestBodyUsage(value.usage);
3612
3778
  return hasExactKeys(value, ["type", "identity", "seq", "usage"]) && usage ? { type: "request-body", identity, seq: value.seq, usage } : null;
3613
3779
  }
3614
- case "agent-control-invoke":
3780
+ ),
3781
+ "agent-control-invoke": requireEventIdentity(
3782
+ "any",
3783
+ (value) => {
3615
3784
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "request"]) && isNonEmptyString(value.requestId) && parseAgentControlToolRequest(value.request) ? value : null;
3616
- case "agent-control-cancel":
3785
+ }
3786
+ ),
3787
+ "agent-control-cancel": requireEventIdentity(
3788
+ "any",
3789
+ (value) => {
3617
3790
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "kind"]) && isNonEmptyString(value.requestId) && (value.kind === "abort" || value.kind === "detach") ? value : null;
3618
- case "browser-invoke":
3791
+ }
3792
+ ),
3793
+ "browser-invoke": requireEventIdentity(
3794
+ "any",
3795
+ (value) => {
3619
3796
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "op", "params"]) && isNonEmptyString(value.requestId) && BROWSER_OPS.includes(value.op) ? value : null;
3620
- case "memory-invoke":
3797
+ }
3798
+ ),
3799
+ "memory-invoke": requireEventIdentity(
3800
+ "any",
3801
+ (value) => {
3621
3802
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "op", "params"]) && isNonEmptyString(value.requestId) && MEMORY_OPS.includes(value.op) ? value : null;
3622
- case "delegation-invoke":
3803
+ }
3804
+ ),
3805
+ "delegation-invoke": requireEventIdentity(
3806
+ "any",
3807
+ (value) => {
3623
3808
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "op", "params"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && (value.op === "delegate" || value.op === "check_delegation" || value.op === "retry_delegation" || value.op === "group_tasks" || value.op === "group_history" || value.op === "routine_propose" || value.op === "send_image" || value.op === "report_blocked") ? value : null;
3624
- case "secretary-invoke":
3809
+ }
3810
+ ),
3811
+ "secretary-invoke": requireEventIdentity(
3812
+ "any",
3813
+ (value) => {
3625
3814
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "op", "params"]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && (SECRETARY_OPS.includes(value.op) || SECRETARY_INTERNAL_OPS.includes(value.op)) ? value : null;
3626
- case "computer-invoke":
3815
+ }
3816
+ ),
3817
+ "computer-invoke": requireEventIdentity(
3818
+ "any",
3819
+ (value) => {
3627
3820
  return hasExactKeys(value, ["type", "identity", "seq", "requestId", "op", "params"]) && isNonEmptyString(value.requestId) && COMPUTER_OPS.includes(value.op) ? value : null;
3628
- case "computer-cancel":
3821
+ }
3822
+ ),
3823
+ "computer-cancel": requireEventIdentity(
3824
+ "any",
3825
+ (value) => {
3629
3826
  return hasExactKeys(value, ["type", "identity", "seq", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3630
- case "plugin-tool-invoke":
3827
+ }
3828
+ ),
3829
+ "plugin-tool-invoke": requireEventIdentity(
3830
+ "any",
3831
+ (value) => {
3631
3832
  return hasPluginAgentKeys(value, [
3632
3833
  "type",
3633
3834
  "identity",
@@ -3636,12 +3837,24 @@ function parseAgentWorkerEvent(value) {
3636
3837
  "toolName",
3637
3838
  "args"
3638
3839
  ]) && isNonEmptyString(value.requestId) && typeof value.toolName === "string" && parsePluginToolName(value.toolName) !== null ? value : null;
3639
- case "plugin-tool-cancel":
3840
+ }
3841
+ ),
3842
+ "plugin-tool-cancel": requireEventIdentity(
3843
+ "any",
3844
+ (value) => {
3640
3845
  return hasExactKeys(value, ["type", "identity", "seq", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3641
- case "plugin-event":
3846
+ }
3847
+ ),
3848
+ "plugin-event": requireEventIdentity(
3849
+ "any",
3850
+ (value) => {
3642
3851
  return hasPluginAgentKeys(value, ["type", "identity", "seq", "event", "data"]) && parseSessionIdentity(value.identity) && typeof value.event === "string" && PLUGIN_EVENTS.includes(value.event) && // 主会话的 before_compact 要等插件,走 plugin-intercept;只有子会话的只通知
3643
3852
  (value.event === "before_compact" ? value.agent !== void 0 && isPluginInterceptPayload(value.event, value.data) : isPluginObserveData(value.event, value.data)) ? value : null;
3644
- case "plugin-intercept":
3853
+ }
3854
+ ),
3855
+ "plugin-intercept": requireEventIdentity(
3856
+ "any",
3857
+ (value) => {
3645
3858
  return hasPluginAgentKeys(value, [
3646
3859
  "type",
3647
3860
  "identity",
@@ -3650,37 +3863,87 @@ function parseAgentWorkerEvent(value) {
3650
3863
  "event",
3651
3864
  "payload"
3652
3865
  ]) && parseSessionIdentity(value.identity) && isNonEmptyString(value.requestId) && (value.event === "before_compact" || typeof value.event === "string" && isInterceptEvent(value.event)) && typeof value.event === "string" && (value.agent === void 0 || isChildInterceptEvent(value.event)) && isPluginInterceptPayload(value.event, value.payload) ? value : null;
3653
- case "workspace-branch-context-consumed":
3866
+ }
3867
+ ),
3868
+ "workspace-branch-context-consumed": requireEventIdentity(
3869
+ "any",
3870
+ (value) => {
3654
3871
  return hasExactKeys(value, ["type", "identity", "seq", "requestId"]) && isNonEmptyString(value.requestId) ? value : null;
3655
- case "delivery-settled":
3656
- case "delivery-rejected":
3657
- case "delivery-deferred":
3658
- return hasExactKeys(value, ["type", "identity", "seq", "deliveryId"]) && isDeliveryId(value.deliveryId) ? value : null;
3659
- case "status":
3660
- return (value.status === "idle" || value.status === "running" || value.status === "failed") && (value.turnId === void 0 || isNonEmptyString(value.turnId)) ? value : null;
3661
- case "message-upsert":
3872
+ }
3873
+ ),
3874
+ "delivery-settled": parseDeliveryOutcome,
3875
+ "delivery-rejected": (value) => {
3876
+ const { reason, ...rest } = value;
3877
+ return (reason === void 0 || reason === "turn-stuck") && parseDeliveryOutcome(rest) ? value : null;
3878
+ },
3879
+ "delivery-deferred": parseDeliveryOutcome,
3880
+ status: requireEventIdentity("any", (value) => {
3881
+ return (value.status === "idle" || value.status === "running" || value.status === "failed") && (value.turnId === void 0 || isNonEmptyString(value.turnId)) ? value : null;
3882
+ }),
3883
+ "message-upsert": requireEventIdentity(
3884
+ "any",
3885
+ (value) => {
3662
3886
  return isSequence(value.index) && isRecord(value.message) && hasValidProjectedMetadata(value.message) ? value : null;
3663
- case "turn-completed":
3664
- return isNonEmptyString(value.turnId) && (value.digest === void 0 || parseTurnDigest(value.digest)) && (value.report === void 0 || parseTurnReport(value.report)) && (value.aborted === void 0 || value.aborted === true) && (value.silent === void 0 || value.silent === true) && (value.requestBudgetStop === void 0 || value.requestBudgetStop === true) && (value.requestBudgetError === void 0 || value.requestBudgetStop === true && isNonEmptyString(value.requestBudgetError)) ? value : null;
3665
- case "turn-failed":
3666
- return isNonEmptyString(value.turnId) && isNonEmptyString(value.error) && (value.undelivered === void 0 || value.undelivered === true) && (value.retryExhausted === void 0 || value.retryExhausted === true) ? value : null;
3667
- case "turn-retry":
3887
+ }
3888
+ ),
3889
+ "turn-completed": requireEventIdentity(
3890
+ "any",
3891
+ (value) => {
3892
+ return isNonEmptyString(value.turnId) && (value.digest === void 0 || parseTurnDigest(value.digest)) && (value.report === void 0 || parseTurnReport(value.report)) && (value.aborted === void 0 || value.aborted === true) && (value.silent === void 0 || value.silent === true) && (value.requestBudgetStop === void 0 || value.requestBudgetStop === true) && (value.requestBudgetError === void 0 || value.requestBudgetStop === true && isNonEmptyString(value.requestBudgetError)) && (value.continues === void 0 || isNonEmptyString(value.continues)) && (value.awaitingTasks === void 0 || value.awaitingTasks === true) ? value : null;
3893
+ }
3894
+ ),
3895
+ "turn-failed": requireEventIdentity(
3896
+ "any",
3897
+ (value) => {
3898
+ return isNonEmptyString(value.turnId) && isNonEmptyString(value.error) && (value.retryExhausted === void 0 || value.retryExhausted === true) && (value.aborted === void 0 || value.aborted === true) && (value.continues === void 0 || isNonEmptyString(value.continues)) ? value : null;
3899
+ }
3900
+ ),
3901
+ "turn-retry": requireEventIdentity(
3902
+ "any",
3903
+ (value) => {
3668
3904
  return Number.isInteger(value.attempt) && value.attempt >= 1 && Number.isInteger(value.maxAttempts) && value.maxAttempts >= 0 && isSequence(value.delayMs) && isNonEmptyString(value.error) ? value : null;
3669
- case "retry-skipped":
3905
+ }
3906
+ ),
3907
+ "retry-skipped": requireEventIdentity(
3908
+ "any",
3909
+ (value) => {
3670
3910
  return hasExactKeys(value, ["type", "identity", "seq", "reason"]) && RETRY_SKIPPED_REASONS.includes(value.reason) ? value : null;
3671
- case "messages-truncated":
3911
+ }
3912
+ ),
3913
+ "messages-truncated": requireEventIdentity(
3914
+ "any",
3915
+ (value) => {
3672
3916
  return isSequence(value.length) ? value : null;
3673
- case "rewind-done": {
3917
+ }
3918
+ ),
3919
+ "rewind-done": requireEventIdentity(
3920
+ "any",
3921
+ (value) => {
3674
3922
  const editorImages = value.editorImages === void 0 ? void 0 : parseAttachedImages(value.editorImages);
3675
3923
  return (value.editorText === void 0 || typeof value.editorText === "string") && editorImages !== null && (value.filesRestored === void 0 || typeof value.filesRestored === "boolean") ? value : null;
3676
3924
  }
3677
- case "fork-done":
3925
+ ),
3926
+ "fork-done": requireEventIdentity(
3927
+ "any",
3928
+ (value) => {
3678
3929
  return isUuid(value.targetConversationId) && (value.sessionFile === void 0 || typeof value.sessionFile === "string") && (value.entryId === void 0 || isNonEmptyString(value.entryId)) && (value.error === void 0 || typeof value.error === "string") ? value : null;
3679
- case "compaction":
3930
+ }
3931
+ ),
3932
+ compaction: requireEventIdentity(
3933
+ "any",
3934
+ (value) => {
3680
3935
  return (value.state === "queued" || value.state === "start" || value.state === "end") && (value.error === void 0 || typeof value.error === "string") && (value.abandoned === void 0 || value.abandoned === true) ? value : null;
3681
- case "commands":
3936
+ }
3937
+ ),
3938
+ commands: requireEventIdentity(
3939
+ "any",
3940
+ (value) => {
3682
3941
  return Array.isArray(value.commands) ? value : null;
3683
- case "session-meta": {
3942
+ }
3943
+ ),
3944
+ "session-meta": requireEventIdentity(
3945
+ "any",
3946
+ (value) => {
3684
3947
  const occupancy = value.occupancy === void 0 ? void 0 : parseContextOccupancy(value.occupancy);
3685
3948
  if (value.occupancy !== void 0 && !occupancy) return null;
3686
3949
  const { usageTotals: rawTotals, ...rest } = value;
@@ -3691,45 +3954,96 @@ function parseAgentWorkerEvent(value) {
3691
3954
  ...usageTotals ? { usageTotals } : {}
3692
3955
  } : null;
3693
3956
  }
3694
- case "approval-request":
3957
+ ),
3958
+ "approval-request": requireEventIdentity(
3959
+ "any",
3960
+ (value) => {
3695
3961
  return isRecord(value.request) && isNonEmptyString(value.request.requestId) && isNonEmptyString(value.request.tool) && (value.request.kind === "command" || value.request.kind === "file-edit" || value.request.kind === "file-write" || value.request.kind === "mcp") && typeof value.request.summary === "string" && (value.request.filePaths === void 0 || Array.isArray(value.request.filePaths) && value.request.filePaths.every(isNonEmptyString)) && (value.request.protected === void 0 || PROTECTED_ACTION_CATEGORIES.includes(value.request.protected)) && isOptionalTimestamp(value.request.expiresAt) && (value.request.reviewFallback === void 0 || APPROVAL_REVIEW_FALLBACKS.includes(value.request.reviewFallback)) && (value.request.guard === void 0 || isRecord(value.request.guard) && hasOnlyKeys(value.request.guard, ["ruleId", "reason"]) && isNonEmptyString(value.request.guard.ruleId) && isNonEmptyString(value.request.guard.reason)) ? value : null;
3696
- case "approval-resolved":
3962
+ }
3963
+ ),
3964
+ "approval-resolved": requireEventIdentity(
3965
+ "any",
3966
+ (value) => {
3697
3967
  return isNonEmptyString(value.requestId) ? value : null;
3698
- case "ask-resolved":
3968
+ }
3969
+ ),
3970
+ "ask-resolved": requireEventIdentity(
3971
+ "any",
3972
+ (value) => {
3699
3973
  return isNonEmptyString(value.requestId) && (value.by === void 0 || ASK_ANSWER_BY.includes(value.by)) && (value.answer === void 0 || typeof value.answer === "string") && (value.name === void 0 || isNonEmptyString(value.name)) ? value : null;
3700
- case "ask-request":
3974
+ }
3975
+ ),
3976
+ "ask-request": requireEventIdentity(
3977
+ "any",
3978
+ (value) => {
3701
3979
  return isRecord(value.ask) && isNonEmptyString(value.ask.requestId) && isNonEmptyString(value.ask.question) && isOptionalTimestamp(value.ask.expiresAt) && (value.ask.recommended === void 0 || Array.isArray(value.ask.options) && value.ask.options.includes(value.ask.recommended)) && (value.ask.relay === void 0 || isRecord(value.ask.relay) && isNonEmptyString(value.ask.relay.name)) ? value : null;
3702
- case "subagent-update":
3980
+ }
3981
+ ),
3982
+ "subagent-update": requireEventIdentity(
3983
+ "any",
3984
+ (value) => {
3703
3985
  return isRecord(value.agent) ? value : null;
3704
- case "coworker-update":
3986
+ }
3987
+ ),
3988
+ "coworker-update": requireEventIdentity(
3989
+ "any",
3990
+ (value) => {
3705
3991
  return isRecord(value.coworker) && isNonEmptyString(value.coworker.id) ? value : null;
3706
- case "goal-signal":
3992
+ }
3993
+ ),
3994
+ "goal-signal": requireEventIdentity(
3995
+ "any",
3996
+ (value) => {
3707
3997
  return (value.kind === "complete" || value.kind === "blocked" || value.kind === "wait") && typeof value.note === "string" ? value : null;
3708
- case "plan-state": {
3998
+ }
3999
+ ),
4000
+ "plan-state": requireEventIdentity(
4001
+ "any",
4002
+ (value) => {
3709
4003
  const state = parsePlanState(value.state);
3710
4004
  return hasExactKeys(value, ["type", "identity", "seq", "state"]) && state ? { ...value, state } : null;
3711
4005
  }
3712
- case "workflow-status": {
4006
+ ),
4007
+ "workflow-status": requireEventIdentity(
4008
+ "any",
4009
+ (value) => {
3713
4010
  const run = parseWorkflowRunSnapshot(value.run);
3714
4011
  return hasExactKeys(value, ["type", "identity", "seq", "run"]) && run ? { ...value, run } : null;
3715
4012
  }
3716
- case "tool-output":
4013
+ ),
4014
+ "tool-output": requireEventIdentity(
4015
+ "any",
4016
+ (value) => {
3717
4017
  return isNonEmptyString(value.toolCallId) && typeof value.output === "string" && (value.startedAt === void 0 || typeof value.startedAt === "number") && (value.deadlineAt === void 0 || Number.isFinite(value.deadlineAt)) ? value : null;
3718
- case "task-started":
4018
+ }
4019
+ ),
4020
+ "task-started": requireEventIdentity(
4021
+ "any",
4022
+ (value) => {
3719
4023
  return isRecord(value.task) ? value : null;
3720
- case "task-output":
3721
- case "task-ended":
3722
- return isNonEmptyString(value.taskId) ? value : null;
3723
- case "background-tasks-level":
4024
+ }
4025
+ ),
4026
+ "task-output": parseTaskEvent,
4027
+ "task-ended": parseTaskEvent,
4028
+ "background-tasks-level": requireEventIdentity(
4029
+ "any",
4030
+ (value) => {
3724
4031
  return Array.isArray(value.tasks) && value.tasks.every((task) => isRecord(task) && isNonEmptyString(task.taskId)) ? value : null;
3725
- case "session-custom-entry":
4032
+ }
4033
+ ),
4034
+ "session-custom-entry": requireEventIdentity(
4035
+ "any",
4036
+ (value) => {
3726
4037
  return parseAgentSessionCustomEntry(value.entry) ? value : null;
3727
- default:
3728
- return null;
3729
- }
4038
+ }
4039
+ )
4040
+ };
4041
+ function parseAgentWorkerEvent(value) {
4042
+ if (!isRecord(value) || !isNonEmptyString(value.type)) return null;
4043
+ return parseClosed(agentWorkerEventParsers, value.type, value);
3730
4044
  }
3731
4045
  export {
3732
- PLUGIN_AGENT_OUTPUT_MAX_CHARS as $,
4046
+ isClassifierOnlyProvider as $,
3733
4047
  AGENT_END_TEXT_MAX as A,
3734
4048
  BEFORE_AGENT_START_PROMPT_MAX as B,
3735
4049
  CONTEXT_OCCUPANCY_BUCKETS as C,
@@ -3755,17 +4069,17 @@ export {
3755
4069
  turnCalledSilenceTurn as W,
3756
4070
  STALE_SESSION_ERROR as X,
3757
4071
  WORKSPACE_WRITE_TOOL_ID as Y,
3758
- splitPlanPrefix as Z,
3759
- parsePlanMessage as _,
4072
+ parsePlanMessage as Z,
4073
+ PLUGIN_AGENT_OUTPUT_MAX_CHARS as _,
3760
4074
  parseSessionIdentity as a,
3761
- parseSecretaryToolDraft as a$,
3762
- isClassifierOnlyProvider as a0,
3763
- isOauthAccountPool as a1,
3764
- resolveEditMode as a2,
3765
- EMPTY_PLAN_STATE as a3,
3766
- mergeMaskReports as a4,
3767
- PRIVACY_MASK_ENTRY as a5,
3768
- parseAgentCommand as a6,
4075
+ BOT_AVATAR_HOST as a$,
4076
+ isOauthAccountPool as a0,
4077
+ resolveEditMode as a1,
4078
+ EMPTY_PLAN_STATE as a2,
4079
+ mergeMaskReports as a3,
4080
+ PRIVACY_MASK_ENTRY as a4,
4081
+ parseAgentCommand as a5,
4082
+ effectiveDisabledBuiltinTools as a6,
3769
4083
  pluginToolName as a7,
3770
4084
  APPROVAL_MODES as a8,
3771
4085
  parseChildConversationMetadata as a9,
@@ -3791,11 +4105,11 @@ export {
3791
4105
  parseWebSearchChain as aT,
3792
4106
  DEFAULT_PRESET_ID as aU,
3793
4107
  childProfileToolIds as aV,
3794
- AGENT_WAIT_DEFAULT_MS as aW,
3795
- AGENT_WAIT_MAX_MS as aX,
3796
- effectiveDisabledBuiltinTools as aY,
3797
- isDeliveryId as aZ,
3798
- parseSecretarySkillDraft as a_,
4108
+ AGENT_TASK_MAX_RESUMES as aW,
4109
+ AGENT_WAIT_DEFAULT_MS as aX,
4110
+ AGENT_WAIT_MAX_MS as aY,
4111
+ LOCAL_IMAGE_SCHEME as aZ,
4112
+ REMOTE_FETCH_HOST as a_,
3799
4113
  eligibleOauthPoolAccountKeys as aa,
3800
4114
  normalizeSshTimeoutSeconds as ab,
3801
4115
  isEditMode as ac,
@@ -3823,80 +4137,83 @@ export {
3823
4137
  OBSERVE_TIMEOUT_MS as ay,
3824
4138
  BEFORE_COMPACT_TIMEOUT_MS as az,
3825
4139
  parseApprovalAllowThreshold as b,
3826
- PLAN_TITLE_MAX as b$,
3827
- TURN_REPORT_MAX_CHARS as b0,
3828
- isSecretarySlug as b1,
3829
- secretaryToolScriptFile as b2,
3830
- parseSecretaryToolFile as b3,
3831
- renderSecretaryToolFile as b4,
3832
- secretaryToolDescriptor as b5,
3833
- TOOL_TIMEOUT_DEFAULT as b6,
3834
- TOOL_OUTPUT_MAX as b7,
3835
- isSecretarySkillName as b8,
3836
- parseSecretarySkillFile as b9,
3837
- parseSelectProjectAuthorityRequest as bA,
3838
- parseRemoveProjectAuthorityRequest as bB,
3839
- withVersionSegment as bC,
3840
- DEFAULT_BASE_URLS as bD,
3841
- shouldSilenceTurn as bE,
3842
- sessionIdsInUpdates as bF,
3843
- messageText as bG,
3844
- isPureSessionUpdate as bH,
3845
- PROJECTED_FILE_TEXT_LIMIT as bI,
3846
- imageGenerationPreviewPaths as bJ,
3847
- parseGeneratedImagePaths as bK,
3848
- parseMaskReport as bL,
3849
- parsePluginMessageSource as bM,
3850
- parseRtkToolStats as bN,
3851
- isBackgroundTaskId as bO,
3852
- parseShellFailure as bP,
3853
- pluginArtifactsFromToolDetails as bQ,
3854
- parseApprovalReviewRecord as bR,
3855
- PROJECTED_FILE_CHANGE_LIMIT as bS,
3856
- PROJECTED_APPLY_PATCH_PATH_TEXT_LIMIT as bT,
3857
- PROJECTED_APPLY_PATCH_PATH_COUNT_LIMIT as bU,
3858
- foldPlanState as bV,
3859
- PLAN_MODE_ON_NOTE as bW,
3860
- PLAN_MODE_OFF_NOTE as bX,
3861
- planFeedbackText as bY,
3862
- planKickoffText as bZ,
3863
- activePlanNote as b_,
3864
- renderSecretarySkillFile as ba,
3865
- LOCAL_IMAGE_SCHEME as bb,
3866
- REMOTE_FETCH_HOST as bc,
3867
- BOT_AVATAR_HOST as bd,
3868
- SECRETARY_AVATAR_HOST as be,
3869
- PLUGIN_ASSET_HOST as bf,
3870
- mediaExtension as bg,
3871
- localImageUrlToPath as bh,
3872
- isMediaPath as bi,
3873
- isVideoPath as bj,
3874
- IMAGE_EXTENSIONS as bk,
3875
- effectiveSubagentAllowedModes as bl,
3876
- parseCreateConversationAuthorityRequest as bm,
3877
- parseConversationAuthorityRequest as bn,
3878
- parseUpdateConversationSelectionRequest as bo,
3879
- parseTitleSummaryInput as bp,
3880
- parseParentSourceBindingRequest as bq,
3881
- parseParentModelSelectionRequest as br,
3882
- parseAgentDispatchRequest as bs,
3883
- isApprovalDecision as bt,
3884
- cleanToolBatchLabel as bu,
3885
- toolBatchLabelPrompt as bv,
3886
- TOOL_BATCH_LABEL_SYSTEM_PROMPT as bw,
3887
- SHELL_LIMITS as bx,
3888
- TITLE_SUMMARY_MAX_CANDIDATES as by,
3889
- parseCreateProjectAuthorityRequest as bz,
4140
+ planFeedbackText as b$,
4141
+ SECRETARY_AVATAR_HOST as b0,
4142
+ PLUGIN_ASSET_HOST as b1,
4143
+ SECRETARY_REPORT_HOST as b2,
4144
+ mediaExtension as b3,
4145
+ localImageUrlToPath as b4,
4146
+ isMediaPath as b5,
4147
+ isVideoPath as b6,
4148
+ IMAGE_EXTENSIONS as b7,
4149
+ isDeliveryId as b8,
4150
+ splitPlanPrefix as b9,
4151
+ SHELL_LIMITS as bA,
4152
+ TITLE_SUMMARY_MAX_CANDIDATES as bB,
4153
+ parseCreateProjectAuthorityRequest as bC,
4154
+ parseSelectProjectAuthorityRequest as bD,
4155
+ parseRemoveProjectAuthorityRequest as bE,
4156
+ withVersionSegment as bF,
4157
+ DEFAULT_BASE_URLS as bG,
4158
+ shouldSilenceTurn as bH,
4159
+ sessionIdsInUpdates as bI,
4160
+ messageText as bJ,
4161
+ isPureSessionUpdate as bK,
4162
+ PROJECTED_FILE_TEXT_LIMIT as bL,
4163
+ imageGenerationPreviewPaths as bM,
4164
+ parseGeneratedImagePaths as bN,
4165
+ parseMaskReport as bO,
4166
+ parsePluginMessageSource as bP,
4167
+ parseRtkToolStats as bQ,
4168
+ isBackgroundTaskId as bR,
4169
+ parseShellFailure as bS,
4170
+ pluginArtifactsFromToolDetails as bT,
4171
+ parseApprovalReviewRecord as bU,
4172
+ PROJECTED_FILE_CHANGE_LIMIT as bV,
4173
+ PROJECTED_APPLY_PATCH_PATH_TEXT_LIMIT as bW,
4174
+ PROJECTED_APPLY_PATCH_PATH_COUNT_LIMIT as bX,
4175
+ foldPlanState as bY,
4176
+ PLAN_MODE_ON_NOTE as bZ,
4177
+ PLAN_MODE_OFF_NOTE as b_,
4178
+ parseSecretarySkillDraft as ba,
4179
+ parseSecretaryToolDraft as bb,
4180
+ TURN_REPORT_MAX_CHARS as bc,
4181
+ isSecretarySlug as bd,
4182
+ secretaryToolScriptFile as be,
4183
+ parseSecretaryToolFile as bf,
4184
+ renderSecretaryToolFile as bg,
4185
+ secretaryToolDescriptor as bh,
4186
+ TOOL_TIMEOUT_DEFAULT as bi,
4187
+ TOOL_OUTPUT_MAX as bj,
4188
+ isSecretarySkillName as bk,
4189
+ parseSecretarySkillFile as bl,
4190
+ renderSecretarySkillFile as bm,
4191
+ effectiveSubagentAllowedModes as bn,
4192
+ parseCreateConversationAuthorityRequest as bo,
4193
+ parseConversationAuthorityRequest as bp,
4194
+ parseUpdateConversationSelectionRequest as bq,
4195
+ parseTitleSummaryInput as br,
4196
+ parseParentSourceBindingRequest as bs,
4197
+ parseParentModelSelectionRequest as bt,
4198
+ parseAgentDispatchRequest as bu,
4199
+ isApprovalDecision as bv,
4200
+ TASK_KEEP_REASON_MAX as bw,
4201
+ cleanToolBatchLabel as bx,
4202
+ toolBatchLabelPrompt as by,
4203
+ TOOL_BATCH_LABEL_SYSTEM_PROMPT as bz,
3890
4204
  isProbability as c,
3891
- PLAN_TEXT_MAX as c0,
3892
- planPhase as c1,
3893
- parsePlanEntry as c2,
3894
- parseAgentControlToolRequest as c3,
3895
- nativeSearchKindFor as c4,
3896
- isWorkflowPresetId as c5,
3897
- PLUGIN_EVENTS as c6,
3898
- isInterceptEvent as c7,
3899
- APPEND_ONLY_INTERCEPT_EVENTS as c8,
4205
+ planKickoffText as c0,
4206
+ activePlanNote as c1,
4207
+ PLAN_TITLE_MAX as c2,
4208
+ PLAN_TEXT_MAX as c3,
4209
+ planPhase as c4,
4210
+ parsePlanEntry as c5,
4211
+ parseAgentControlToolRequest as c6,
4212
+ nativeSearchKindFor as c7,
4213
+ isWorkflowPresetId as c8,
4214
+ PLUGIN_EVENTS as c9,
4215
+ isInterceptEvent as ca,
4216
+ APPEND_ONLY_INTERCEPT_EVENTS as cb,
3900
4217
  CONTEXT_PART_ITEMS as d,
3901
4218
  parseProviderHeaders as e,
3902
4219
  escapePiConfigValue as f,
@@ -3916,9 +4233,9 @@ export {
3916
4233
  SECRETARY_ID_MAX as t,
3917
4234
  SECRETARY_CONTACT_CAPTION_MAX as u,
3918
4235
  SECRETARY_ATTACHMENT_PATH_MAX as v,
3919
- SECRETARY_ATTACHMENT_MAX as w,
3920
- SECRETARY_SEND_MODES as x,
3921
- SECRETARY_SESSION_MESSAGE_MAX as y,
4236
+ SECRETARY_SEND_MODES as w,
4237
+ SECRETARY_SESSION_MESSAGE_MAX as x,
4238
+ SECRETARY_ATTACHMENT_MAX as y,
3922
4239
  TOOL_RUN_TIMEOUT_MS as z
3923
4240
  };
3924
- //# sourceMappingURL=agent-D33nI7fP.js.map
4241
+ //# sourceMappingURL=agent-BbNq8i9j.js.map