@band-app/server 0.32.0 → 0.34.0

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 (160) hide show
  1. package/dist/client/assets/{TerminalPanel-CSIo5ni0.js → TerminalPanel-BlzUBzmR.js} +1 -1
  2. package/dist/client/assets/{_basePickBy-CdaZY6mI.js → _basePickBy-78hIlKHL.js} +1 -1
  3. package/dist/client/assets/{_baseUniq-Cbf2JylA.js → _baseUniq-C_y7bQp7.js} +1 -1
  4. package/dist/client/assets/addon-search-BvnuewQv.js +1 -0
  5. package/dist/client/assets/addon-unicode11-C7S6GMMR.js +1 -0
  6. package/dist/client/assets/{addon-webgl-q3t2iERs.js → addon-webgl-D9URxm_b.js} +5 -5
  7. package/dist/client/assets/{arc-93kXHiVA.js → arc-DHUj8i-C.js} +1 -1
  8. package/dist/client/assets/{architectureDiagram-VXUJARFQ-mXd7ilfO.js → architectureDiagram-VXUJARFQ-D4Gtstny.js} +1 -1
  9. package/dist/client/assets/{blockDiagram-VD42YOAC-DpjfCZDe.js → blockDiagram-VD42YOAC-BnvoqD8n.js} +1 -1
  10. package/dist/client/assets/{c4Diagram-YG6GDRKO-D17zktyo.js → c4Diagram-YG6GDRKO-B3kFa8rY.js} +1 -1
  11. package/dist/client/assets/channel-C2tC7nD9.js +1 -0
  12. package/dist/client/assets/{chunk-4BX2VUAB-UK3Q89L4.js → chunk-4BX2VUAB-Cry6RdNE.js} +1 -1
  13. package/dist/client/assets/{chunk-55IACEB6-DOnNiKCE.js → chunk-55IACEB6-B2Hcf4yS.js} +1 -1
  14. package/dist/client/assets/{chunk-B4BG7PRW-RuY3pvrs.js → chunk-B4BG7PRW-BqTOv_Q4.js} +1 -1
  15. package/dist/client/assets/{chunk-DI55MBZ5-CLkaHQD0.js → chunk-DI55MBZ5-BHJn8-Rw.js} +1 -1
  16. package/dist/client/assets/{chunk-FMBD7UC4-B2_FpfY1.js → chunk-FMBD7UC4-D2HIyXOe.js} +1 -1
  17. package/dist/client/assets/{chunk-QN33PNHL-BJ5cRImN.js → chunk-QN33PNHL-BSLNMHFq.js} +1 -1
  18. package/dist/client/assets/{chunk-QZHKN3VN-DWhBc9Ty.js → chunk-QZHKN3VN-BuBnSFe-.js} +1 -1
  19. package/dist/client/assets/{chunk-TZMSLE5B-C6dn9jrV.js → chunk-TZMSLE5B-DiQMwPjF.js} +1 -1
  20. package/dist/client/assets/classDiagram-2ON5EDUG-BWbZZspv.js +1 -0
  21. package/dist/client/assets/classDiagram-v2-WZHVMYZB-BWbZZspv.js +1 -0
  22. package/dist/client/assets/clone-BxWL4DUp.js +1 -0
  23. package/dist/client/assets/{cose-bilkent-S5V4N54A-CApk1lUu.js → cose-bilkent-S5V4N54A-Db5PXk3I.js} +1 -1
  24. package/dist/client/assets/{dagre-6UL2VRFP-BmLALXZu.js → dagre-6UL2VRFP-COrq1-o3.js} +1 -1
  25. package/dist/client/assets/{diagram-PSM6KHXK-C2cPLLkQ.js → diagram-PSM6KHXK-BEFxHLpj.js} +1 -1
  26. package/dist/client/assets/{diagram-QEK2KX5R-vmbBSzsB.js → diagram-QEK2KX5R-K9i-foPa.js} +1 -1
  27. package/dist/client/assets/{diagram-S2PKOQOG-RgcJYL9S.js → diagram-S2PKOQOG-5WsQ8w0M.js} +1 -1
  28. package/dist/client/assets/{erDiagram-Q2GNP2WA-CpoxBAoy.js → erDiagram-Q2GNP2WA-CzYts47e.js} +1 -1
  29. package/dist/client/assets/{flowDiagram-NV44I4VS-DxnlkHRY.js → flowDiagram-NV44I4VS-BHSMXKBN.js} +1 -1
  30. package/dist/client/assets/{ganttDiagram-JELNMOA3-DsnoA6Bi.js → ganttDiagram-JELNMOA3-lrI55nIi.js} +1 -1
  31. package/dist/client/assets/{gitGraphDiagram-V2S2FVAM-CRGiaUIP.js → gitGraphDiagram-V2S2FVAM-BR9i1nFI.js} +1 -1
  32. package/dist/client/assets/{graph-B0pjD7JO.js → graph-CHzn7hGd.js} +1 -1
  33. package/dist/client/assets/{highlighted-body-B3W2YXNL-B-sBG2bX.js → highlighted-body-B3W2YXNL-pf8CG4LE.js} +1 -1
  34. package/dist/client/assets/{index-DoBYcXmW.js → index-B1M1Nr1U.js} +1 -1
  35. package/dist/client/assets/{index-Ct8NuxSL.js → index-B3_tKObw.js} +1 -1
  36. package/dist/client/assets/{index-DHizjwkP.js → index-BFvt5Udm.js} +1 -1
  37. package/dist/client/assets/{index-ftqQmu5s.js → index-BZejpLSO.js} +1 -1
  38. package/dist/client/assets/{index-U5JB6u6d.js → index-C4WPBk8W.js} +1 -1
  39. package/dist/client/assets/{index-CrCMXmx8.js → index-CAapUiFF.js} +1 -1
  40. package/dist/client/assets/{index-THSuS9sd.js → index-C_k8X250.js} +1 -1
  41. package/dist/client/assets/{index-sHvOWbSE.js → index-Cg2goL7s.js} +1 -1
  42. package/dist/client/assets/{index-C08rV2E6.js → index-CprTy2ja.js} +1 -1
  43. package/dist/client/assets/{index-2xKJ9Khi.js → index-DOz7KiMS.js} +1 -1
  44. package/dist/client/assets/{index-TNsDOp6e.js → index-DRbvI3mJ.js} +1 -1
  45. package/dist/client/assets/{index-BuhLC7zE.js → index-iDhzXhLS.js} +1 -1
  46. package/dist/client/assets/{index-C5lac708.js → index-sjjEn2vn.js} +1 -1
  47. package/dist/client/assets/{infoDiagram-HS3SLOUP-CRp6iT8d.js → infoDiagram-HS3SLOUP-CPWEaaXS.js} +1 -1
  48. package/dist/client/assets/{journeyDiagram-XKPGCS4Q-BQ2WA6b4.js → journeyDiagram-XKPGCS4Q-IpZXRX_B.js} +1 -1
  49. package/dist/client/assets/{kanban-definition-3W4ZIXB7-D-VXNhIi.js → kanban-definition-3W4ZIXB7-BcAUFQlt.js} +1 -1
  50. package/dist/client/assets/{layout-DqRyDMTL.js → layout-CIxVWn8u.js} +1 -1
  51. package/dist/client/assets/main-Bx2dZBHM.css +1 -0
  52. package/dist/client/assets/{main-CsKfm_iE.js → main-D13cBYQG.js} +280 -274
  53. package/dist/client/assets/{mindmap-definition-VGOIOE7T-DF_KVmYJ.js → mindmap-definition-VGOIOE7T-CX1T1sUN.js} +1 -1
  54. package/dist/client/assets/{pieDiagram-ADFJNKIX-X9Gpsupa.js → pieDiagram-ADFJNKIX-DyLrkF8x.js} +2 -2
  55. package/dist/client/assets/{quadrantDiagram-AYHSOK5B-Dv43A6Kl.js → quadrantDiagram-AYHSOK5B-B_-kuE5u.js} +1 -1
  56. package/dist/client/assets/{requirementDiagram-UZGBJVZJ-Bsm1ID8v.js → requirementDiagram-UZGBJVZJ-CW2Pkh0d.js} +1 -1
  57. package/dist/client/assets/{sankeyDiagram-TZEHDZUN-C89ZzNUa.js → sankeyDiagram-TZEHDZUN-SH3i00se.js} +1 -1
  58. package/dist/client/assets/{sequenceDiagram-WL72ISMW-DCEzHjMR.js → sequenceDiagram-WL72ISMW-reJi3BTh.js} +1 -1
  59. package/dist/client/assets/{stateDiagram-FKZM4ZOC-DL_-FpOq.js → stateDiagram-FKZM4ZOC-CjXJfQgu.js} +1 -1
  60. package/dist/client/assets/stateDiagram-v2-4FDKWEC3-XtJwX8Ka.js +1 -0
  61. package/dist/client/assets/{timeline-definition-IT6M3QCI-BklAlKxM.js → timeline-definition-IT6M3QCI-B96AUWWH.js} +1 -1
  62. package/dist/client/assets/{treemap-GDKQZRPO-DugwR-ad.js → treemap-GDKQZRPO-DoFQQo5a.js} +1 -1
  63. package/dist/client/assets/workspace._workspaceId-XsdwFk5t.js +1 -0
  64. package/dist/client/assets/{workspace._workspaceId-CvpowXC8.js → workspace._workspaceId-ftjuXabJ.js} +1 -1
  65. package/dist/client/assets/xterm-EbFzQDSP.js +10 -0
  66. package/dist/client/assets/{xychartDiagram-PRI3JC2R-DEyS0s6m.js → xychartDiagram-PRI3JC2R-v-oqC6We.js} +1 -1
  67. package/dist/migrations/20260927123820_agent_sessions/migration.sql +16 -0
  68. package/dist/migrations/20260927123820_agent_sessions/snapshot.json +1675 -0
  69. package/dist/migrations/20260927210840_client_state/migration.sql +11 -0
  70. package/dist/migrations/20260927210840_client_state/snapshot.json +1763 -0
  71. package/dist/openapi.json +1724 -218
  72. package/dist/server/assets/{TerminalPanel-BVyQf1VK.js → TerminalPanel-DJnQglDZ.js} +1 -1
  73. package/dist/server/assets/{_basePickBy-DRh75DZA.js → _basePickBy-RSzPH-5U.js} +2 -2
  74. package/dist/server/assets/{_baseUniq-DxwDPh9u.js → _baseUniq-Cp_Qm3uS.js} +1 -1
  75. package/dist/server/assets/_tanstack-start-manifest_v-GQWxvAsR.js +4 -0
  76. package/dist/server/assets/{addon-search-WCacnXal.js → addon-search-BUjn-C-R.js} +190 -176
  77. package/dist/server/assets/{addon-unicode11-BhCmKRb7.js → addon-unicode11-BQz-Cn6z.js} +14 -20
  78. package/dist/server/assets/{addon-webgl-hypMW_go.js → addon-webgl-CgJYuUAA.js} +47 -48
  79. package/dist/server/assets/{arc-d221pGej.js → arc-BAImyMJ-.js} +1 -1
  80. package/dist/server/assets/{architecture-7HQA4BMR-CDuqFHS1.js → architecture-7HQA4BMR-BldYj4EA.js} +6 -6
  81. package/dist/server/assets/{architectureDiagram-VXUJARFQ-LivVdR2U.js → architectureDiagram-VXUJARFQ-iEEYNhTp.js} +6 -6
  82. package/dist/server/assets/{blockDiagram-VD42YOAC-Cpsga8jz.js → blockDiagram-VD42YOAC-CpXPlM5p.js} +6 -6
  83. package/dist/server/assets/{c4Diagram-YG6GDRKO-CR3dewU0.js → c4Diagram-YG6GDRKO-C0jPSgch.js} +2 -2
  84. package/dist/server/assets/{channel-CznEvUJx.js → channel-BXmVLq-u.js} +1 -1
  85. package/dist/server/assets/{chunk-4BX2VUAB-2XGKksov.js → chunk-4BX2VUAB-BRh-MKqM.js} +1 -1
  86. package/dist/server/assets/{chunk-55IACEB6-D_sfF6RU.js → chunk-55IACEB6-D-II5Uvr.js} +1 -1
  87. package/dist/server/assets/{chunk-B4BG7PRW-DE9YZpuI.js → chunk-B4BG7PRW-CLc3MoS-.js} +4 -4
  88. package/dist/server/assets/{chunk-DI55MBZ5-1WmBcjv0.js → chunk-DI55MBZ5-rIuRlmCw.js} +3 -3
  89. package/dist/server/assets/{chunk-FMBD7UC4-0hzwdviV.js → chunk-FMBD7UC4-CwpJS1jy.js} +1 -1
  90. package/dist/server/assets/{chunk-QN33PNHL-sglY-9R6.js → chunk-QN33PNHL-DDjZ9iRW.js} +1 -1
  91. package/dist/server/assets/{chunk-QZHKN3VN-BL0yO15_.js → chunk-QZHKN3VN-CqXxabdj.js} +1 -1
  92. package/dist/server/assets/{chunk-TZMSLE5B-CRCOAzqG.js → chunk-TZMSLE5B-YmXbykHL.js} +1 -1
  93. package/dist/server/assets/{classDiagram-v2-WZHVMYZB-GVVGcmAY.js → classDiagram-2ON5EDUG-B5goRv2J.js} +5 -5
  94. package/dist/server/assets/{classDiagram-2ON5EDUG-GVVGcmAY.js → classDiagram-v2-WZHVMYZB-B5goRv2J.js} +5 -5
  95. package/dist/server/assets/{clone-Cw9PiOA8.js → clone-8krOB2fX.js} +1 -1
  96. package/dist/server/assets/{cose-bilkent-S5V4N54A-xdF6iXS1.js → cose-bilkent-S5V4N54A-CT0fXZG5.js} +1 -1
  97. package/dist/server/assets/{dagre-6UL2VRFP-ZMimZN6M.js → dagre-6UL2VRFP-BKnoyRYf.js} +6 -6
  98. package/dist/server/assets/{diagram-PSM6KHXK-AtdXKese.js → diagram-PSM6KHXK-3yiYIfYG.js} +7 -7
  99. package/dist/server/assets/{diagram-QEK2KX5R-to1VE7Ky.js → diagram-QEK2KX5R-BZS0Hd_d.js} +6 -6
  100. package/dist/server/assets/{diagram-S2PKOQOG-lJFLwEPR.js → diagram-S2PKOQOG-BkGWooM_.js} +6 -6
  101. package/dist/server/assets/{erDiagram-Q2GNP2WA-CbevyytQ.js → erDiagram-Q2GNP2WA-BlJW8Tz3.js} +4 -4
  102. package/dist/server/assets/{flowDiagram-NV44I4VS-DTd0gkkY.js → flowDiagram-NV44I4VS-BGWlA0EG.js} +5 -5
  103. package/dist/server/assets/{ganttDiagram-JELNMOA3-YwmrEI5N.js → ganttDiagram-JELNMOA3-Cf3LALG6.js} +1 -1
  104. package/dist/server/assets/{gitGraph-G5XIXVHT-BArDd0OC.js → gitGraph-G5XIXVHT-B9S3heYN.js} +6 -6
  105. package/dist/server/assets/{gitGraphDiagram-V2S2FVAM-BTThcyM8.js → gitGraphDiagram-V2S2FVAM-C4_f3rx4.js} +7 -7
  106. package/dist/server/assets/{graph-BOO01qmU.js → graph-DYj8A2bp.js} +2 -2
  107. package/dist/server/assets/{highlighted-body-B3W2YXNL-Cym8kCCk.js → highlighted-body-B3W2YXNL-Df68BBlw.js} +1 -1
  108. package/dist/server/assets/{index-CBT9vLeO.js → index-7UlzI_dK.js} +1 -1
  109. package/dist/server/assets/{index-CaFux-EA.js → index-B5gG6MB7.js} +1 -1
  110. package/dist/server/assets/{index-CQd5Q7Kt.js → index-BDEhO1ya.js} +1 -1
  111. package/dist/server/assets/{index-3bt1s3HG.js → index-BYKwSvPL.js} +1 -1
  112. package/dist/server/assets/{index-DVBTKosE.js → index-BiwgNHMQ.js} +1 -1
  113. package/dist/server/assets/{index-Z7BJHwYS.js → index-CISg2hqm.js} +1 -1
  114. package/dist/server/assets/{index-7I7gBKIT.js → index-CMq_WJJ7.js} +1 -1
  115. package/dist/server/assets/{index-Ckc3EtXO.js → index-ChV05j8R.js} +1 -1
  116. package/dist/server/assets/{index-caXQk3Nh.js → index-CopZNvBd.js} +1 -1
  117. package/dist/server/assets/{index-DZfyQWn7.js → index-CxMB5JY7.js} +1 -1
  118. package/dist/server/assets/{index-BQaiSrqT.js → index-DIuiSZSj.js} +1 -1
  119. package/dist/server/assets/{index-DX1Ugorr.js → index-DqsmbFGQ.js} +1 -1
  120. package/dist/server/assets/{index-CsHpsK-4.js → index-DyUjxC3i.js} +1 -1
  121. package/dist/server/assets/{info-VBDWY6EO-D4lcUmb_.js → info-VBDWY6EO-BmkTQbMv.js} +6 -6
  122. package/dist/server/assets/{infoDiagram-HS3SLOUP-C1ai--xt.js → infoDiagram-HS3SLOUP-CKR2MY9e.js} +5 -5
  123. package/dist/server/assets/{journeyDiagram-XKPGCS4Q-qel6lxPz.js → journeyDiagram-XKPGCS4Q-DPsUHcaJ.js} +4 -4
  124. package/dist/server/assets/{kanban-definition-3W4ZIXB7-BQPKgoP_.js → kanban-definition-3W4ZIXB7-C5QIVVhD.js} +2 -2
  125. package/dist/server/assets/{layout-D_wAQ9pE.js → layout-R-e4wg8W.js} +4 -4
  126. package/dist/server/assets/{mermaid-3ZIDBTTL-CtNgetEO.js → mermaid-3ZIDBTTL-ByDi8HnK.js} +1 -1
  127. package/dist/server/assets/{mermaid-parser.core-BwjOeEsU.js → mermaid-parser.core-C9wm222O.js} +11 -11
  128. package/dist/server/assets/{mindmap-definition-VGOIOE7T-DYdatMwP.js → mindmap-definition-VGOIOE7T-1gh-bXjE.js} +3 -3
  129. package/dist/server/assets/{packet-DYOGHKS2-_TbN3RWI.js → packet-DYOGHKS2-Bxy3z0_p.js} +6 -6
  130. package/dist/server/assets/{pie-VRWISCQL-D9Z5k3qi.js → pie-VRWISCQL-BlDk8RiA.js} +6 -6
  131. package/dist/server/assets/{pieDiagram-ADFJNKIX-COmj-G7F.js → pieDiagram-ADFJNKIX-CwnESx-9.js} +7 -7
  132. package/dist/server/assets/{quadrantDiagram-AYHSOK5B-BajsyCAd.js → quadrantDiagram-AYHSOK5B-B-US3olm.js} +1 -1
  133. package/dist/server/assets/{radar-ZZBFDIW7-DLipfn_u.js → radar-ZZBFDIW7-Dy71dV8F.js} +6 -6
  134. package/dist/server/assets/{requirementDiagram-UZGBJVZJ-BGEkpdbY.js → requirementDiagram-UZGBJVZJ-DZZQz_qm.js} +3 -3
  135. package/dist/server/assets/{router-Dpb0Z442.js → router-C6awDsR6.js} +16463 -11602
  136. package/dist/server/assets/{sankeyDiagram-TZEHDZUN-CWd3AEju.js → sankeyDiagram-TZEHDZUN-DMIqo7mj.js} +1 -1
  137. package/dist/server/assets/{sequenceDiagram-WL72ISMW-BMTkK0JQ.js → sequenceDiagram-WL72ISMW-B8koBIGl.js} +3 -3
  138. package/dist/server/assets/{stateDiagram-FKZM4ZOC-CpBXq11c.js → stateDiagram-FKZM4ZOC-BHze-gTI.js} +8 -8
  139. package/dist/server/assets/{stateDiagram-v2-4FDKWEC3-DNuppjf9.js → stateDiagram-v2-4FDKWEC3-DRFmfjyi.js} +4 -4
  140. package/dist/server/assets/{timeline-definition-IT6M3QCI-YTyqSIDt.js → timeline-definition-IT6M3QCI-CEkzxLSR.js} +2 -2
  141. package/dist/server/assets/{treemap-GDKQZRPO-BeWiYXRR.js → treemap-GDKQZRPO-0VBmxaAW.js} +6 -6
  142. package/dist/server/assets/{workspace._workspaceId-t0HaEyN5.js → workspace._workspaceId-BtMBxm9H.js} +93 -71
  143. package/dist/server/assets/{workspace._workspaceId-Ce_eap6T.js → workspace._workspaceId-C7ra183B.js} +1 -1
  144. package/dist/server/assets/{xterm-DnMRSOdQ.js → xterm-CsaVCelU.js} +517 -579
  145. package/dist/server/assets/{xychartDiagram-PRI3JC2R-Dlgz7zKK.js → xychartDiagram-PRI3JC2R-BQCIxu2L.js} +1 -1
  146. package/dist/server/server.js +2 -2
  147. package/dist/start-server.mjs +34624 -30192
  148. package/dist/terminal-daemon.mjs +635 -335
  149. package/package.json +14 -12
  150. package/dist/client/assets/addon-search-DBOYg5r3.js +0 -1
  151. package/dist/client/assets/addon-unicode11-LsnDChsR.js +0 -1
  152. package/dist/client/assets/channel-C4GiEGw4.js +0 -1
  153. package/dist/client/assets/classDiagram-2ON5EDUG-y6v_VfOs.js +0 -1
  154. package/dist/client/assets/classDiagram-v2-WZHVMYZB-y6v_VfOs.js +0 -1
  155. package/dist/client/assets/clone-B_3XeJsO.js +0 -1
  156. package/dist/client/assets/main-CmUn6n9o.css +0 -1
  157. package/dist/client/assets/stateDiagram-v2-4FDKWEC3-D5laPTLF.js +0 -1
  158. package/dist/client/assets/workspace._workspaceId-CdoxJFsY.js +0 -1
  159. package/dist/client/assets/xterm-CPJFL3h0.js +0 -10
  160. package/dist/server/assets/_tanstack-start-manifest_v-CfuLu7F9.js +0 -4
@@ -1283,7 +1283,7 @@ var require_sonic_boom = __commonJS({
1283
1283
  if (!(this instanceof SonicBoom)) {
1284
1284
  return new SonicBoom(opts);
1285
1285
  }
1286
- let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
1286
+ let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir: mkdir2, retryEAGAIN, fsync, contentMode, mode } = opts || {};
1287
1287
  fd = fd || dest;
1288
1288
  this._len = 0;
1289
1289
  this.fd = -1;
@@ -1308,7 +1308,7 @@ var require_sonic_boom = __commonJS({
1308
1308
  this.append = append || false;
1309
1309
  this.mode = mode;
1310
1310
  this.retryEAGAIN = retryEAGAIN || (() => true);
1311
- this.mkdir = mkdir || false;
1311
+ this.mkdir = mkdir2 || false;
1312
1312
  let fsWriteSync;
1313
1313
  let fsWrite;
1314
1314
  if (contentMode === kContentModeBuffer) {
@@ -2024,7 +2024,7 @@ var require_thread_stream = __commonJS({
2024
2024
  var { version } = require_package();
2025
2025
  var { EventEmitter } = __require("events");
2026
2026
  var { Worker } = __require("worker_threads");
2027
- var { join: join4 } = __require("path");
2027
+ var { join: join7 } = __require("path");
2028
2028
  var { pathToFileURL } = __require("url");
2029
2029
  var { wait } = require_wait();
2030
2030
  var {
@@ -2060,7 +2060,7 @@ var require_thread_stream = __commonJS({
2060
2060
  function createWorker(stream, opts) {
2061
2061
  const { filename, workerData } = opts;
2062
2062
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
2063
- const toExecute = bundlerOverrides["thread-stream-worker"] || join4(__dirname, "lib", "worker.js");
2063
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join7(__dirname, "lib", "worker.js");
2064
2064
  const worker = new Worker(toExecute, {
2065
2065
  ...opts.workerOpts,
2066
2066
  trackUnmanagedFds: false,
@@ -2446,7 +2446,7 @@ var require_transport = __commonJS({
2446
2446
  "use strict";
2447
2447
  var { createRequire } = __require("module");
2448
2448
  var getCallers = require_caller();
2449
- var { join: join4, isAbsolute, sep: sep2 } = __require("node:path");
2449
+ var { join: join7, isAbsolute, sep: sep2 } = __require("node:path");
2450
2450
  var sleep = require_atomic_sleep();
2451
2451
  var onExit = require_on_exit_leak_free();
2452
2452
  var ThreadStream = require_thread_stream();
@@ -2509,7 +2509,7 @@ var require_transport = __commonJS({
2509
2509
  throw new Error("only one of target or targets can be specified");
2510
2510
  }
2511
2511
  if (targets) {
2512
- target = bundlerOverrides["pino-worker"] || join4(__dirname, "worker.js");
2512
+ target = bundlerOverrides["pino-worker"] || join7(__dirname, "worker.js");
2513
2513
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
2514
2514
  return {
2515
2515
  ...dest,
@@ -2527,7 +2527,7 @@ var require_transport = __commonJS({
2527
2527
  });
2528
2528
  });
2529
2529
  } else if (pipeline) {
2530
- target = bundlerOverrides["pino-worker"] || join4(__dirname, "worker.js");
2530
+ target = bundlerOverrides["pino-worker"] || join7(__dirname, "worker.js");
2531
2531
  options.pipelines = [pipeline.map((dest) => {
2532
2532
  return {
2533
2533
  ...dest,
@@ -2549,7 +2549,7 @@ var require_transport = __commonJS({
2549
2549
  return origin;
2550
2550
  }
2551
2551
  if (origin === "pino/file") {
2552
- return join4(__dirname, "..", "file.js");
2552
+ return join7(__dirname, "..", "file.js");
2553
2553
  }
2554
2554
  let fixTarget2;
2555
2555
  for (const filePath of callers) {
@@ -2877,11 +2877,11 @@ var require_tools = __commonJS({
2877
2877
  }
2878
2878
  }
2879
2879
  }
2880
- function buildFormatters(level, bindings, log4) {
2880
+ function buildFormatters(level, bindings, log5) {
2881
2881
  return {
2882
2882
  level,
2883
2883
  bindings,
2884
- log: log4
2884
+ log: log5
2885
2885
  };
2886
2886
  }
2887
2887
  function normalizeDestFileDescriptor(destination) {
@@ -3264,11 +3264,11 @@ var require_proto = __commonJS({
3264
3264
  }
3265
3265
  } else instance[serializersSym] = serializers;
3266
3266
  if (options.hasOwnProperty("formatters")) {
3267
- const { level, bindings: chindings, log: log4 } = options.formatters;
3267
+ const { level, bindings: chindings, log: log5 } = options.formatters;
3268
3268
  instance[formattersSym] = buildFormatters(
3269
3269
  level || formatters.level,
3270
3270
  chindings || resetChildingsFormatter,
3271
- log4 || formatters.log
3271
+ log5 || formatters.log
3272
3272
  );
3273
3273
  } else {
3274
3274
  instance[formattersSym] = buildFormatters(
@@ -3538,7 +3538,7 @@ var require_safe_stable_stringify = __commonJS({
3538
3538
  return circularValue;
3539
3539
  }
3540
3540
  let res = "";
3541
- let join4 = ",";
3541
+ let join7 = ",";
3542
3542
  const originalIndentation = indentation;
3543
3543
  if (Array.isArray(value)) {
3544
3544
  if (value.length === 0) {
@@ -3552,7 +3552,7 @@ var require_safe_stable_stringify = __commonJS({
3552
3552
  indentation += spacer;
3553
3553
  res += `
3554
3554
  ${indentation}`;
3555
- join4 = `,
3555
+ join7 = `,
3556
3556
  ${indentation}`;
3557
3557
  }
3558
3558
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3560,13 +3560,13 @@ ${indentation}`;
3560
3560
  for (; i < maximumValuesToStringify - 1; i++) {
3561
3561
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3562
3562
  res += tmp2 !== void 0 ? tmp2 : "null";
3563
- res += join4;
3563
+ res += join7;
3564
3564
  }
3565
3565
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
3566
3566
  res += tmp !== void 0 ? tmp : "null";
3567
3567
  if (value.length - 1 > maximumBreadth) {
3568
3568
  const removedKeys = value.length - maximumBreadth - 1;
3569
- res += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
3569
+ res += `${join7}"... ${getItemCount(removedKeys)} not stringified"`;
3570
3570
  }
3571
3571
  if (spacer !== "") {
3572
3572
  res += `
@@ -3587,7 +3587,7 @@ ${originalIndentation}`;
3587
3587
  let separator = "";
3588
3588
  if (spacer !== "") {
3589
3589
  indentation += spacer;
3590
- join4 = `,
3590
+ join7 = `,
3591
3591
  ${indentation}`;
3592
3592
  whitespace = " ";
3593
3593
  }
@@ -3601,13 +3601,13 @@ ${indentation}`;
3601
3601
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
3602
3602
  if (tmp !== void 0) {
3603
3603
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3604
- separator = join4;
3604
+ separator = join7;
3605
3605
  }
3606
3606
  }
3607
3607
  if (keyLength > maximumBreadth) {
3608
3608
  const removedKeys = keyLength - maximumBreadth;
3609
3609
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
3610
- separator = join4;
3610
+ separator = join7;
3611
3611
  }
3612
3612
  if (spacer !== "" && separator.length > 1) {
3613
3613
  res = `
@@ -3648,7 +3648,7 @@ ${originalIndentation}`;
3648
3648
  }
3649
3649
  const originalIndentation = indentation;
3650
3650
  let res = "";
3651
- let join4 = ",";
3651
+ let join7 = ",";
3652
3652
  if (Array.isArray(value)) {
3653
3653
  if (value.length === 0) {
3654
3654
  return "[]";
@@ -3661,7 +3661,7 @@ ${originalIndentation}`;
3661
3661
  indentation += spacer;
3662
3662
  res += `
3663
3663
  ${indentation}`;
3664
- join4 = `,
3664
+ join7 = `,
3665
3665
  ${indentation}`;
3666
3666
  }
3667
3667
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -3669,13 +3669,13 @@ ${indentation}`;
3669
3669
  for (; i < maximumValuesToStringify - 1; i++) {
3670
3670
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3671
3671
  res += tmp2 !== void 0 ? tmp2 : "null";
3672
- res += join4;
3672
+ res += join7;
3673
3673
  }
3674
3674
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
3675
3675
  res += tmp !== void 0 ? tmp : "null";
3676
3676
  if (value.length - 1 > maximumBreadth) {
3677
3677
  const removedKeys = value.length - maximumBreadth - 1;
3678
- res += `${join4}"... ${getItemCount(removedKeys)} not stringified"`;
3678
+ res += `${join7}"... ${getItemCount(removedKeys)} not stringified"`;
3679
3679
  }
3680
3680
  if (spacer !== "") {
3681
3681
  res += `
@@ -3688,7 +3688,7 @@ ${originalIndentation}`;
3688
3688
  let whitespace = "";
3689
3689
  if (spacer !== "") {
3690
3690
  indentation += spacer;
3691
- join4 = `,
3691
+ join7 = `,
3692
3692
  ${indentation}`;
3693
3693
  whitespace = " ";
3694
3694
  }
@@ -3697,7 +3697,7 @@ ${indentation}`;
3697
3697
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
3698
3698
  if (tmp !== void 0) {
3699
3699
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
3700
- separator = join4;
3700
+ separator = join7;
3701
3701
  }
3702
3702
  }
3703
3703
  if (spacer !== "" && separator.length > 1) {
@@ -3755,20 +3755,20 @@ ${originalIndentation}`;
3755
3755
  indentation += spacer;
3756
3756
  let res2 = `
3757
3757
  ${indentation}`;
3758
- const join5 = `,
3758
+ const join8 = `,
3759
3759
  ${indentation}`;
3760
3760
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
3761
3761
  let i = 0;
3762
3762
  for (; i < maximumValuesToStringify - 1; i++) {
3763
3763
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3764
3764
  res2 += tmp2 !== void 0 ? tmp2 : "null";
3765
- res2 += join5;
3765
+ res2 += join8;
3766
3766
  }
3767
3767
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
3768
3768
  res2 += tmp !== void 0 ? tmp : "null";
3769
3769
  if (value.length - 1 > maximumBreadth) {
3770
3770
  const removedKeys = value.length - maximumBreadth - 1;
3771
- res2 += `${join5}"... ${getItemCount(removedKeys)} not stringified"`;
3771
+ res2 += `${join8}"... ${getItemCount(removedKeys)} not stringified"`;
3772
3772
  }
3773
3773
  res2 += `
3774
3774
  ${originalIndentation}`;
@@ -3784,16 +3784,16 @@ ${originalIndentation}`;
3784
3784
  return '"[Object]"';
3785
3785
  }
3786
3786
  indentation += spacer;
3787
- const join4 = `,
3787
+ const join7 = `,
3788
3788
  ${indentation}`;
3789
3789
  let res = "";
3790
3790
  let separator = "";
3791
3791
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
3792
3792
  if (isTypedArrayWithEntries(value)) {
3793
- res += stringifyTypedArray(value, join4, maximumBreadth);
3793
+ res += stringifyTypedArray(value, join7, maximumBreadth);
3794
3794
  keys = keys.slice(value.length);
3795
3795
  maximumPropertiesToStringify -= value.length;
3796
- separator = join4;
3796
+ separator = join7;
3797
3797
  }
3798
3798
  if (deterministic) {
3799
3799
  keys = sort(keys, comparator);
@@ -3804,13 +3804,13 @@ ${indentation}`;
3804
3804
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
3805
3805
  if (tmp !== void 0) {
3806
3806
  res += `${separator}${strEscape(key2)}: ${tmp}`;
3807
- separator = join4;
3807
+ separator = join7;
3808
3808
  }
3809
3809
  }
3810
3810
  if (keyLength > maximumBreadth) {
3811
3811
  const removedKeys = keyLength - maximumBreadth;
3812
3812
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
3813
- separator = join4;
3813
+ separator = join7;
3814
3814
  }
3815
3815
  if (separator !== "") {
3816
3816
  res = `
@@ -4336,9 +4336,9 @@ var require_pino = __commonJS({
4336
4336
  }
4337
4337
  });
4338
4338
 
4339
- // ../../node_modules/.pnpm/@xterm+headless@6.1.0-beta.291/node_modules/@xterm/headless/lib-headless/xterm-headless.js
4339
+ // ../../node_modules/.pnpm/@xterm+headless@6.1.0-beta.302/node_modules/@xterm/headless/lib-headless/xterm-headless.js
4340
4340
  var require_xterm_headless = __commonJS({
4341
- "../../node_modules/.pnpm/@xterm+headless@6.1.0-beta.291/node_modules/@xterm/headless/lib-headless/xterm-headless.js"(exports) {
4341
+ "../../node_modules/.pnpm/@xterm+headless@6.1.0-beta.302/node_modules/@xterm/headless/lib-headless/xterm-headless.js"(exports) {
4342
4342
  (() => {
4343
4343
  "use strict";
4344
4344
  var e = { 132(e2, t2, i2) {
@@ -4487,9 +4487,9 @@ var require_xterm_headless = __commonJS({
4487
4487
  t2.CircularList = n2;
4488
4488
  }, 777(e2, t2, i2) {
4489
4489
  Object.defineProperty(t2, "__esModule", { value: true }), t2.CoreTerminal = void 0;
4490
- const s2 = i2(501), r2 = i2(25), n2 = i2(276), a = i2(640), o = i2(56), h = i2(71), c = i2(240), l = i2(428), _ = i2(415), d = i2(746), u = i2(882), f = i2(486), g = i2(562), p = i2(811), v = i2(636), S = i2(812);
4491
- let b = false;
4492
- class m extends S.Disposable {
4490
+ const s2 = i2(501), r2 = i2(25), n2 = i2(276), a = i2(640), o = i2(56), h = i2(71), c = i2(240), l = i2(428), _ = i2(415), d = i2(746), u = i2(882), f = i2(486), p = i2(562), g = i2(811), v = i2(636), b = i2(812);
4491
+ let S = false;
4492
+ class m extends b.Disposable {
4493
4493
  get onScroll() {
4494
4494
  return this._onScrollApi || (this._onScrollApi = this._register(new v.Emitter()), this._onScroll.event((e3) => {
4495
4495
  this._onScrollApi?.fire(e3.position);
@@ -4511,15 +4511,15 @@ var require_xterm_headless = __commonJS({
4511
4511
  for (const t3 in e3) this.optionsService.options[t3] = e3[t3];
4512
4512
  }
4513
4513
  constructor(e3) {
4514
- super(), this._windowsWrappingHeuristics = this._register(new S.MutableDisposable()), this._onBinary = this._register(new v.Emitter()), this.onBinary = this._onBinary.event, this._onData = this._register(new v.Emitter()), this.onData = this._onData.event, this._onLineFeed = this._register(new v.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onRender = this._register(new v.Emitter()), this.onRender = this._onRender.event, this._onResize = this._register(new v.Emitter()), this.onResize = this._onResize.event, this._onWriteParsed = this._register(new v.Emitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this._register(new v.Emitter()), this._instantiationService = new r2.InstantiationService(), this.optionsService = this._register(new o.OptionsService(e3)), this._instantiationService.setService(s2.IOptionsService, this.optionsService), this._logService = this._register(this._instantiationService.createInstance(n2.LogService)), this._instantiationService.setService(s2.ILogService, this._logService), this._bufferService = this._register(this._instantiationService.createInstance(a.BufferService)), this._instantiationService.setService(s2.IBufferService, this._bufferService), this.coreService = this._register(this._instantiationService.createInstance(h.CoreService)), this._instantiationService.setService(s2.ICoreService, this.coreService), this.mouseStateService = this._register(this._instantiationService.createInstance(c.MouseStateService)), this._instantiationService.setService(s2.IMouseStateService, this.mouseStateService), this.unicodeService = this._register(this._instantiationService.createInstance(_.UnicodeService)), this.unicodeService.register(new l.UnicodeV6()), this._instantiationService.setService(s2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(d.CharsetService), this._instantiationService.setService(s2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(p.OscLinkService), this._instantiationService.setService(s2.IOscLinkService, this._oscLinkService), this._inputHandler = this._register(new f.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.mouseStateService, this.unicodeService)), this._register(v.EventUtils.forward(this._inputHandler.onLineFeed, this._onLineFeed)), this._register(v.EventUtils.forward(this._bufferService.onResize, this._onResize)), this._register(v.EventUtils.forward(this.coreService.onData, this._onData)), this._register(v.EventUtils.forward(this.coreService.onBinary, this._onBinary)), this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true))), this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())), this._register(this.optionsService.onMultipleOptionChange(["windowsPty"], () => this._handleWindowsPtyOptionChange())), this._register(this._bufferService.onScroll(() => {
4514
+ super(), this._windowsWrappingHeuristics = this._register(new b.MutableDisposable()), this._onBinary = this._register(new v.Emitter()), this.onBinary = this._onBinary.event, this._onData = this._register(new v.Emitter()), this.onData = this._onData.event, this._onLineFeed = this._register(new v.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onRender = this._register(new v.Emitter()), this.onRender = this._onRender.event, this._onResize = this._register(new v.Emitter()), this.onResize = this._onResize.event, this._onWriteParsed = this._register(new v.Emitter()), this.onWriteParsed = this._onWriteParsed.event, this._onScroll = this._register(new v.Emitter()), this._instantiationService = new r2.InstantiationService(), this.optionsService = this._register(new o.OptionsService(e3)), this._instantiationService.setService(s2.IOptionsService, this.optionsService), this._logService = this._register(this._instantiationService.createInstance(n2.LogService)), this._instantiationService.setService(s2.ILogService, this._logService), this._bufferService = this._register(this._instantiationService.createInstance(a.BufferService)), this._instantiationService.setService(s2.IBufferService, this._bufferService), this.coreService = this._register(this._instantiationService.createInstance(h.CoreService)), this._instantiationService.setService(s2.ICoreService, this.coreService), this.mouseStateService = this._register(this._instantiationService.createInstance(c.MouseStateService)), this._instantiationService.setService(s2.IMouseStateService, this.mouseStateService), this.unicodeService = this._register(this._instantiationService.createInstance(_.UnicodeService)), this.unicodeService.register(new l.UnicodeV6()), this._instantiationService.setService(s2.IUnicodeService, this.unicodeService), this._charsetService = this._instantiationService.createInstance(d.CharsetService), this._instantiationService.setService(s2.ICharsetService, this._charsetService), this._oscLinkService = this._instantiationService.createInstance(g.OscLinkService), this._instantiationService.setService(s2.IOscLinkService, this._oscLinkService), this._inputHandler = this._register(new f.InputHandler(this._bufferService, this._charsetService, this.coreService, this._logService, this.optionsService, this._oscLinkService, this.mouseStateService, this.unicodeService)), this._register(v.EventUtils.forward(this._inputHandler.onLineFeed, this._onLineFeed)), this._register(v.EventUtils.forward(this._bufferService.onResize, this._onResize)), this._register(v.EventUtils.forward(this.coreService.onData, this._onData)), this._register(v.EventUtils.forward(this.coreService.onBinary, this._onBinary)), this._register(this.coreService.onRequestScrollToBottom(() => this.scrollToBottom(true))), this._register(this.coreService.onUserInput(() => this._writeBuffer.handleUserInput())), this._register(this.optionsService.onMultipleOptionChange(["windowsPty"], () => this._handleWindowsPtyOptionChange())), this._register(this._bufferService.onScroll(() => {
4515
4515
  this._onScroll.fire({ position: this._bufferService.buffer.ydisp }), this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom);
4516
- })), this._writeBuffer = this._register(new g.WriteBuffer((e4, t3) => this._inputHandler.parse(e4, t3))), this._register(v.EventUtils.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
4516
+ })), this._writeBuffer = this._register(new p.WriteBuffer((e4, t3) => this._inputHandler.parse(e4, t3))), this._register(v.EventUtils.forward(this._writeBuffer.onWriteParsed, this._onWriteParsed));
4517
4517
  }
4518
4518
  write(e3, t3) {
4519
4519
  this._writeBuffer.write(e3, t3);
4520
4520
  }
4521
4521
  writeSync(e3, t3) {
4522
- this._logService.logLevel <= s2.LogLevelEnum.WARN && !b && (this._logService.warn("writeSync is unreliable and will be removed soon."), b = true), this._writeBuffer.writeSync(e3, t3);
4522
+ this._logService.logLevel <= s2.LogLevelEnum.WARN && !S && (this._logService.warn("writeSync is unreliable and will be removed soon."), S = true), this._writeBuffer.writeSync(e3, t3);
4523
4523
  }
4524
4524
  input(e3, t3 = true) {
4525
4525
  this.coreService.triggerDataEvent(e3, t3);
@@ -4575,7 +4575,7 @@ var require_xterm_headless = __commonJS({
4575
4575
  _enableWindowsWrappingHeuristics() {
4576
4576
  if (!this._windowsWrappingHeuristics.value) {
4577
4577
  const e3 = [];
4578
- e3.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, () => ((0, u.updateWindowsModeWrappedState)(this._bufferService), false))), this._windowsWrappingHeuristics.value = (0, S.toDisposable)(() => {
4578
+ e3.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null, this._bufferService))), e3.push(this.registerCsiHandler({ final: "H" }, () => ((0, u.updateWindowsModeWrappedState)(this._bufferService), false))), this._windowsWrappingHeuristics.value = (0, b.toDisposable)(() => {
4579
4579
  for (const t3 of e3) t3.dispose();
4580
4580
  });
4581
4581
  }
@@ -4595,27 +4595,19 @@ var require_xterm_headless = __commonJS({
4595
4595
  if (this._disposed) return (0, s2.toDisposable)(() => {
4596
4596
  });
4597
4597
  const r3 = { fn: e3, thisArgs: t3 };
4598
- this._listeners.push(r3);
4598
+ this._listeners = this._listeners.slice(), this._listeners.push(r3);
4599
4599
  const n2 = (0, s2.toDisposable)(() => {
4600
4600
  const e4 = this._listeners.indexOf(r3);
4601
- -1 !== e4 && this._listeners.splice(e4, 1);
4601
+ -1 !== e4 && (this._listeners = this._listeners.slice(), this._listeners.splice(e4, 1));
4602
4602
  });
4603
4603
  return i3 && (Array.isArray(i3) ? i3.push(n2) : i3.add(n2)), n2;
4604
4604
  }), this._event;
4605
4605
  }
4606
4606
  fire(e3) {
4607
- if (!this._disposed) switch (this._listeners.length) {
4608
- case 0:
4609
- return;
4610
- case 1: {
4611
- const { fn: t3, thisArgs: i3 } = this._listeners[0];
4612
- return void t3.call(i3, e3);
4613
- }
4614
- default: {
4615
- const t3 = this._listeners.slice();
4616
- for (const { fn: i3, thisArgs: s3 } of t3) i3.call(s3, e3);
4617
- }
4618
- }
4607
+ if (this._disposed || !this._listeners.length) return;
4608
+ if (1 === this._listeners.length) return void this._listeners[0].fn.call(this._listeners[0].thisArgs, e3);
4609
+ const t3 = this._listeners;
4610
+ for (let i3 = 0, s3 = t3.length; i3 < s3; ++i3) t3[i3].fn.call(t3[i3].thisArgs, e3);
4619
4611
  }
4620
4612
  dispose() {
4621
4613
  this._disposed || (this._disposed = true, this._listeners.length = 0);
@@ -4647,7 +4639,7 @@ var require_xterm_headless = __commonJS({
4647
4639
  };
4648
4640
  };
4649
4641
  Object.defineProperty(t2, "__esModule", { value: true }), t2.InputHandler = t2.WindowsOptionsReportType = void 0, t2.isValidColorIndex = E;
4650
- const n2 = i2(760), a = i2(717), o = i2(812), h = i2(726), c = i2(107), l = i2(938), _ = i2(55), d = i2(451), u = i2(501), f = i2(415), g = i2(346), p = i2(823), v = i2(607), S = i2(693), b = i2(636), m = i2(804), y = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 };
4642
+ const n2 = i2(760), a = i2(717), o = i2(812), h = i2(726), c = i2(107), l = i2(938), _ = i2(55), d = i2(451), u = i2(501), f = i2(415), p = i2(346), g = i2(823), v = i2(607), b = i2(693), S = i2(636), m = i2(804), y = { "(": 0, ")": 1, "*": 2, "+": 3, "-": 1, ".": 2 };
4651
4643
  function C(e3, t3) {
4652
4644
  if (e3 > 24) return t3.setWinLines || false;
4653
4645
  switch (e3) {
@@ -4708,7 +4700,7 @@ var require_xterm_headless = __commonJS({
4708
4700
  return this._curAttrData;
4709
4701
  }
4710
4702
  constructor(e3, t3, i3, s3, r3, o2, l2, _2, d2 = new a.EscapeSequenceParser()) {
4711
- super(), this._bufferService = e3, this._charsetService = t3, this._coreService = i3, this._logService = s3, this._optionsService = r3, this._oscLinkService = o2, this._mouseStateService = l2, this._unicodeService = _2, this._parser = d2, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new h.StringToUtf32(), this._utf8Decoder = new h.Utf8ToUtf32(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = c.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = c.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this._register(new b.Emitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this._register(new b.Emitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this._register(new b.Emitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this._register(new b.Emitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this._register(new b.Emitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this._register(new b.Emitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this._register(new b.Emitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this._register(new b.Emitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this._register(new b.Emitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this._register(new b.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this._register(new b.Emitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this._register(new b.Emitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this._register(new b.Emitter()), this.onColor = this._onColor.event, this._onRequestColorSchemeQuery = this._register(new b.Emitter()), this.onRequestColorSchemeQuery = this._onRequestColorSchemeQuery.event, this._parseStack = { paused: false, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this._register(this._parser), this._dirtyRowTracker = new A(this._bufferService), this._activeBuffer = this._bufferService.buffer, this._register(this._bufferService.buffers.onBufferActivate((e4) => this._activeBuffer = e4.activeBuffer)), this._parser.setCsiHandlerFallback((e4, t4) => {
4703
+ super(), this._bufferService = e3, this._charsetService = t3, this._coreService = i3, this._logService = s3, this._optionsService = r3, this._oscLinkService = o2, this._mouseStateService = l2, this._unicodeService = _2, this._parser = d2, this._parseBuffer = new Uint32Array(4096), this._stringDecoder = new h.StringToUtf32(), this._utf8Decoder = new h.Utf8ToUtf32(), this._windowTitle = "", this._iconName = "", this._windowTitleStack = [], this._iconNameStack = [], this._curAttrData = c.DEFAULT_ATTR_DATA.clone(), this._eraseAttrDataInternal = c.DEFAULT_ATTR_DATA.clone(), this._onRequestBell = this._register(new S.Emitter()), this.onRequestBell = this._onRequestBell.event, this._onRequestRefreshRows = this._register(new S.Emitter()), this.onRequestRefreshRows = this._onRequestRefreshRows.event, this._onRequestReset = this._register(new S.Emitter()), this.onRequestReset = this._onRequestReset.event, this._onRequestSendFocus = this._register(new S.Emitter()), this.onRequestSendFocus = this._onRequestSendFocus.event, this._onRequestSyncScrollBar = this._register(new S.Emitter()), this.onRequestSyncScrollBar = this._onRequestSyncScrollBar.event, this._onRequestWindowsOptionsReport = this._register(new S.Emitter()), this.onRequestWindowsOptionsReport = this._onRequestWindowsOptionsReport.event, this._onA11yChar = this._register(new S.Emitter()), this.onA11yChar = this._onA11yChar.event, this._onA11yTab = this._register(new S.Emitter()), this.onA11yTab = this._onA11yTab.event, this._onCursorMove = this._register(new S.Emitter()), this.onCursorMove = this._onCursorMove.event, this._onLineFeed = this._register(new S.Emitter()), this.onLineFeed = this._onLineFeed.event, this._onScroll = this._register(new S.Emitter()), this.onScroll = this._onScroll.event, this._onTitleChange = this._register(new S.Emitter()), this.onTitleChange = this._onTitleChange.event, this._onColor = this._register(new S.Emitter()), this.onColor = this._onColor.event, this._onRequestColorSchemeQuery = this._register(new S.Emitter()), this.onRequestColorSchemeQuery = this._onRequestColorSchemeQuery.event, this._parseStack = { paused: false, cursorStartX: 0, cursorStartY: 0, decodedLength: 0, position: 0 }, this._specialColors = [256, 257, 258], this._register(this._parser), this._dirtyRowTracker = new A(this._bufferService), this._activeBuffer = this._bufferService.buffer, this._register(this._bufferService.buffers.onBufferActivate((e4) => this._activeBuffer = e4.activeBuffer)), this._parser.setCsiHandlerFallback((e4, t4) => {
4712
4704
  this._logService.debug("Unknown CSI code: ", { identifier: this._parser.identToString(e4), params: t4.toArray() });
4713
4705
  }), this._parser.setEscHandlerFallback((e4) => {
4714
4706
  this._logService.debug("Unknown ESC code: ", { identifier: this._parser.identToString(e4) });
@@ -4720,9 +4712,9 @@ var require_xterm_headless = __commonJS({
4720
4712
  "HOOK" === t4 && (i4 = i4.toArray()), this._logService.debug("Unknown DCS code: ", { identifier: this._parser.identToString(e4), action: t4, payload: i4 });
4721
4713
  }), this._parser.setApcHandlerFallback((e4, t4, i4) => {
4722
4714
  this._logService.debug("Unknown APC code: ", { identifier: this._parser.identToString(e4), action: t4, payload: i4 });
4723
- }), this._parser.setPrintHandler((e4, t4, i4) => this.print(e4, t4, i4)), this._parser.registerCsiHandler({ final: "@" }, (e4) => this.insertChars(e4)), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, (e4) => this.scrollLeft(e4)), this._parser.registerCsiHandler({ final: "A" }, (e4) => this.cursorUp(e4)), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, (e4) => this.scrollRight(e4)), this._parser.registerCsiHandler({ final: "B" }, (e4) => this.cursorDown(e4)), this._parser.registerCsiHandler({ final: "C" }, (e4) => this.cursorForward(e4)), this._parser.registerCsiHandler({ final: "D" }, (e4) => this.cursorBackward(e4)), this._parser.registerCsiHandler({ final: "E" }, (e4) => this.cursorNextLine(e4)), this._parser.registerCsiHandler({ final: "F" }, (e4) => this.cursorPrecedingLine(e4)), this._parser.registerCsiHandler({ final: "G" }, (e4) => this.cursorCharAbsolute(e4)), this._parser.registerCsiHandler({ final: "H" }, (e4) => this.cursorPosition(e4)), this._parser.registerCsiHandler({ final: "I" }, (e4) => this.cursorForwardTab(e4)), this._parser.registerCsiHandler({ final: "J" }, (e4) => this.eraseInDisplay(e4, false)), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, (e4) => this.eraseInDisplay(e4, true)), this._parser.registerCsiHandler({ final: "K" }, (e4) => this.eraseInLine(e4, false)), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, (e4) => this.eraseInLine(e4, true)), this._parser.registerCsiHandler({ final: "L" }, (e4) => this.insertLines(e4)), this._parser.registerCsiHandler({ final: "M" }, (e4) => this.deleteLines(e4)), this._parser.registerCsiHandler({ final: "P" }, (e4) => this.deleteChars(e4)), this._parser.registerCsiHandler({ final: "S" }, (e4) => this.scrollUp(e4)), this._parser.registerCsiHandler({ final: "T" }, (e4) => this.scrollDown(e4)), this._parser.registerCsiHandler({ final: "X" }, (e4) => this.eraseChars(e4)), this._parser.registerCsiHandler({ final: "Z" }, (e4) => this.cursorBackwardTab(e4)), this._parser.registerCsiHandler({ final: "^" }, (e4) => this.scrollDown(e4)), this._parser.registerCsiHandler({ final: "`" }, (e4) => this.charPosAbsolute(e4)), this._parser.registerCsiHandler({ final: "a" }, (e4) => this.hPositionRelative(e4)), this._parser.registerCsiHandler({ final: "b" }, (e4) => this.repeatPrecedingCharacter(e4)), this._parser.registerCsiHandler({ final: "c" }, (e4) => this.sendDeviceAttributesPrimary(e4)), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, (e4) => this.sendDeviceAttributesSecondary(e4)), this._parser.registerCsiHandler({ final: "d" }, (e4) => this.linePosAbsolute(e4)), this._parser.registerCsiHandler({ final: "e" }, (e4) => this.vPositionRelative(e4)), this._parser.registerCsiHandler({ final: "f" }, (e4) => this.hVPosition(e4)), this._parser.registerCsiHandler({ final: "g" }, (e4) => this.tabClear(e4)), this._parser.registerCsiHandler({ final: "h" }, (e4) => this.setMode(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, (e4) => this.setModePrivate(e4)), this._parser.registerCsiHandler({ final: "l" }, (e4) => this.resetMode(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, (e4) => this.resetModePrivate(e4)), this._parser.registerCsiHandler({ final: "m" }, (e4) => this.charAttributes(e4)), this._parser.registerCsiHandler({ final: "n" }, (e4) => this.deviceStatus(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, (e4) => this.deviceStatusPrivate(e4)), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, (e4) => this.softReset(e4)), this._parser.registerCsiHandler({ prefix: ">", final: "q" }, (e4) => this.sendXtVersion(e4)), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, (e4) => this.setCursorStyle(e4)), this._parser.registerCsiHandler({ final: "r" }, (e4) => this.setScrollRegion(e4)), this._parser.registerCsiHandler({ final: "s" }, (e4) => this.saveCursor(e4)), this._parser.registerCsiHandler({ final: "t" }, (e4) => this.windowOptions(e4)), this._parser.registerCsiHandler({ final: "u" }, (e4) => this.restoreCursor(e4)), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, (e4) => this.insertColumns(e4)), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, (e4) => this.deleteColumns(e4)), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, (e4) => this.selectProtected(e4)), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, (e4) => this.requestMode(e4, true)), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, (e4) => this.requestMode(e4, false)), this._parser.registerCsiHandler({ prefix: "=", final: "u" }, (e4) => this.kittyKeyboardSet(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "u" }, (e4) => this.kittyKeyboardQuery(e4)), this._parser.registerCsiHandler({ prefix: ">", final: "u" }, (e4) => this.kittyKeyboardPush(e4)), this._parser.registerCsiHandler({ prefix: "<", final: "u" }, (e4) => this.kittyKeyboardPop(e4)), this._parser.setExecuteHandler("\x07", () => this.bell()), this._parser.setExecuteHandler("\n", () => this.lineFeed()), this._parser.setExecuteHandler("\v", () => this.lineFeed()), this._parser.setExecuteHandler("\f", () => this.lineFeed()), this._parser.setExecuteHandler("\r", () => this.carriageReturn()), this._parser.setExecuteHandler("\b", () => this.backspace()), this._parser.setExecuteHandler(" ", () => this.tab()), this._parser.setExecuteHandler("", () => this.shiftOut()), this._parser.setExecuteHandler("", () => this.shiftIn()), this._parser.setExecuteHandler("\x84", () => this.index()), this._parser.setExecuteHandler("\x85", () => this.nextLine()), this._parser.setExecuteHandler("\x88", () => this.tabSet()), this._parser.registerOscHandler(0, new g.OscHandler((e4) => (this.setTitle(e4), this.setIconName(e4), true))), this._parser.registerOscHandler(1, new g.OscHandler((e4) => this.setIconName(e4))), this._parser.registerOscHandler(2, new g.OscHandler((e4) => this.setTitle(e4))), this._parser.registerOscHandler(4, new g.OscHandler((e4) => this.setOrReportIndexedColor(e4))), this._parser.registerOscHandler(8, new g.OscHandler((e4) => this.setHyperlink(e4))), this._parser.registerOscHandler(10, new g.OscHandler((e4) => this.setOrReportFgColor(e4))), this._parser.registerOscHandler(11, new g.OscHandler((e4) => this.setOrReportBgColor(e4))), this._parser.registerOscHandler(12, new g.OscHandler((e4) => this.setOrReportCursorColor(e4))), this._parser.registerOscHandler(104, new g.OscHandler((e4) => this.restoreIndexedColor(e4))), this._parser.registerOscHandler(110, new g.OscHandler((e4) => this.restoreFgColor(e4))), this._parser.registerOscHandler(111, new g.OscHandler((e4) => this.restoreBgColor(e4))), this._parser.registerOscHandler(112, new g.OscHandler((e4) => this.restoreCursorColor(e4))), this._parser.registerEscHandler({ final: "7" }, () => this.saveCursor()), this._parser.registerEscHandler({ final: "8" }, () => this.restoreCursor()), this._parser.registerEscHandler({ final: "D" }, () => this.index()), this._parser.registerEscHandler({ final: "E" }, () => this.nextLine()), this._parser.registerEscHandler({ final: "H" }, () => this.tabSet()), this._parser.registerEscHandler({ final: "M" }, () => this.reverseIndex()), this._parser.registerEscHandler({ final: "=" }, () => this.keypadApplicationMode()), this._parser.registerEscHandler({ final: ">" }, () => this.keypadNumericMode()), this._parser.registerEscHandler({ final: "c" }, () => this.fullReset()), this._parser.registerEscHandler({ final: "n" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "o" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "|" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "}" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "~" }, () => this.setgLevel(1)), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, () => this.selectDefaultCharset()), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, () => this.selectDefaultCharset());
4715
+ }), this._parser.setPrintHandler((e4, t4, i4) => this.print(e4, t4, i4)), this._parser.registerCsiHandler({ final: "@" }, (e4) => this.insertChars(e4)), this._parser.registerCsiHandler({ intermediates: " ", final: "@" }, (e4) => this.scrollLeft(e4)), this._parser.registerCsiHandler({ final: "A" }, (e4) => this.cursorUp(e4)), this._parser.registerCsiHandler({ intermediates: " ", final: "A" }, (e4) => this.scrollRight(e4)), this._parser.registerCsiHandler({ final: "B" }, (e4) => this.cursorDown(e4)), this._parser.registerCsiHandler({ final: "C" }, (e4) => this.cursorForward(e4)), this._parser.registerCsiHandler({ final: "D" }, (e4) => this.cursorBackward(e4)), this._parser.registerCsiHandler({ final: "E" }, (e4) => this.cursorNextLine(e4)), this._parser.registerCsiHandler({ final: "F" }, (e4) => this.cursorPrecedingLine(e4)), this._parser.registerCsiHandler({ final: "G" }, (e4) => this.cursorCharAbsolute(e4)), this._parser.registerCsiHandler({ final: "H" }, (e4) => this.cursorPosition(e4)), this._parser.registerCsiHandler({ final: "I" }, (e4) => this.cursorForwardTab(e4)), this._parser.registerCsiHandler({ final: "J" }, (e4) => this.eraseInDisplay(e4, false)), this._parser.registerCsiHandler({ prefix: "?", final: "J" }, (e4) => this.eraseInDisplay(e4, true)), this._parser.registerCsiHandler({ final: "K" }, (e4) => this.eraseInLine(e4, false)), this._parser.registerCsiHandler({ prefix: "?", final: "K" }, (e4) => this.eraseInLine(e4, true)), this._parser.registerCsiHandler({ final: "L" }, (e4) => this.insertLines(e4)), this._parser.registerCsiHandler({ final: "M" }, (e4) => this.deleteLines(e4)), this._parser.registerCsiHandler({ final: "P" }, (e4) => this.deleteChars(e4)), this._parser.registerCsiHandler({ final: "S" }, (e4) => this.scrollUp(e4)), this._parser.registerCsiHandler({ final: "T" }, (e4) => this.scrollDown(e4)), this._parser.registerCsiHandler({ final: "X" }, (e4) => this.eraseChars(e4)), this._parser.registerCsiHandler({ final: "Z" }, (e4) => this.cursorBackwardTab(e4)), this._parser.registerCsiHandler({ final: "^" }, (e4) => this.scrollDown(e4)), this._parser.registerCsiHandler({ final: "`" }, (e4) => this.charPosAbsolute(e4)), this._parser.registerCsiHandler({ final: "a" }, (e4) => this.hPositionRelative(e4)), this._parser.registerCsiHandler({ final: "b" }, (e4) => this.repeatPrecedingCharacter(e4)), this._parser.registerCsiHandler({ final: "c" }, (e4) => this.sendDeviceAttributesPrimary(e4)), this._parser.registerCsiHandler({ prefix: ">", final: "c" }, (e4) => this.sendDeviceAttributesSecondary(e4)), this._parser.registerCsiHandler({ final: "d" }, (e4) => this.linePosAbsolute(e4)), this._parser.registerCsiHandler({ final: "e" }, (e4) => this.vPositionRelative(e4)), this._parser.registerCsiHandler({ final: "f" }, (e4) => this.hVPosition(e4)), this._parser.registerCsiHandler({ final: "g" }, (e4) => this.tabClear(e4)), this._parser.registerCsiHandler({ final: "h" }, (e4) => this.setMode(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "h" }, (e4) => this.setModePrivate(e4)), this._parser.registerCsiHandler({ final: "l" }, (e4) => this.resetMode(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "l" }, (e4) => this.resetModePrivate(e4)), this._parser.registerCsiHandler({ final: "m" }, (e4) => this.charAttributes(e4)), this._parser.registerCsiHandler({ final: "n" }, (e4) => this.deviceStatus(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "n" }, (e4) => this.deviceStatusPrivate(e4)), this._parser.registerCsiHandler({ intermediates: "!", final: "p" }, (e4) => this.softReset(e4)), this._parser.registerCsiHandler({ prefix: ">", final: "q" }, (e4) => this.sendXtVersion(e4)), this._parser.registerCsiHandler({ intermediates: " ", final: "q" }, (e4) => this.setCursorStyle(e4)), this._parser.registerCsiHandler({ final: "r" }, (e4) => this.setScrollRegion(e4)), this._parser.registerCsiHandler({ final: "s" }, (e4) => this.saveCursor(e4)), this._parser.registerCsiHandler({ final: "t" }, (e4) => this.windowOptions(e4)), this._parser.registerCsiHandler({ final: "u" }, (e4) => this.restoreCursor(e4)), this._parser.registerCsiHandler({ intermediates: "'", final: "}" }, (e4) => this.insertColumns(e4)), this._parser.registerCsiHandler({ intermediates: "'", final: "~" }, (e4) => this.deleteColumns(e4)), this._parser.registerCsiHandler({ intermediates: '"', final: "q" }, (e4) => this.selectProtected(e4)), this._parser.registerCsiHandler({ intermediates: "$", final: "p" }, (e4) => this.requestMode(e4, true)), this._parser.registerCsiHandler({ prefix: "?", intermediates: "$", final: "p" }, (e4) => this.requestMode(e4, false)), this._parser.registerCsiHandler({ prefix: "=", final: "u" }, (e4) => this.kittyKeyboardSet(e4)), this._parser.registerCsiHandler({ prefix: "?", final: "u" }, (e4) => this.kittyKeyboardQuery(e4)), this._parser.registerCsiHandler({ prefix: ">", final: "u" }, (e4) => this.kittyKeyboardPush(e4)), this._parser.registerCsiHandler({ prefix: "<", final: "u" }, (e4) => this.kittyKeyboardPop(e4)), this._parser.setExecuteHandler("\x07", () => this.bell()), this._parser.setExecuteHandler("\n", () => this.lineFeed()), this._parser.setExecuteHandler("\v", () => this.lineFeed()), this._parser.setExecuteHandler("\f", () => this.lineFeed()), this._parser.setExecuteHandler("\r", () => this.carriageReturn()), this._parser.setExecuteHandler("\b", () => this.backspace()), this._parser.setExecuteHandler(" ", () => this.tab()), this._parser.setExecuteHandler("", () => this.shiftOut()), this._parser.setExecuteHandler("", () => this.shiftIn()), this._parser.setExecuteHandler("\x84", () => this.index()), this._parser.setExecuteHandler("\x85", () => this.nextLine()), this._parser.setExecuteHandler("\x88", () => this.tabSet()), this._parser.registerOscHandler(0, new p.OscHandler((e4) => (this.setTitle(e4), this.setIconName(e4), true))), this._parser.registerOscHandler(1, new p.OscHandler((e4) => this.setIconName(e4))), this._parser.registerOscHandler(2, new p.OscHandler((e4) => this.setTitle(e4))), this._parser.registerOscHandler(4, new p.OscHandler((e4) => this.setOrReportIndexedColor(e4))), this._parser.registerOscHandler(8, new p.OscHandler((e4) => this.setHyperlink(e4))), this._parser.registerOscHandler(10, new p.OscHandler((e4) => this.setOrReportFgColor(e4))), this._parser.registerOscHandler(11, new p.OscHandler((e4) => this.setOrReportBgColor(e4))), this._parser.registerOscHandler(12, new p.OscHandler((e4) => this.setOrReportCursorColor(e4))), this._parser.registerOscHandler(104, new p.OscHandler((e4) => this.restoreIndexedColor(e4))), this._parser.registerOscHandler(110, new p.OscHandler((e4) => this.restoreFgColor(e4))), this._parser.registerOscHandler(111, new p.OscHandler((e4) => this.restoreBgColor(e4))), this._parser.registerOscHandler(112, new p.OscHandler((e4) => this.restoreCursorColor(e4))), this._parser.registerEscHandler({ final: "7" }, () => this.saveCursor()), this._parser.registerEscHandler({ final: "8" }, () => this.restoreCursor()), this._parser.registerEscHandler({ final: "D" }, () => this.index()), this._parser.registerEscHandler({ final: "E" }, () => this.nextLine()), this._parser.registerEscHandler({ final: "H" }, () => this.tabSet()), this._parser.registerEscHandler({ final: "M" }, () => this.reverseIndex()), this._parser.registerEscHandler({ final: "=" }, () => this.keypadApplicationMode()), this._parser.registerEscHandler({ final: ">" }, () => this.keypadNumericMode()), this._parser.registerEscHandler({ final: "c" }, () => this.fullReset()), this._parser.registerEscHandler({ final: "n" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "o" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "|" }, () => this.setgLevel(3)), this._parser.registerEscHandler({ final: "}" }, () => this.setgLevel(2)), this._parser.registerEscHandler({ final: "~" }, () => this.setgLevel(1)), this._parser.registerEscHandler({ intermediates: "%", final: "@" }, () => this.selectDefaultCharset()), this._parser.registerEscHandler({ intermediates: "%", final: "G" }, () => this.selectDefaultCharset());
4724
4716
  for (const e4 in n2.CHARSETS) this._parser.registerEscHandler({ intermediates: "(", final: e4 }, () => this.selectCharset("(" + e4)), this._parser.registerEscHandler({ intermediates: ")", final: e4 }, () => this.selectCharset(")" + e4)), this._parser.registerEscHandler({ intermediates: "*", final: e4 }, () => this.selectCharset("*" + e4)), this._parser.registerEscHandler({ intermediates: "+", final: e4 }, () => this.selectCharset("+" + e4)), this._parser.registerEscHandler({ intermediates: "-", final: e4 }, () => this.selectCharset("-" + e4)), this._parser.registerEscHandler({ intermediates: ".", final: e4 }, () => this.selectCharset("." + e4)), this._parser.registerEscHandler({ intermediates: "/", final: e4 }, () => this.selectCharset("/" + e4));
4725
- this._parser.registerEscHandler({ intermediates: "#", final: "8" }, () => this.screenAlignmentPattern()), this._parser.setErrorHandler((e4) => (this._logService.error("Parsing error: ", e4), e4)), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new p.DcsHandler((e4, t4) => this.requestStatusString(e4, t4)));
4717
+ this._parser.registerEscHandler({ intermediates: "#", final: "8" }, () => this.screenAlignmentPattern()), this._parser.setErrorHandler((e4) => (this._logService.error("Parsing error: ", e4), e4)), this._parser.registerDcsHandler({ intermediates: "$", final: "q" }, new g.DcsHandler((e4, t4) => this.requestStatusString(e4, t4)));
4726
4718
  }
4727
4719
  _preserveStack(e3, t3, i3, s3) {
4728
4720
  this._parseStack.paused = true, this._parseStack.cursorStartX = e3, this._parseStack.cursorStartY = t3, this._parseStack.decodedLength = i3, this._parseStack.position = s3;
@@ -4766,50 +4758,50 @@ var require_xterm_headless = __commonJS({
4766
4758
  print(e3, t3, i3) {
4767
4759
  let s3, r3;
4768
4760
  const n3 = this._charsetService.charset, a2 = this._optionsService.rawOptions.screenReaderMode, o2 = this._bufferService.cols, _2 = this._coreService.decPrivateModes.wraparound, d2 = this._coreService.modes.insertMode, u2 = this._curAttrData;
4769
- let g2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
4770
- if (!g2) return;
4771
- this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && i3 - t3 > 0 && 2 === g2.getWidth(this._activeBuffer.x - 1) && g2.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, u2);
4772
- let p2 = this._parser.precedingJoinState;
4761
+ let p2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
4762
+ if (!p2) return;
4763
+ this._dirtyRowTracker.markDirty(this._activeBuffer.y), this._activeBuffer.x && i3 - t3 > 0 && 2 === p2.getWidth(this._activeBuffer.x - 1) && p2.setCellFromCodepoint(this._activeBuffer.x - 1, 0, 1, u2);
4764
+ let g2 = this._parser.precedingJoinState;
4773
4765
  for (let v2 = t3; v2 < i3; ++v2) {
4774
4766
  if (s3 = e3[v2], 173 === s3) continue;
4775
4767
  if (s3 < 127 && n3) {
4776
4768
  const e4 = n3[String.fromCharCode(s3)];
4777
4769
  e4 && (s3 = e4.charCodeAt(0));
4778
4770
  }
4779
- const t4 = this._unicodeService.charProperties(s3, p2);
4771
+ const t4 = this._unicodeService.charProperties(s3, g2);
4780
4772
  r3 = f.UnicodeService.extractWidth(t4);
4781
- const i4 = f.UnicodeService.extractShouldJoin(t4), S2 = i4 ? f.UnicodeService.extractWidth(p2) : 0;
4782
- p2 = t4, a2 && this._onA11yChar.fire((0, h.stringFromCodePoint)(s3));
4783
- const b2 = this._getCurrentLinkId();
4784
- if (b2 && this._oscLinkService.addLineToLink(b2, this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r3 - S2 > o2) {
4773
+ const i4 = f.UnicodeService.extractShouldJoin(t4), b2 = i4 ? f.UnicodeService.extractWidth(g2) : 0;
4774
+ g2 = t4, a2 && this._onA11yChar.fire((0, h.stringFromCodePoint)(s3));
4775
+ const S2 = this._getCurrentLinkId();
4776
+ if (S2 && this._oscLinkService.addLineToLink(S2, this._activeBuffer.ybase + this._activeBuffer.y), this._activeBuffer.x + r3 - b2 > o2) {
4785
4777
  if (_2) {
4786
- const e4 = g2;
4787
- let t5 = this._activeBuffer.x - S2;
4788
- if (this._activeBuffer.x = S2, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), true)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = true), g2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), !g2) return;
4789
- for (S2 > 0 && g2 instanceof c.BufferLine && g2.copyCellsFrom(e4, t5, 0, S2, false); t5 < o2; ) e4.setCellFromCodepoint(t5++, 0, 1, u2);
4778
+ const e4 = p2;
4779
+ let t5 = this._activeBuffer.x - b2;
4780
+ if (this._activeBuffer.x = b2, this._activeBuffer.y++, this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--, this._bufferService.scroll(this._eraseAttrData(), true)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1), this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = true), p2 = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y), !p2) return;
4781
+ for (b2 > 0 && p2 instanceof c.BufferLine && p2.copyCellsFrom(e4, t5, 0, b2, false); t5 < o2; ) e4.setCellFromCodepoint(t5++, 0, 1, u2);
4790
4782
  } else if (this._activeBuffer.x = o2 - 1, 2 === r3) continue;
4791
4783
  }
4792
4784
  if (i4 && this._activeBuffer.x) {
4793
- const e4 = g2.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
4794
- g2.addCodepointToCell(this._activeBuffer.x - e4, s3, r3);
4795
- for (let e5 = r3 - S2; --e5 >= 0; ) g2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u2);
4785
+ const e4 = p2.getWidth(this._activeBuffer.x - 1) ? 1 : 2;
4786
+ p2.addCodepointToCell(this._activeBuffer.x - e4, s3, r3);
4787
+ for (let e5 = r3 - b2; --e5 >= 0; ) p2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u2);
4796
4788
  continue;
4797
4789
  }
4798
- if (d2 && (g2.insertCells(this._activeBuffer.x, r3 - S2, this._activeBuffer.getNullCell(u2)), 2 === g2.getWidth(o2 - 1) && g2.setCellFromCodepoint(o2 - 1, l.NULL_CELL_CODE, l.NULL_CELL_WIDTH, u2)), g2.setCellFromCodepoint(this._activeBuffer.x++, s3, r3, u2), r3 > 0) for (; --r3; ) g2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u2);
4790
+ if (d2 && (p2.insertCells(this._activeBuffer.x, r3 - b2, this._activeBuffer.getNullCell(u2)), 2 === p2.getWidth(o2 - 1) && p2.setCellFromCodepoint(o2 - 1, l.NULL_CELL_CODE, l.NULL_CELL_WIDTH, u2)), p2.setCellFromCodepoint(this._activeBuffer.x++, s3, r3, u2), r3 > 0) for (; --r3; ) p2.setCellFromCodepoint(this._activeBuffer.x++, 0, 0, u2);
4799
4791
  }
4800
- this._parser.precedingJoinState = p2, this._activeBuffer.x < o2 && i3 - t3 > 0 && 0 === g2.getWidth(this._activeBuffer.x) && !g2.hasContent(this._activeBuffer.x) && g2.setCellFromCodepoint(this._activeBuffer.x, 0, 1, u2), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
4792
+ this._parser.precedingJoinState = g2, this._activeBuffer.x < o2 && i3 - t3 > 0 && 0 === p2.getWidth(this._activeBuffer.x) && !p2.hasContent(this._activeBuffer.x) && p2.setCellFromCodepoint(this._activeBuffer.x, 0, 1, u2), this._dirtyRowTracker.markDirty(this._activeBuffer.y);
4801
4793
  }
4802
4794
  registerCsiHandler(e3, t3) {
4803
4795
  return "t" !== e3.final || e3.prefix || e3.intermediates ? this._parser.registerCsiHandler(e3, t3) : this._parser.registerCsiHandler(e3, (e4) => !C(e4.params[0], this._optionsService.rawOptions.windowOptions) || t3(e4));
4804
4796
  }
4805
4797
  registerDcsHandler(e3, t3) {
4806
- return this._parser.registerDcsHandler(e3, new p.DcsHandler(t3));
4798
+ return this._parser.registerDcsHandler(e3, new g.DcsHandler(t3));
4807
4799
  }
4808
4800
  registerEscHandler(e3, t3) {
4809
4801
  return this._parser.registerEscHandler(e3, t3);
4810
4802
  }
4811
4803
  registerOscHandler(e3, t3) {
4812
- return this._parser.registerOscHandler(e3, new g.OscHandler(t3));
4804
+ return this._parser.registerOscHandler(e3, new p.OscHandler(t3));
4813
4805
  }
4814
4806
  registerApcHandler(e3, t3) {
4815
4807
  return this._parser.registerApcHandler(e3, new v.ApcHandler(t3));
@@ -4951,7 +4943,7 @@ var require_xterm_headless = __commonJS({
4951
4943
  break;
4952
4944
  case 3:
4953
4945
  const e4 = this._activeBuffer.lines.length - this._bufferService.rows;
4954
- e4 > 0 && (this._activeBuffer.lines.trimStart(e4), this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - e4, 0), this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - e4, 0), this._onScroll.fire(0));
4946
+ e4 > 0 && (this._activeBuffer.lines.trimStart(e4), this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - e4, 0), this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - e4, 0), this._activeBuffer === this._bufferService.buffers.normal && (this._bufferService.isUserScrolling = false), this._onScroll.fire(0));
4955
4947
  }
4956
4948
  return true;
4957
4949
  }
@@ -5394,7 +5386,7 @@ var require_xterm_headless = __commonJS({
5394
5386
  const i4 = parseInt(e4, 10);
5395
5387
  if (E(i4)) if ("?" === s3) t3.push({ type: 0, index: i4 });
5396
5388
  else {
5397
- const e5 = (0, S.parseColor)(s3);
5389
+ const e5 = (0, b.parseColor)(s3);
5398
5390
  e5 && t3.push({ type: 1, index: i4, color: e5 });
5399
5391
  }
5400
5392
  }
@@ -5421,7 +5413,7 @@ var require_xterm_headless = __commonJS({
5421
5413
  const i3 = e3.split(";");
5422
5414
  for (let e4 = 0; e4 < i3.length && !(t3 >= this._specialColors.length); ++e4, ++t3) if ("?" === i3[e4]) this._onColor.fire([{ type: 0, index: this._specialColors[t3] }]);
5423
5415
  else {
5424
- const s3 = (0, S.parseColor)(i3[e4]);
5416
+ const s3 = (0, b.parseColor)(i3[e4]);
5425
5417
  s3 && this._onColor.fire([{ type: 1, index: this._specialColors[t3], color: s3 }]);
5426
5418
  }
5427
5419
  return true;
@@ -5928,11 +5920,11 @@ var require_xterm_headless = __commonJS({
5928
5920
  t2.ExtendedAttrs = s2;
5929
5921
  }, 73(e2, t2, i2) {
5930
5922
  Object.defineProperty(t2, "__esModule", { value: true }), t2.Buffer = t2.MAX_BUFFER_SIZE = void 0;
5931
- const s2 = i2(639), r2 = i2(812), n2 = i2(168), a = i2(451), o = i2(107), h = i2(326), c = i2(732), l = i2(55), _ = i2(938), d = i2(158), u = i2(760);
5923
+ const s2 = i2(639), r2 = i2(812), n2 = i2(168), a = i2(451), o = i2(107), h = i2(732), c = i2(55), l = i2(938), _ = i2(158), d = i2(760);
5932
5924
  t2.MAX_BUFFER_SIZE = 4294967295;
5933
- class f extends r2.Disposable {
5925
+ class u extends r2.Disposable {
5934
5926
  constructor(e3, t3, i3, a2) {
5935
- super(), this._hasScrollback = e3, this._optionsService = t3, this._bufferService = i3, this._logService = a2, this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.tabs = {}, this.savedY = 0, this.savedX = 0, this.savedCurAttrData = o.DEFAULT_ATTR_DATA.clone(), this.savedCharset = u.DEFAULT_CHARSET, this.savedCharsets = [], this.savedGlevel = 0, this.savedOriginMode = false, this.savedWraparoundMode = true, this.markers = [], this._nullCell = l.CellData.fromCharData([0, _.NULL_CELL_CHAR, _.NULL_CELL_WIDTH, _.NULL_CELL_CODE]), this._whitespaceCell = l.CellData.fromCharData([0, _.WHITESPACE_CELL_CHAR, _.WHITESPACE_CELL_WIDTH, _.WHITESPACE_CELL_CODE]), this._isClearing = false, this._memoryCleanupPosition = 0, this._cols = this._bufferService.cols, this._rows = this._bufferService.rows, this.lines = new s2.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops(), this._memoryCleanupQueue = new n2.IdleTaskQueue(this._logService), this._register((0, r2.toDisposable)(() => this._memoryCleanupQueue.clear())), this._register((0, r2.toDisposable)(() => this.clearAllMarkers())), this._stringCache = this._register(new h.BufferLineStringCache());
5927
+ super(), this._hasScrollback = e3, this._optionsService = t3, this._bufferService = i3, this._logService = a2, this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.tabs = {}, this.savedY = 0, this.savedX = 0, this.savedCurAttrData = o.DEFAULT_ATTR_DATA.clone(), this.savedCharset = d.DEFAULT_CHARSET, this.savedCharsets = [], this.savedGlevel = 0, this.savedOriginMode = false, this.savedWraparoundMode = true, this.markers = [], this._nullCell = c.CellData.fromCharData([0, l.NULL_CELL_CHAR, l.NULL_CELL_WIDTH, l.NULL_CELL_CODE]), this._whitespaceCell = c.CellData.fromCharData([0, l.WHITESPACE_CELL_CHAR, l.WHITESPACE_CELL_WIDTH, l.WHITESPACE_CELL_CODE]), this._isClearing = false, this._memoryCleanupPosition = 0, this._cols = this._bufferService.cols, this._rows = this._bufferService.rows, this.lines = new s2.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops(), this._memoryCleanupQueue = new n2.IdleTaskQueue(this._logService), this._register((0, r2.toDisposable)(() => this._memoryCleanupQueue.clear())), this._register((0, r2.toDisposable)(() => this.clearAllMarkers()));
5936
5928
  }
5937
5929
  getNullCell(e3) {
5938
5930
  return e3 ? (this._nullCell.fg = e3.fg, this._nullCell.bg = e3.bg, this._nullCell.extended = e3.extended) : (this._nullCell.fg = 0, this._nullCell.bg = 0, this._nullCell.extended = new a.ExtendedAttrs()), this._nullCell;
@@ -5941,7 +5933,7 @@ var require_xterm_headless = __commonJS({
5941
5933
  return e3 ? (this._whitespaceCell.fg = e3.fg, this._whitespaceCell.bg = e3.bg, this._whitespaceCell.extended = e3.extended) : (this._whitespaceCell.fg = 0, this._whitespaceCell.bg = 0, this._whitespaceCell.extended = new a.ExtendedAttrs()), this._whitespaceCell;
5942
5934
  }
5943
5935
  getBlankLine(e3, t3) {
5944
- return new o.BufferLine(this._stringCache, this._bufferService.cols, this.getNullCell(e3), t3);
5936
+ return new o.BufferLine(this._bufferService.cols, this.getNullCell(e3), t3);
5945
5937
  }
5946
5938
  get hasScrollback() {
5947
5939
  return this._hasScrollback && this.lines.maxLength > this._rows;
@@ -5963,17 +5955,16 @@ var require_xterm_headless = __commonJS({
5963
5955
  }
5964
5956
  }
5965
5957
  clear() {
5966
- this._stringCache.clear(), this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.lines = new s2.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops();
5958
+ this.ydisp = 0, this.ybase = 0, this.y = 0, this.x = 0, this.lines = new s2.CircularList(this._getCorrectBufferLength(this._rows)), this.scrollTop = 0, this.scrollBottom = this._rows - 1, this.setupTabStops();
5967
5959
  }
5968
5960
  resize(e3, t3) {
5969
5961
  const i3 = this.getNullCell(o.DEFAULT_ATTR_DATA);
5970
- this._stringCache.clear();
5971
5962
  let s3 = 0;
5972
5963
  const r3 = this._getCorrectBufferLength(t3);
5973
5964
  if (r3 > this.lines.maxLength && (this.lines.maxLength = r3), this.lines.length > 0) {
5974
5965
  if (this._cols < e3) for (let t4 = 0; t4 < this.lines.length; t4++) s3 += +this.lines.get(t4).resize(e3, i3);
5975
5966
  let n3 = 0;
5976
- if (this._rows < t3) for (let s4 = this._rows; s4 < t3; s4++) this.lines.length < t3 + this.ybase && (void 0 !== this._optionsService.rawOptions.windowsPty.backend || void 0 !== this._optionsService.rawOptions.windowsPty.buildNumber ? this.lines.push(new o.BufferLine(this._stringCache, e3, i3, false)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + n3 + 1 ? (this.ybase--, n3++, this.ydisp > 0 && this.ydisp--) : this.lines.push(new o.BufferLine(this._stringCache, e3, i3, false)));
5967
+ if (this._rows < t3) for (let s4 = this._rows; s4 < t3; s4++) this.lines.length < t3 + this.ybase && (void 0 !== this._optionsService.rawOptions.windowsPty.backend || void 0 !== this._optionsService.rawOptions.windowsPty.buildNumber ? this.lines.push(new o.BufferLine(e3, i3, false)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + n3 + 1 ? (this.ybase--, n3++, this.ydisp > 0 && this.ydisp--) : this.lines.push(new o.BufferLine(e3, i3, false)));
5977
5968
  else for (let e4 = this._rows; e4 > t3; e4--) this.lines.length > t3 + this.ybase && (this.lines.length > this.ybase + this.y + 1 ? this.lines.pop() : (this.ybase++, this.ydisp++));
5978
5969
  if (r3 < this.lines.maxLength) {
5979
5970
  const e4 = this.lines.length - r3;
@@ -6003,53 +5994,53 @@ var require_xterm_headless = __commonJS({
6003
5994
  this._cols !== e3 && (e3 > this._cols ? this._reflowLarger(e3, t3) : this._reflowSmaller(e3, t3));
6004
5995
  }
6005
5996
  _reflowLarger(e3, t3) {
6006
- const i3 = this._optionsService.rawOptions.reflowCursorLine, s3 = (0, c.reflowLargerGetLinesToRemove)(this.lines, this._cols, e3, this.ybase + this.y, this.getNullCell(o.DEFAULT_ATTR_DATA), i3);
5997
+ const i3 = this._optionsService.rawOptions.reflowCursorLine, s3 = (0, h.reflowLargerGetLinesToRemove)(this.lines, this._cols, e3, this.ybase + this.y, this.getNullCell(o.DEFAULT_ATTR_DATA), i3);
6007
5998
  if (s3.length > 0) {
6008
- const i4 = (0, c.reflowLargerCreateNewLayout)(this.lines, s3);
6009
- (0, c.reflowLargerApplyNewLayout)(this.lines, i4.layout), this._reflowLargerAdjustViewport(e3, t3, i4.countRemoved);
5999
+ const i4 = (0, h.reflowLargerCreateNewLayout)(this.lines, s3);
6000
+ (0, h.reflowLargerApplyNewLayout)(this.lines, i4.layout), this._reflowLargerAdjustViewport(e3, t3, i4.countRemoved);
6010
6001
  }
6011
6002
  }
6012
6003
  _reflowLargerAdjustViewport(e3, t3, i3) {
6013
6004
  const s3 = this.getNullCell(o.DEFAULT_ATTR_DATA);
6014
6005
  let r3 = i3;
6015
- for (; r3-- > 0; ) 0 === this.ybase ? (this.y > 0 && this.y--, this.lines.length < t3 && this.lines.push(new o.BufferLine(this._stringCache, e3, s3, false))) : (this.ydisp === this.ybase && this.ydisp--, this.ybase--);
6006
+ for (; r3-- > 0; ) 0 === this.ybase ? (this.y > 0 && this.y--, this.lines.length < t3 && this.lines.push(new o.BufferLine(e3, s3, false))) : (this.ydisp === this.ybase && this.ydisp--, this.ybase--);
6016
6007
  this.savedY = Math.max(this.savedY - i3, 0);
6017
6008
  }
6018
6009
  _reflowSmaller(e3, t3) {
6019
6010
  const i3 = this._optionsService.rawOptions.reflowCursorLine, s3 = this.getNullCell(o.DEFAULT_ATTR_DATA), r3 = [];
6020
6011
  let n3 = 0;
6021
6012
  for (let a2 = this.lines.length - 1; a2 >= 0; a2--) {
6022
- let h2 = this.lines.get(a2);
6023
- if (!h2 || !h2.isWrapped && h2.getTrimmedLength() <= e3) continue;
6024
- const l2 = [h2];
6025
- for (; h2.isWrapped && a2 > 0; ) h2 = this.lines.get(--a2), l2.unshift(h2);
6013
+ let c2 = this.lines.get(a2);
6014
+ if (!c2 || !c2.isWrapped && c2.getTrimmedLength() <= e3) continue;
6015
+ const l2 = [c2];
6016
+ for (; c2.isWrapped && a2 > 0; ) c2 = this.lines.get(--a2), l2.unshift(c2);
6026
6017
  if (!i3) {
6027
6018
  const e4 = this.ybase + this.y;
6028
6019
  if (e4 >= a2 && e4 < a2 + l2.length) continue;
6029
6020
  }
6030
- const _2 = l2[l2.length - 1].getTrimmedLength(), d2 = (0, c.reflowSmallerGetNewLineLengths)(l2, this._cols, e3), u2 = d2.length - l2.length;
6031
- let f2;
6032
- f2 = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + u2) : Math.max(0, this.lines.length - this.lines.maxLength + u2);
6033
- const g = [];
6021
+ const _2 = l2[l2.length - 1].getTrimmedLength(), d2 = (0, h.reflowSmallerGetNewLineLengths)(l2, this._cols, e3), u2 = d2.length - l2.length;
6022
+ let f;
6023
+ f = 0 === this.ybase && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + u2) : Math.max(0, this.lines.length - this.lines.maxLength + u2);
6024
+ const p = [];
6034
6025
  for (let e4 = 0; e4 < u2; e4++) {
6035
6026
  const e5 = this.getBlankLine(o.DEFAULT_ATTR_DATA, true);
6036
- g.push(e5);
6027
+ p.push(e5);
6037
6028
  }
6038
- g.length > 0 && (r3.push({ start: a2 + l2.length + n3, newLines: g }), n3 += g.length), l2.push(...g);
6039
- let p = d2.length - 1, v = d2[p];
6040
- 0 === v && (p--, v = d2[p]);
6041
- let S = l2.length - u2 - 1, b = _2;
6042
- for (; S >= 0; ) {
6043
- const e4 = Math.min(b, v);
6044
- if (void 0 === l2[p]) break;
6045
- if (l2[p].copyCellsFrom(l2[S], b - e4, v - e4, e4, true), v -= e4, 0 === v && (p--, v = d2[p]), b -= e4, 0 === b) {
6046
- S--;
6047
- const e5 = Math.max(S, 0);
6048
- b = (0, c.getWrappedLineTrimmedLength)(l2, e5, this._cols);
6029
+ p.length > 0 && (r3.push({ start: a2 + l2.length + n3, newLines: p }), n3 += p.length), l2.push(...p);
6030
+ let g = d2.length - 1, v = d2[g];
6031
+ 0 === v && (g--, v = d2[g]);
6032
+ let b = l2.length - u2 - 1, S = _2;
6033
+ for (; b >= 0; ) {
6034
+ const e4 = Math.min(S, v);
6035
+ if (void 0 === l2[g]) break;
6036
+ if (l2[g].copyCellsFrom(l2[b], S - e4, v - e4, e4, true), v -= e4, 0 === v && (g--, v = d2[g]), S -= e4, 0 === S) {
6037
+ b--;
6038
+ const e5 = Math.max(b, 0);
6039
+ S = (0, h.getWrappedLineTrimmedLength)(l2, e5, this._cols);
6049
6040
  }
6050
6041
  }
6051
6042
  for (let t4 = 0; t4 < l2.length; t4++) d2[t4] < e3 && l2[t4].setCell(d2[t4], s3);
6052
- let m = u2 - f2;
6043
+ let m = u2 - f;
6053
6044
  for (; m-- > 0; ) 0 === this.ybase ? this.y < t3 - 1 ? (this.y++, this.lines.pop()) : (this.ybase++, this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + n3) - t3 && (this.ybase === this.ydisp && this.ydisp++, this.ybase++);
6054
6045
  this.savedY = Math.min(this.savedY + u2, this.ybase + t3 - 1);
6055
6046
  }
@@ -6102,7 +6093,7 @@ var require_xterm_headless = __commonJS({
6102
6093
  this.markers.length = 0, this._isClearing = false;
6103
6094
  }
6104
6095
  addMarker(e3) {
6105
- const t3 = new d.Marker(e3);
6096
+ const t3 = new _.Marker(e3);
6106
6097
  return this.markers.push(t3), t3.register(this.lines.onTrim((e4) => {
6107
6098
  t3.line -= e4, t3.line < 0 && t3.dispose();
6108
6099
  })), t3.register(this.lines.onInsert((e4) => {
@@ -6115,26 +6106,26 @@ var require_xterm_headless = __commonJS({
6115
6106
  this._isClearing || this.markers.splice(this.markers.indexOf(e3), 1);
6116
6107
  }
6117
6108
  }
6118
- t2.Buffer = f;
6109
+ t2.Buffer = u;
6119
6110
  }, 107(e2, t2, i2) {
6120
6111
  Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferLine = t2.DEFAULT_ATTR_DATA = void 0;
6121
- const s2 = i2(451), r2 = i2(55), n2 = i2(938), a = i2(726), o = i2(220);
6112
+ const s2 = i2(451), r2 = i2(55), n2 = i2(938), a = i2(726);
6122
6113
  t2.DEFAULT_ATTR_DATA = Object.freeze(new s2.AttributeData());
6123
- let h = 0;
6124
- const c = new r2.CellData(), l = new o.StringBuilder();
6125
- class _ {
6126
- constructor(e3, t3, i3, s3 = false) {
6127
- this._stringCache = e3, this.isWrapped = s3, this._combined = {}, this._extendedAttrs = {}, this._data = new Uint32Array(3 * t3);
6128
- const a2 = i3 ?? r2.CellData.fromCharData([0, n2.NULL_CELL_CHAR, n2.NULL_CELL_WIDTH, n2.NULL_CELL_CODE]);
6129
- for (let e4 = 0; e4 < t3; ++e4) this.setCell(e4, a2);
6130
- this.length = t3;
6114
+ let o = 0;
6115
+ const h = new r2.CellData(), c = t2.DEFAULT_ATTR_DATA.extended.clone();
6116
+ class l {
6117
+ constructor(e3, t3, i3 = false) {
6118
+ this.isWrapped = i3, this._combined = {}, this._extendedAttrs = {}, this._cacheValid = false, this._cache = "", this._cacheTrimmed = false, this._data = new Uint32Array(3 * e3);
6119
+ const s3 = t3 ?? r2.CellData.fromCharData([0, n2.NULL_CELL_CHAR, n2.NULL_CELL_WIDTH, n2.NULL_CELL_CODE]);
6120
+ for (let t4 = 0; t4 < e3; ++t4) this.setCell(t4, s3);
6121
+ this.length = e3;
6131
6122
  }
6132
6123
  get(e3) {
6133
6124
  const t3 = this._data[3 * e3 + 0], i3 = 2097151 & t3;
6134
6125
  return [this._data[3 * e3 + 1], 2097152 & t3 ? this._combined[e3] : i3 ? (0, a.stringFromCodePoint)(i3) : "", t3 >> 22, 2097152 & t3 ? this._combined[e3].charCodeAt(this._combined[e3].length - 1) : i3];
6135
6126
  }
6136
6127
  set(e3, t3) {
6137
- this._invalidateStringCache(), this._data[3 * e3 + 1] = t3[n2.CHAR_DATA_ATTR_INDEX], t3[n2.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[e3] = t3[1], this._data[3 * e3 + 0] = 2097152 | e3 | t3[n2.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * e3 + 0] = t3[n2.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | t3[n2.CHAR_DATA_WIDTH_INDEX] << 22;
6128
+ this._cacheValid = false, this._data[3 * e3 + 1] = t3[n2.CHAR_DATA_ATTR_INDEX], t3[n2.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[e3] = t3[1], this._data[3 * e3 + 0] = 2097152 | e3 | t3[n2.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * e3 + 0] = t3[n2.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | t3[n2.CHAR_DATA_WIDTH_INDEX] << 22;
6138
6129
  }
6139
6130
  getWidth(e3) {
6140
6131
  return this._data[3 * e3 + 0] >> 22;
@@ -6165,40 +6156,42 @@ var require_xterm_headless = __commonJS({
6165
6156
  isProtected(e3) {
6166
6157
  return 536870912 & this._data[3 * e3 + 2];
6167
6158
  }
6168
- loadCell(e3, i3) {
6169
- return h = 3 * e3, i3.content = this._data[h + 0], i3.fg = this._data[h + 1], i3.bg = this._data[h + 2], 2097152 & i3.content ? i3.combinedData = this._combined[e3] : i3.combinedData = "", 268435456 & i3.bg ? i3.extended = this._extendedAttrs[e3] : i3.extended = t2.DEFAULT_ATTR_DATA.extended.clone(), i3;
6159
+ loadCell(e3, t3) {
6160
+ return o = 3 * e3, t3.content = this._data[o + 0], t3.fg = this._data[o + 1], t3.bg = this._data[o + 2], 2097152 & t3.content ? t3.combinedData = this._combined[e3] : t3.combinedData = "", 268435456 & t3.bg ? t3.extended = this._extendedAttrs[e3] : (c._ext = 0, c._urlId = 0, t3.extended = c), t3;
6170
6161
  }
6171
6162
  setCell(e3, t3) {
6172
- this._invalidateStringCache(), 2097152 & t3.content && (this._combined[e3] = t3.combinedData), 268435456 & t3.bg && (this._extendedAttrs[e3] = t3.extended), this._data[3 * e3 + 0] = t3.content, this._data[3 * e3 + 1] = t3.fg, this._data[3 * e3 + 2] = t3.bg;
6163
+ this._cacheValid = false, 2097152 & t3.content && (this._combined[e3] = t3.combinedData), 268435456 & t3.bg && (this._extendedAttrs[e3] = t3.extended), this._data[3 * e3 + 0] = t3.content, this._data[3 * e3 + 1] = t3.fg, this._data[3 * e3 + 2] = t3.bg;
6173
6164
  }
6174
6165
  setCellFromCodepoint(e3, t3, i3, s3) {
6175
- this._invalidateStringCache(), 268435456 & s3.bg && (this._extendedAttrs[e3] = s3.extended), this._data[3 * e3 + 0] = t3 | i3 << 22, this._data[3 * e3 + 1] = s3.fg, this._data[3 * e3 + 2] = s3.bg;
6166
+ this._cacheValid = false, 268435456 & s3.bg && (this._extendedAttrs[e3] = s3.extended);
6167
+ const r3 = 3 * e3;
6168
+ this._data[r3 + 0] = t3 | i3 << 22, this._data[r3 + 1] = s3.fg, this._data[r3 + 2] = s3.bg;
6176
6169
  }
6177
6170
  addCodepointToCell(e3, t3, i3) {
6178
- this._invalidateStringCache();
6171
+ this._cacheValid = false;
6179
6172
  let s3 = this._data[3 * e3 + 0];
6180
6173
  2097152 & s3 ? this._combined[e3] += (0, a.stringFromCodePoint)(t3) : 2097151 & s3 ? (this._combined[e3] = (0, a.stringFromCodePoint)(2097151 & s3) + (0, a.stringFromCodePoint)(t3), s3 &= -2097152, s3 |= 2097152) : s3 = t3 | 1 << 22, i3 && (s3 &= -12582913, s3 |= i3 << 22), this._data[3 * e3 + 0] = s3;
6181
6174
  }
6182
6175
  insertCells(e3, t3, i3) {
6183
- if (this._invalidateStringCache(), (e3 %= this.length) && 2 === this.getWidth(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), t3 < this.length - e3) {
6184
- for (let i4 = this.length - e3 - t3 - 1; i4 >= 0; --i4) this.setCell(e3 + t3 + i4, this.loadCell(e3 + i4, c));
6176
+ if (this._cacheValid = false, (e3 %= this.length) && 2 === this.getWidth(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), t3 < this.length - e3) {
6177
+ for (let i4 = this.length - e3 - t3 - 1; i4 >= 0; --i4) this.setCell(e3 + t3 + i4, this.loadCell(e3 + i4, h));
6185
6178
  for (let s3 = 0; s3 < t3; ++s3) this.setCell(e3 + s3, i3);
6186
6179
  } else for (let t4 = e3; t4 < this.length; ++t4) this.setCell(t4, i3);
6187
6180
  2 === this.getWidth(this.length - 1) && this.setCellFromCodepoint(this.length - 1, 0, 1, i3);
6188
6181
  }
6189
6182
  deleteCells(e3, t3, i3) {
6190
- if (this._invalidateStringCache(), e3 %= this.length, t3 < this.length - e3) {
6191
- for (let i4 = 0; i4 < this.length - e3 - t3; ++i4) this.setCell(e3 + i4, this.loadCell(e3 + t3 + i4, c));
6183
+ if (this._cacheValid = false, e3 %= this.length, t3 < this.length - e3) {
6184
+ for (let i4 = 0; i4 < this.length - e3 - t3; ++i4) this.setCell(e3 + i4, this.loadCell(e3 + t3 + i4, h));
6192
6185
  for (let e4 = this.length - t3; e4 < this.length; ++e4) this.setCell(e4, i3);
6193
6186
  } else for (let t4 = e3; t4 < this.length; ++t4) this.setCell(t4, i3);
6194
6187
  e3 && 2 === this.getWidth(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), 0 !== this.getWidth(e3) || this.hasContent(e3) || this.setCellFromCodepoint(e3, 0, 1, i3);
6195
6188
  }
6196
6189
  replaceCells(e3, t3, i3, s3 = false) {
6197
- if (this._invalidateStringCache(), s3) for (e3 && 2 === this.getWidth(e3 - 1) && !this.isProtected(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), t3 < this.length && 2 === this.getWidth(t3 - 1) && !this.isProtected(t3) && this.setCellFromCodepoint(t3, 0, 1, i3); e3 < t3 && e3 < this.length; ) this.isProtected(e3) || this.setCell(e3, i3), e3++;
6190
+ if (this._cacheValid = false, s3) for (e3 && 2 === this.getWidth(e3 - 1) && !this.isProtected(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), t3 < this.length && 2 === this.getWidth(t3 - 1) && !this.isProtected(t3) && this.setCellFromCodepoint(t3, 0, 1, i3); e3 < t3 && e3 < this.length; ) this.isProtected(e3) || this.setCell(e3, i3), e3++;
6198
6191
  else for (e3 && 2 === this.getWidth(e3 - 1) && this.setCellFromCodepoint(e3 - 1, 0, 1, i3), t3 < this.length && 2 === this.getWidth(t3 - 1) && this.setCellFromCodepoint(t3, 0, 1, i3); e3 < t3 && e3 < this.length; ) this.setCell(e3++, i3);
6199
6192
  }
6200
6193
  resize(e3, t3) {
6201
- if (this._invalidateStringCache(), e3 === this.length) return 4 * this._data.length * 2 < this._data.buffer.byteLength;
6194
+ if (this._cacheValid = false, e3 === this.length) return 4 * this._data.length * 2 < this._data.buffer.byteLength;
6202
6195
  const i3 = 3 * e3;
6203
6196
  if (e3 > this.length) {
6204
6197
  if (this._data.buffer.byteLength >= 4 * i3) this._data = new Uint32Array(this._data.buffer, 0, i3);
@@ -6230,18 +6223,18 @@ var require_xterm_headless = __commonJS({
6230
6223
  return 0;
6231
6224
  }
6232
6225
  fill(e3, t3 = false) {
6233
- if (this._invalidateStringCache(), t3) for (let t4 = 0; t4 < this.length; ++t4) this.isProtected(t4) || this.setCell(t4, e3);
6226
+ if (this._cacheValid = false, t3) for (let t4 = 0; t4 < this.length; ++t4) this.isProtected(t4) || this.setCell(t4, e3);
6234
6227
  else {
6235
6228
  this._combined = {}, this._extendedAttrs = {};
6236
6229
  for (let t4 = 0; t4 < this.length; ++t4) this.setCell(t4, e3);
6237
6230
  }
6238
6231
  }
6239
- copyFrom(e3) {
6240
- this._invalidateStringCache(), this.length !== e3.length ? this._data = new Uint32Array(e3._data) : this._data.set(e3._data), this.length = e3.length, this._copySparseMapsFrom(e3), this.isWrapped = e3.isWrapped;
6232
+ copyFrom(e3, t3) {
6233
+ this.length !== e3.length ? this._data = new Uint32Array(e3._data) : this._data.set(e3._data), this.length = e3.length, t3 ? (this._combined = {}, this._extendedAttrs = {}) : this._copySparseMapsFrom(e3), this._cache = "", this._cacheValid = false, this.isWrapped = e3.isWrapped;
6241
6234
  }
6242
- clone() {
6243
- const e3 = new _(this._stringCache, 0, void 0, false);
6244
- return e3._data = new Uint32Array(this._data), e3.length = this.length, e3._copySparseMapsFrom(this), e3.isWrapped = this.isWrapped, e3;
6235
+ clone(e3) {
6236
+ const t3 = new l(0, void 0, false);
6237
+ return t3._data = new Uint32Array(this._data), t3.length = this.length, e3 || t3._copySparseMapsFrom(this), t3.isWrapped = this.isWrapped, t3;
6245
6238
  }
6246
6239
  getTrimmedLength() {
6247
6240
  for (let e3 = this.length - 1; e3 >= 0; --e3) if (4194303 & this._data[3 * e3 + 0]) return e3 + (this._data[3 * e3 + 0] >> 22);
@@ -6252,7 +6245,7 @@ var require_xterm_headless = __commonJS({
6252
6245
  return 0;
6253
6246
  }
6254
6247
  copyCellsFrom(e3, t3, i3, s3, r3) {
6255
- this._invalidateStringCache();
6248
+ this._cacheValid = false;
6256
6249
  const n3 = e3._data;
6257
6250
  if (r3) for (let r4 = s3 - 1; r4 >= 0; r4--) {
6258
6251
  for (let e4 = 0; e4 < 3; e4++) this._data[3 * (i3 + r4) + e4] = n3[3 * (t3 + r4) + e4];
@@ -6265,35 +6258,20 @@ var require_xterm_headless = __commonJS({
6265
6258
  }
6266
6259
  translateToString(e3, t3, i3, s3) {
6267
6260
  const r3 = (void 0 === t3 || 0 === t3) && void 0 === i3 && void 0 === s3;
6268
- r3 && this._stringCache.touch?.();
6269
- const o2 = r3 ? this._getStringCacheEntry(false) : void 0;
6270
- if (r3 && void 0 !== o2?.value) {
6271
- if (e3) return o2.isTrimmed ? o2.value : o2.value.trimEnd();
6272
- if (!o2.isTrimmed) return o2.value;
6261
+ if (r3 && this._cacheValid) {
6262
+ if (e3) return this._cacheTrimmed ? this._cache : this._cache.trimEnd();
6263
+ if (!this._cacheTrimmed) return this._cache;
6273
6264
  }
6274
- for (t3 = t3 ?? 0, i3 = i3 ?? this.length, e3 && (i3 = Math.min(i3, this.getTrimmedLength())), s3 && (s3.length = 0), l.reset(); t3 < i3; ) {
6265
+ t3 = t3 ?? 0, i3 = i3 ?? this.length, e3 && (i3 = Math.min(i3, this.getTrimmedLength())), s3 && (s3.length = 0);
6266
+ const o2 = [];
6267
+ for (; t3 < i3; ) {
6275
6268
  const e4 = this._data[3 * t3 + 0], i4 = 2097151 & e4, r4 = 2097152 & e4 ? this._combined[t3] : i4 ? (0, a.stringFromCodePoint)(i4) : n2.WHITESPACE_CELL_CHAR;
6276
- if (l.append(r4), s3) for (let e5 = 0; e5 < r4.length; ++e5) s3.push(t3);
6269
+ if (o2.push(r4), s3) for (let e5 = 0; e5 < r4.length; ++e5) s3.push(t3);
6277
6270
  t3 += e4 >> 22 || 1;
6278
6271
  }
6279
6272
  s3 && s3.push(t3);
6280
- const h2 = l.toString();
6281
- if (l.reset(), r3) {
6282
- const t4 = this._getStringCacheEntry(true);
6283
- t4.value = h2, t4.isTrimmed = !!e3;
6284
- }
6285
- return h2;
6286
- }
6287
- _getStringCacheEntry(e3) {
6288
- const t3 = this._stringCacheEntryRef?.deref();
6289
- if (t3 && t3.generation === this._stringCache.generation) return t3;
6290
- if (!e3) return;
6291
- const i3 = this._stringCache.allocateEntry();
6292
- return this._stringCacheEntryRef = new WeakRef(i3), i3;
6293
- }
6294
- _invalidateStringCache() {
6295
- const e3 = this._getStringCacheEntry(false);
6296
- e3 && (e3.value = void 0, e3.isTrimmed = false);
6273
+ const h2 = o2.join("");
6274
+ return r3 && (this._cache = h2, this._cacheValid = true, this._cacheTrimmed = !!e3), h2;
6297
6275
  }
6298
6276
  _copyCellMapsFrom(e3, t3, i3) {
6299
6277
  const s3 = 3 * t3;
@@ -6304,37 +6282,7 @@ var require_xterm_headless = __commonJS({
6304
6282
  for (let t3 = 0; t3 < e3.length; t3++) this._copyCellMapsFrom(e3, t3, t3);
6305
6283
  }
6306
6284
  }
6307
- t2.BufferLine = _;
6308
- }, 326(e2, t2, i2) {
6309
- Object.defineProperty(t2, "__esModule", { value: true }), t2.BufferLineStringCache = void 0;
6310
- const s2 = i2(132), r2 = i2(812);
6311
- class n2 extends r2.Disposable {
6312
- constructor() {
6313
- super(), this.generation = 0, this.entries = /* @__PURE__ */ new Set(), this._clearTimeout = this._register(new r2.MutableDisposable()), this._lastAccessTimestamp = 0, this._register((0, r2.toDisposable)(() => this.entries.clear()));
6314
- }
6315
- touch() {
6316
- this._scheduleClear();
6317
- }
6318
- allocateEntry() {
6319
- const e3 = { value: void 0, isTrimmed: false, generation: this.generation };
6320
- return this.entries.add(e3), this._scheduleClear(), e3;
6321
- }
6322
- clear() {
6323
- this._clearTimeout.clear(), this._lastAccessTimestamp = 0, this.generation++;
6324
- for (const e3 of this.entries) e3.value = void 0, e3.isTrimmed = false;
6325
- this.entries.clear();
6326
- }
6327
- _scheduleClear() {
6328
- this._lastAccessTimestamp = Date.now(), this._clearTimeout.value || this._scheduleClearTimeout(15e3);
6329
- }
6330
- _scheduleClearTimeout(e3) {
6331
- this._clearTimeout.value = (0, s2.disposableTimeout)(() => {
6332
- const e4 = Date.now() - this._lastAccessTimestamp;
6333
- e4 >= 15e3 ? this.clear() : this._scheduleClearTimeout(15e3 - e4);
6334
- }, e3);
6335
- }
6336
- }
6337
- t2.BufferLineStringCache = n2;
6285
+ t2.BufferLine = l;
6338
6286
  }, 732(e2, t2) {
6339
6287
  function i2(e3, t3, i3) {
6340
6288
  if (t3 === e3.length - 1) return e3[t3].getTrimmedLength();
@@ -6352,15 +6300,15 @@ var require_xterm_headless = __commonJS({
6352
6300
  h += _.length - 1;
6353
6301
  continue;
6354
6302
  }
6355
- let d = 0, u = i2(_, d, t3), f = 1, g = 0;
6303
+ let d = 0, u = i2(_, d, t3), f = 1, p = 0;
6356
6304
  for (; f < _.length; ) {
6357
- const e4 = i2(_, f, t3), r3 = e4 - g, a2 = s2 - u, o2 = Math.min(r3, a2);
6358
- _[d].copyCellsFrom(_[f], g, u, o2, false), u += o2, u === s2 && (d++, u = 0), g += o2, g === e4 && (f++, g = 0), 0 === u && 0 !== d && 2 === _[d - 1].getWidth(s2 - 1) && (_[d].copyCellsFrom(_[d - 1], s2 - 1, u++, 1, false), _[d - 1].setCell(s2 - 1, n2));
6305
+ const e4 = i2(_, f, t3), r3 = e4 - p, a2 = s2 - u, o2 = Math.min(r3, a2);
6306
+ _[d].copyCellsFrom(_[f], p, u, o2, false), u += o2, u === s2 && (d++, u = 0), p += o2, p === e4 && (f++, p = 0), 0 === u && 0 !== d && 2 === _[d - 1].getWidth(s2 - 1) && (_[d].copyCellsFrom(_[d - 1], s2 - 1, u++, 1, false), _[d - 1].setCell(s2 - 1, n2));
6359
6307
  }
6360
6308
  _[d].replaceCells(u, s2, n2);
6361
- let p = 0;
6362
- for (let e4 = _.length - 1; e4 > 0 && (e4 > d || 0 === _[e4].getTrimmedLength()); e4--) p++;
6363
- p > 0 && (o.push(h + _.length - p), o.push(p)), h += _.length - 1;
6309
+ let g = 0;
6310
+ for (let e4 = _.length - 1; e4 > 0 && (e4 > d || 0 === _[e4].getTrimmedLength()); e4--) g++;
6311
+ g > 0 && (o.push(h + _.length - g), o.push(g)), h += _.length - 1;
6364
6312
  }
6365
6313
  return o;
6366
6314
  }, t2.reflowLargerCreateNewLayout = function(e3, t3) {
@@ -7544,10 +7492,10 @@ var require_xterm_headless = __commonJS({
7544
7492
  const r3 = i3.ybase + i3.scrollTop, n3 = i3.ybase + i3.scrollBottom;
7545
7493
  if (0 === i3.scrollTop) {
7546
7494
  const e4 = i3.lines.isFull;
7547
- n3 === i3.lines.length - 1 ? e4 ? i3.lines.recycle().copyFrom(s3) : i3.lines.push(s3.clone()) : i3.lines.splice(n3 + 1, 0, s3.clone()), e4 ? this.isUserScrolling && (i3.ydisp = Math.max(i3.ydisp - 1, 0)) : (i3.ybase++, this.isUserScrolling || i3.ydisp++);
7495
+ n3 === i3.lines.length - 1 ? e4 ? i3.lines.recycle().copyFrom(s3, true) : i3.lines.push(s3.clone(true)) : i3.lines.splice(n3 + 1, 0, s3.clone(true)), e4 ? this.isUserScrolling && (i3.ydisp = Math.max(i3.ydisp - 1, 0)) : (i3.ybase++, this.isUserScrolling || i3.ydisp++);
7548
7496
  } else {
7549
7497
  const e4 = n3 - r3 + 1;
7550
- i3.lines.shiftElements(r3 + 1, e4 - 1, -1), i3.lines.set(n3, s3.clone());
7498
+ i3.lines.shiftElements(r3 + 1, e4 - 1, -1), i3.lines.set(n3, s3.clone(true));
7551
7499
  }
7552
7500
  this.isUserScrolling || (i3.ydisp = i3.ybase), this._onScroll.fire(i3.ydisp);
7553
7501
  }
@@ -8177,9 +8125,9 @@ var require_xterm_headless = __commonJS({
8177
8125
  }
8178
8126
  });
8179
8127
 
8180
- // ../../node_modules/.pnpm/@xterm+addon-serialize@0.15.0-beta.291_@xterm+xterm@6.1.0-beta.291/node_modules/@xterm/addon-serialize/lib/addon-serialize.js
8128
+ // ../../node_modules/.pnpm/@xterm+addon-serialize@0.15.0-beta.300_patch_hash=851eac3d75e6d8c013b9f4c053e61d824b239_775844943a1b2245f5497c2dbe9c9b83/node_modules/@xterm/addon-serialize/lib/addon-serialize.js
8181
8129
  var require_addon_serialize = __commonJS({
8182
- "../../node_modules/.pnpm/@xterm+addon-serialize@0.15.0-beta.291_@xterm+xterm@6.1.0-beta.291/node_modules/@xterm/addon-serialize/lib/addon-serialize.js"(exports, module) {
8130
+ "../../node_modules/.pnpm/@xterm+addon-serialize@0.15.0-beta.300_patch_hash=851eac3d75e6d8c013b9f4c053e61d824b239_775844943a1b2245f5497c2dbe9c9b83/node_modules/@xterm/addon-serialize/lib/addon-serialize.js"(exports, module) {
8183
8131
  !(function(t, e) {
8184
8132
  "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.SerializeAddon = e() : t.SerializeAddon = e();
8185
8133
  })(globalThis, () => (() => {
@@ -8326,10 +8274,18 @@ var require_addon_serialize = __commonJS({
8326
8274
  var t2 = s;
8327
8275
  Object.defineProperty(t2, "__esModule", { value: true }), t2.HTMLSerializeHandler = t2.SerializeAddon = void 0;
8328
8276
  const e2 = r(992);
8329
- function i(t3, e3, r2) {
8277
+ function i(t3) {
8278
+ return t3.extended?.urlId ?? 0;
8279
+ }
8280
+ function n(t3, e3) {
8281
+ if (!e3) return "";
8282
+ const r2 = t3._core?._oscLinkService?.getLinkData(e3);
8283
+ return r2 ? `\x1B]8;${void 0 === r2.id ? "" : `id=${r2.id}`};${r2.uri}\x1B\\` : "";
8284
+ }
8285
+ function o(t3, e3, r2) {
8330
8286
  return Math.max(e3, Math.min(t3, r2));
8331
8287
  }
8332
- class n {
8288
+ class l {
8333
8289
  constructor(t3) {
8334
8290
  this._buffer = t3;
8335
8291
  }
@@ -8363,51 +8319,58 @@ var require_addon_serialize = __commonJS({
8363
8319
  return "";
8364
8320
  }
8365
8321
  }
8366
- function o(t3, e3) {
8322
+ function a(t3, e3) {
8367
8323
  return t3.getFgColorMode() === e3.getFgColorMode() && t3.getFgColor() === e3.getFgColor();
8368
8324
  }
8369
- function l(t3, e3) {
8325
+ function u(t3, e3) {
8370
8326
  return t3.getBgColorMode() === e3.getBgColorMode() && t3.getBgColor() === e3.getBgColor();
8371
8327
  }
8372
- function a(t3, e3) {
8328
+ function h(t3, e3) {
8373
8329
  if (!t3.isUnderline() && !e3.isUnderline()) return true;
8374
8330
  if (t3.getUnderlineStyle() !== e3.getUnderlineStyle()) return false;
8375
8331
  const r2 = t3.isUnderlineColorDefault(), s2 = e3.isUnderlineColorDefault();
8376
8332
  return !(!r2 || !s2) || r2 === s2 && t3.getUnderlineColor() === e3.getUnderlineColor() && t3.getUnderlineColorMode() === e3.getUnderlineColorMode();
8377
8333
  }
8378
- function u(t3, e3) {
8379
- return t3.isInverse() === e3.isInverse() && t3.isBold() === e3.isBold() && t3.isUnderline() === e3.isUnderline() && a(t3, e3) && t3.isOverline() === e3.isOverline() && t3.isBlink() === e3.isBlink() && t3.isInvisible() === e3.isInvisible() && t3.isItalic() === e3.isItalic() && t3.isDim() === e3.isDim() && t3.isStrikethrough() === e3.isStrikethrough();
8334
+ function c(t3, e3) {
8335
+ return t3.isInverse() === e3.isInverse() && t3.isBold() === e3.isBold() && t3.isUnderline() === e3.isUnderline() && h(t3, e3) && t3.isOverline() === e3.isOverline() && t3.isBlink() === e3.isBlink() && t3.isInvisible() === e3.isInvisible() && t3.isItalic() === e3.isItalic() && t3.isDim() === e3.isDim() && t3.isStrikethrough() === e3.isStrikethrough();
8380
8336
  }
8381
- function h(t3, e3) {
8337
+ function f(t3, e3) {
8382
8338
  const r2 = t3;
8383
- return "function" == typeof r2.attributesEquals ? r2.attributesEquals(e3) : o(t3, e3) && l(t3, e3) && u(t3, e3);
8339
+ return "function" == typeof r2.attributesEquals ? r2.attributesEquals(e3) : a(t3, e3) && u(t3, e3) && c(t3, e3);
8384
8340
  }
8385
- class c extends n {
8341
+ class _ extends l {
8386
8342
  constructor(t3, e3) {
8387
- super(t3), this._terminal = e3, this._rowIndex = 0, this._allRows = new Array(), this._allRowSeparators = new Array(), this._currentRow = "", this._nullCellCount = 0, this._cursorStyle = this._buffer.getNullCell(), this._cursorStyleRow = 0, this._cursorStyleCol = 0, this._backgroundCell = this._buffer.getNullCell(), this._firstRow = 0, this._lastCursorRow = 0, this._lastCursorCol = 0, this._lastContentCursorRow = 0, this._lastContentCursorCol = 0, this._thisRowLastChar = this._buffer.getNullCell(), this._thisRowLastSecondChar = this._buffer.getNullCell(), this._nextRowFirstChar = this._buffer.getNullCell();
8343
+ super(t3), this._terminal = e3, this._rowIndex = 0, this._allRows = new Array(), this._allRowSeparators = new Array(), this._currentRow = "", this._nullCellCount = 0, this._cursorStyle = this._buffer.getNullCell(), this._cursorStyleRow = 0, this._cursorStyleCol = 0, this._backgroundCell = this._buffer.getNullCell(), this._defaultCell = this._buffer.getNullCell(), this._firstRow = 0, this._lastCursorRow = 0, this._lastCursorCol = 0, this._lastContentCursorRow = 0, this._lastContentCursorCol = 0, this._activeOscLinkId = 0, this._thisRowLastChar = this._buffer.getNullCell(), this._thisRowLastSecondChar = this._buffer.getNullCell(), this._nextRowFirstChar = this._buffer.getNullCell();
8388
8344
  }
8389
8345
  _beforeSerialize(t3, e3, r2) {
8390
8346
  this._allRows = new Array(t3), this._lastContentCursorRow = e3, this._lastCursorRow = e3, this._firstRow = e3;
8391
8347
  }
8392
8348
  _rowEnd(t3, e3) {
8393
- this._nullCellCount > 0 && !l(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`);
8349
+ this._nullCellCount > 0 && !u(this._cursorStyle, this._backgroundCell) && (this._currentRow += `\x1B[${this._nullCellCount}X`);
8394
8350
  let r2 = "";
8395
8351
  if (!e3) {
8396
8352
  t3 - this._firstRow >= this._terminal.rows && this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol, this._backgroundCell);
8397
8353
  const e4 = this._buffer.getLine(t3), s2 = this._buffer.getLine(t3 + 1);
8398
8354
  if (s2.isWrapped) {
8399
8355
  r2 = "";
8400
- const i2 = e4.getCell(e4.length - 1, this._thisRowLastChar), n2 = e4.getCell(e4.length - 2, this._thisRowLastSecondChar), o2 = s2.getCell(0, this._nextRowFirstChar), a2 = o2.getWidth() > 1;
8401
- let u2 = false;
8402
- (o2.getChars() && a2 ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((i2.getChars() || 0 === i2.getWidth()) && l(i2, o2) && (u2 = true), a2 && (n2.getChars() || 0 === n2.getWidth()) && l(i2, o2) && l(n2, o2) && (u2 = true)), u2 || (r2 = "-".repeat(this._nullCellCount + 1), r2 += "\x1B[1D\x1B[1X", this._nullCellCount > 0 && (r2 += "\x1B[A", r2 += `\x1B[${e4.length - this._nullCellCount}C`, r2 += `\x1B[${this._nullCellCount}X`, r2 += `\x1B[${e4.length - this._nullCellCount}D`, r2 += "\x1B[B"), this._lastContentCursorRow = t3 + 1, this._lastContentCursorCol = 0, this._lastCursorRow = t3 + 1, this._lastCursorCol = 0);
8356
+ const i2 = e4.getCell(e4.length - 1, this._thisRowLastChar), n2 = e4.getCell(e4.length - 2, this._thisRowLastSecondChar), o2 = s2.getCell(0, this._nextRowFirstChar), l2 = o2.getWidth() > 1;
8357
+ let a2 = false;
8358
+ if (o2.getChars() && (l2 ? this._nullCellCount <= 1 : this._nullCellCount <= 0) && ((i2.getChars() || 0 === i2.getWidth()) && u(i2, o2) && (a2 = true), l2 && (n2.getChars() || 0 === n2.getWidth()) && u(i2, o2) && u(n2, o2) && (a2 = true)), !a2) {
8359
+ if (r2 = "-".repeat(this._nullCellCount + 1), r2 += "\x1B[1D\x1B[1X", this._nullCellCount > 0) {
8360
+ r2 += "\x1B[A";
8361
+ const t4 = e4.length - this._nullCellCount;
8362
+ t4 > 0 && (r2 += `\x1B[${t4}C`), r2 += `\x1B[${this._nullCellCount}X`, t4 > 0 && (r2 += `\x1B[${t4}D`), r2 += "\x1B[B";
8363
+ }
8364
+ this._lastContentCursorRow = t3 + 1, this._lastContentCursorCol = 0, this._lastCursorRow = t3 + 1, this._lastCursorCol = 0;
8365
+ }
8403
8366
  } else r2 = "\r\n", this._lastCursorRow = t3 + 1, this._lastCursorCol = 0;
8404
8367
  }
8405
8368
  this._allRows[this._rowIndex] = this._currentRow, this._allRowSeparators[this._rowIndex++] = r2, this._currentRow = "", this._nullCellCount = 0;
8406
8369
  }
8407
8370
  _diffStyle(t3, e3) {
8408
8371
  const r2 = [];
8409
- if (h(t3, e3)) return r2;
8410
- const s2 = !o(t3, e3), i2 = !l(t3, e3), n2 = !u(t3, e3);
8372
+ if (f(t3, e3)) return r2;
8373
+ const s2 = !a(t3, e3), i2 = !u(t3, e3), n2 = !c(t3, e3);
8411
8374
  if (s2 || i2 || n2) if (t3.isAttributeDefault()) e3.isAttributeDefault() || r2.push(0);
8412
8375
  else {
8413
8376
  if (s2) {
@@ -8419,7 +8382,13 @@ var require_addon_serialize = __commonJS({
8419
8382
  t3.isBgRGB() ? r2.push(48, 2, e4 >>> 16 & 255, e4 >>> 8 & 255, 255 & e4) : t3.isBgPalette() ? e4 >= 16 ? r2.push(48, 5, e4) : r2.push(8 & e4 ? 100 + (7 & e4) : 40 + (7 & e4)) : r2.push(49);
8420
8383
  }
8421
8384
  if (n2) {
8422
- if (t3.isInverse() !== e3.isInverse() && r2.push(t3.isInverse() ? 7 : 27), t3.isBold() !== e3.isBold() && r2.push(t3.isBold() ? 1 : 22), a(t3, e3)) t3.isUnderline() !== e3.isUnderline() && r2.push(t3.isUnderline() ? 4 : 24);
8385
+ t3.isInverse() !== e3.isInverse() && r2.push(t3.isInverse() ? 7 : 27);
8386
+ const s3 = t3.isBold() !== e3.isBold(), i3 = t3.isDim() !== e3.isDim();
8387
+ if (s3 || i3) {
8388
+ const e4 = s3 && !t3.isBold() || i3 && !t3.isDim();
8389
+ e4 && r2.push(22), t3.isBold() && (s3 || e4) && r2.push(1), t3.isDim() && (i3 || e4) && r2.push(2);
8390
+ }
8391
+ if (h(t3, e3)) t3.isUnderline() !== e3.isUnderline() && r2.push(t3.isUnderline() ? 4 : 24);
8423
8392
  else {
8424
8393
  const e4 = t3.getUnderlineStyle();
8425
8394
  if (0 === e4) r2.push(24);
@@ -8429,27 +8398,44 @@ var require_addon_serialize = __commonJS({
8429
8398
  t3.isUnderlineColorRGB() ? r2.push("58:2::" + (e5 >>> 16 & 255) + ":" + (e5 >>> 8 & 255) + ":" + (255 & e5)) : r2.push("58:5:" + e5);
8430
8399
  }
8431
8400
  }
8432
- t3.isOverline() !== e3.isOverline() && r2.push(t3.isOverline() ? 53 : 55), t3.isBlink() !== e3.isBlink() && r2.push(t3.isBlink() ? 5 : 25), t3.isInvisible() !== e3.isInvisible() && r2.push(t3.isInvisible() ? 8 : 28), t3.isItalic() !== e3.isItalic() && r2.push(t3.isItalic() ? 3 : 23), t3.isDim() !== e3.isDim() && r2.push(t3.isDim() ? 2 : 22), t3.isStrikethrough() !== e3.isStrikethrough() && r2.push(t3.isStrikethrough() ? 9 : 29);
8401
+ t3.isOverline() !== e3.isOverline() && r2.push(t3.isOverline() ? 53 : 55), t3.isBlink() !== e3.isBlink() && r2.push(t3.isBlink() ? 5 : 25), t3.isInvisible() !== e3.isInvisible() && r2.push(t3.isInvisible() ? 8 : 28), t3.isItalic() !== e3.isItalic() && r2.push(t3.isItalic() ? 3 : 23), t3.isStrikethrough() !== e3.isStrikethrough() && r2.push(t3.isStrikethrough() ? 9 : 29);
8433
8402
  }
8434
8403
  }
8435
8404
  return r2;
8436
8405
  }
8406
+ _setOscLink(t3) {
8407
+ if (t3 === this._activeOscLinkId) return "";
8408
+ let e3 = this._activeOscLinkId ? "\x1B]8;;\x1B\\" : "";
8409
+ this._activeOscLinkId = 0;
8410
+ const r2 = n(this._terminal, t3);
8411
+ return r2 && (this._activeOscLinkId = t3, e3 += r2), e3;
8412
+ }
8437
8413
  _nextCell(t3, e3, r2, s2) {
8438
8414
  if (0 === t3.getWidth()) return;
8439
- const i2 = "" === t3.getChars(), n2 = this._diffStyle(t3, this._cursorStyle);
8440
- if (i2 ? !l(this._cursorStyle, t3) : n2.length > 0) {
8441
- this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = r2, this._lastContentCursorCol = this._lastCursorCol = s2, this._currentRow += `\x1B[${n2.join(";")}m`;
8415
+ const n2 = "" === t3.getChars(), o2 = n2 && t3.isInverse() ? this._buffer.getLine(r2 + 1) : void 0, l2 = o2?.getCell(0, this._nextRowFirstChar), a2 = s2 === this._terminal.cols - 1 && o2?.isWrapped && (l2?.getWidth() ?? 0) > 1 && !!l2 && f(t3, l2), h2 = n2 && !!t3.isInverse() && !a2, c2 = this._diffStyle(t3, this._cursorStyle);
8416
+ if (n2 ? h2 ? c2.length > 0 : !u(this._cursorStyle, t3) : c2.length > 0) {
8417
+ this._nullCellCount > 0 && (u(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._lastContentCursorRow = this._lastCursorRow = r2, this._lastContentCursorCol = this._lastCursorCol = s2, this._currentRow += `\x1B[${c2.join(";")}m`;
8442
8418
  const t4 = this._buffer.getLine(r2);
8443
8419
  void 0 !== t4 && (t4.getCell(s2, this._cursorStyle), this._cursorStyleRow = r2, this._cursorStyleCol = s2);
8444
8420
  }
8445
- i2 ? this._nullCellCount += t3.getWidth() : (this._nullCellCount > 0 && (l(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._currentRow += t3.getChars(), this._lastContentCursorRow = this._lastCursorRow = r2, this._lastContentCursorCol = this._lastCursorCol = s2 + t3.getWidth());
8421
+ if (n2 && !h2) this._nullCellCount += t3.getWidth();
8422
+ else {
8423
+ if (this._nullCellCount > 0 && (u(this._cursorStyle, this._backgroundCell) || (this._currentRow += `\x1B[${this._nullCellCount}X`), this._currentRow += `\x1B[${this._nullCellCount}C`, this._nullCellCount = 0), this._currentRow += this._setOscLink(i(t3)), h2) {
8424
+ const e4 = !!t3.isUnderline() || !!t3.isStrikethrough() || !!t3.isOverline();
8425
+ if (e4 && (this._currentRow += "\x1B[24;29;55m"), this._currentRow += " ".repeat(t3.getWidth()), e4) {
8426
+ const e5 = this._diffStyle(t3, this._defaultCell);
8427
+ this._currentRow += `\x1B[0m\x1B[${e5.join(";")}m`;
8428
+ }
8429
+ } else this._currentRow += t3.getChars();
8430
+ this._lastContentCursorRow = this._lastCursorRow = r2, this._lastContentCursorCol = this._lastCursorCol = s2 + t3.getWidth();
8431
+ }
8446
8432
  }
8447
8433
  _serializeString(t3) {
8448
8434
  let e3 = this._allRows.length;
8449
8435
  this._buffer.length - this._firstRow <= this._terminal.rows && (e3 = this._lastContentCursorRow + 1 - this._firstRow, this._lastCursorCol = this._lastContentCursorCol, this._lastCursorRow = this._lastContentCursorRow);
8450
8436
  let r2 = "";
8451
8437
  for (let t4 = 0; t4 < e3; t4++) r2 += this._allRows[t4], t4 + 1 < e3 && (r2 += this._allRowSeparators[t4]);
8452
- if (!t3) {
8438
+ if (r2 += this._setOscLink(0), !t3) {
8453
8439
  const t4 = this._buffer.baseY + this._buffer.cursorY, e4 = this._buffer.cursorX, i3 = (t5) => {
8454
8440
  t5 > 0 ? r2 += `\x1B[${t5}C` : t5 < 0 && (r2 += `\x1B[${-t5}D`);
8455
8441
  };
@@ -8465,18 +8451,18 @@ var require_addon_serialize = __commonJS({
8465
8451
  this._terminal = t3;
8466
8452
  }
8467
8453
  _serializeBufferByScrollback(t3, e3, r2) {
8468
- const s2 = e3.length, n2 = void 0 === r2 ? s2 : i(r2 + t3.rows, 0, s2);
8469
- return this._serializeBufferByRange(t3, e3, { start: s2 - n2, end: s2 - 1 }, false);
8454
+ const s2 = e3.length, i2 = void 0 === r2 ? s2 : o(r2 + t3.rows, 0, s2);
8455
+ return this._serializeBufferByRange(t3, e3, { start: s2 - i2, end: s2 - 1 }, false);
8470
8456
  }
8471
8457
  _serializeBufferByRange(t3, e3, r2, s2) {
8472
- return new c(e3, t3).serialize({ start: { x: 0, y: "number" == typeof r2.start ? r2.start : r2.start.line }, end: { x: t3.cols, y: "number" == typeof r2.end ? r2.end : r2.end.line } }, s2);
8458
+ return new _(e3, t3).serialize({ start: { x: 0, y: "number" == typeof r2.start ? r2.start : r2.start.line }, end: { x: t3.cols, y: "number" == typeof r2.end ? r2.end : r2.end.line } }, s2);
8473
8459
  }
8474
8460
  _serializeBufferAsHTML(t3, e3) {
8475
- const r2 = t3.buffer.active, s2 = new f(r2, t3, e3), n2 = e3.onlySelection ?? false, o2 = e3.range;
8476
- if (o2) return s2.serialize({ start: { x: o2.startCol, y: (o2.startLine, o2.startLine) }, end: { x: t3.cols, y: (o2.endLine, o2.endLine) } });
8477
- if (!n2) {
8478
- const n3 = r2.length, o3 = e3.scrollback, l3 = void 0 === o3 ? n3 : i(o3 + t3.rows, 0, n3);
8479
- return s2.serialize({ start: { x: 0, y: n3 - l3 }, end: { x: t3.cols, y: n3 - 1 } });
8461
+ const r2 = t3.buffer.active, s2 = new d(r2, t3, e3), i2 = e3.onlySelection ?? false, n2 = e3.range;
8462
+ if (n2) return s2.serialize({ start: { x: n2.startCol, y: (n2.startLine, n2.startLine) }, end: { x: t3.cols, y: (n2.endLine, n2.endLine) } });
8463
+ if (!i2) {
8464
+ const i3 = r2.length, n3 = e3.scrollback, l3 = void 0 === n3 ? i3 : o(n3 + t3.rows, 0, i3);
8465
+ return s2.serialize({ start: { x: 0, y: i3 - l3 }, end: { x: t3.cols, y: i3 - 1 } });
8480
8466
  }
8481
8467
  const l2 = this._terminal?.getSelectionPosition();
8482
8468
  return void 0 !== l2 ? s2.serialize({ start: { x: l2.start.x, y: l2.start.y }, end: { x: l2.end.x, y: l2.end.y } }) : "";
@@ -8506,7 +8492,10 @@ var require_addon_serialize = __commonJS({
8506
8492
  serialize(t3) {
8507
8493
  if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
8508
8494
  let e3 = t3?.range ? this._serializeBufferByRange(this._terminal, this._terminal.buffer.normal, t3.range, true) : this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.normal, t3?.scrollback);
8509
- return t3?.excludeAltBuffer || "alternate" !== this._terminal.buffer.active.type || (e3 += `\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0)}`), t3?.excludeModes || (e3 += this._serializeModes(this._terminal), e3 += this._serializeScrollRegion(this._terminal)), e3;
8495
+ return t3?.excludeAltBuffer || "alternate" !== this._terminal.buffer.active.type || (e3 += `\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal, this._terminal.buffer.alternate, void 0)}`), t3?.excludeModes || (e3 += this._serializeModes(this._terminal), e3 += this._serializeScrollRegion(this._terminal)), e3 += (function(t4) {
8496
+ const e4 = t4._core?._inputHandler?._curAttrData;
8497
+ return e4 ? n(t4, i(e4)) : "";
8498
+ })(this._terminal), e3;
8510
8499
  }
8511
8500
  serializeAsHTML(t3) {
8512
8501
  if (!this._terminal) throw new Error("Cannot use addon until it has been loaded");
@@ -8515,7 +8504,7 @@ var require_addon_serialize = __commonJS({
8515
8504
  dispose() {
8516
8505
  }
8517
8506
  };
8518
- class f extends n {
8507
+ class d extends l {
8519
8508
  constructor(t3, r2, s2) {
8520
8509
  super(t3), this._terminal = r2, this._options = s2, this._currentRow = "", this._htmlContent = "", r2._core._themeService ? this._ansiColors = r2._core._themeService.colors.ansi : this._ansiColors = e2.DEFAULT_ANSI_COLORS;
8521
8510
  }
@@ -8558,8 +8547,8 @@ var require_addon_serialize = __commonJS({
8558
8547
  }
8559
8548
  _diffStyle(t3, e3) {
8560
8549
  const r2 = [];
8561
- if (h(t3, e3)) return;
8562
- const s2 = !o(t3, e3), i2 = !l(t3, e3), n2 = !u(t3, e3);
8550
+ if (f(t3, e3)) return;
8551
+ const s2 = !a(t3, e3), i2 = !u(t3, e3), n2 = !c(t3, e3);
8563
8552
  if (s2 || i2 || n2) {
8564
8553
  const e4 = this._getHexColor(t3, true);
8565
8554
  e4 && r2.push("color: " + e4 + ";");
@@ -8590,15 +8579,15 @@ var require_addon_serialize = __commonJS({
8590
8579
  return this._htmlContent;
8591
8580
  }
8592
8581
  }
8593
- t2.HTMLSerializeHandler = f;
8582
+ t2.HTMLSerializeHandler = d;
8594
8583
  })(), s;
8595
8584
  })());
8596
8585
  }
8597
8586
  });
8598
8587
 
8599
- // ../../node_modules/.pnpm/@xterm+addon-unicode11@0.10.0-beta.291_@xterm+xterm@6.1.0-beta.291/node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js
8588
+ // ../../node_modules/.pnpm/@xterm+addon-unicode11@0.10.0-beta.300_@xterm+xterm@6.1.0-beta.303/node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js
8600
8589
  var require_addon_unicode11 = __commonJS({
8601
- "../../node_modules/.pnpm/@xterm+addon-unicode11@0.10.0-beta.291_@xterm+xterm@6.1.0-beta.291/node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js"(exports, module) {
8590
+ "../../node_modules/.pnpm/@xterm+addon-unicode11@0.10.0-beta.300_@xterm+xterm@6.1.0-beta.303/node_modules/@xterm/addon-unicode11/lib/addon-unicode11.js"(exports, module) {
8602
8591
  !(function(e, s) {
8603
8592
  "object" == typeof exports && "object" == typeof module ? module.exports = s() : "function" == typeof define && define.amd ? define([], s) : "object" == typeof exports ? exports.Unicode11Addon = s() : e.Unicode11Addon = s();
8604
8593
  })(globalThis, () => (() => {
@@ -8616,27 +8605,19 @@ var require_addon_unicode11 = __commonJS({
8616
8605
  if (this._disposed) return (0, i2.toDisposable)(() => {
8617
8606
  });
8618
8607
  const r2 = { fn: e3, thisArgs: s3 };
8619
- this._listeners.push(r2);
8608
+ this._listeners = this._listeners.slice(), this._listeners.push(r2);
8620
8609
  const o = (0, i2.toDisposable)(() => {
8621
8610
  const e4 = this._listeners.indexOf(r2);
8622
- -1 !== e4 && this._listeners.splice(e4, 1);
8611
+ -1 !== e4 && (this._listeners = this._listeners.slice(), this._listeners.splice(e4, 1));
8623
8612
  });
8624
8613
  return t3 && (Array.isArray(t3) ? t3.push(o) : t3.add(o)), o;
8625
8614
  }), this._event;
8626
8615
  }
8627
8616
  fire(e3) {
8628
- if (!this._disposed) switch (this._listeners.length) {
8629
- case 0:
8630
- return;
8631
- case 1: {
8632
- const { fn: s3, thisArgs: t3 } = this._listeners[0];
8633
- return void s3.call(t3, e3);
8634
- }
8635
- default: {
8636
- const s3 = this._listeners.slice();
8637
- for (const { fn: t3, thisArgs: i3 } of s3) t3.call(i3, e3);
8638
- }
8639
- }
8617
+ if (this._disposed || !this._listeners.length) return;
8618
+ if (1 === this._listeners.length) return void this._listeners[0].fn.call(this._listeners[0].thisArgs, e3);
8619
+ const s3 = this._listeners;
8620
+ for (let t3 = 0, i3 = s3.length; t3 < i3; ++t3) s3[t3].fn.call(s3[t3].thisArgs, e3);
8640
8621
  }
8641
8622
  dispose() {
8642
8623
  this._disposed || (this._disposed = true, this._listeners.length = 0);
@@ -8786,7 +8767,7 @@ var require_addon_unicode11 = __commonJS({
8786
8767
  Object.defineProperty(s2, "__esModule", { value: true }), s2.UnicodeV11 = void 0;
8787
8768
  const i2 = t2(765), r = [[768, 879], [1155, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1541], [1552, 1562], [1564, 1564], [1611, 1631], [1648, 1648], [1750, 1757], [1759, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2045, 2045], [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2093], [2137, 2139], [2259, 2306], [2362, 2362], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2391], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2558, 2558], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2641, 2641], [2672, 2673], [2677, 2677], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2810, 2815], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2884], [2893, 2893], [2902, 2902], [2914, 2915], [2946, 2946], [3008, 3008], [3021, 3021], [3072, 3072], [3076, 3076], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3170, 3171], [3201, 3201], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3328, 3329], [3387, 3388], [3393, 3396], [3405, 3405], [3426, 3427], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3981, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4151], [4153, 4154], [4157, 4158], [4184, 4185], [4190, 4192], [4209, 4212], [4226, 4226], [4229, 4230], [4237, 4237], [4253, 4253], [4448, 4607], [4957, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6158], [6277, 6278], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6683, 6683], [6742, 6742], [6744, 6750], [6752, 6752], [6754, 6754], [6757, 6764], [6771, 6780], [6783, 6783], [6832, 6846], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7040, 7041], [7074, 7077], [7080, 7081], [7083, 7085], [7142, 7142], [7144, 7145], [7149, 7149], [7151, 7153], [7212, 7219], [7222, 7223], [7376, 7378], [7380, 7392], [7394, 7400], [7405, 7405], [7412, 7412], [7416, 7417], [7616, 7673], [7675, 7679], [8203, 8207], [8234, 8238], [8288, 8292], [8294, 8303], [8400, 8432], [11503, 11505], [11647, 11647], [11744, 11775], [12330, 12333], [12441, 12442], [42607, 42610], [42612, 42621], [42654, 42655], [42736, 42737], [43010, 43010], [43014, 43014], [43019, 43019], [43045, 43046], [43204, 43205], [43232, 43249], [43263, 43263], [43302, 43309], [43335, 43345], [43392, 43394], [43443, 43443], [43446, 43449], [43452, 43453], [43493, 43493], [43561, 43566], [43569, 43570], [43573, 43574], [43587, 43587], [43596, 43596], [43644, 43644], [43696, 43696], [43698, 43700], [43703, 43704], [43710, 43711], [43713, 43713], [43756, 43757], [43766, 43766], [44005, 44005], [44008, 44008], [44013, 44013], [64286, 64286], [65024, 65039], [65056, 65071], [65279, 65279], [65529, 65531]], o = [[66045, 66045], [66272, 66272], [66422, 66426], [68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [68325, 68326], [68900, 68903], [69446, 69456], [69633, 69633], [69688, 69702], [69759, 69761], [69811, 69814], [69817, 69818], [69821, 69821], [69837, 69837], [69888, 69890], [69927, 69931], [69933, 69940], [70003, 70003], [70016, 70017], [70070, 70078], [70089, 70092], [70191, 70193], [70196, 70196], [70198, 70199], [70206, 70206], [70367, 70367], [70371, 70378], [70400, 70401], [70459, 70460], [70464, 70464], [70502, 70508], [70512, 70516], [70712, 70719], [70722, 70724], [70726, 70726], [70750, 70750], [70835, 70840], [70842, 70842], [70847, 70848], [70850, 70851], [71090, 71093], [71100, 71101], [71103, 71104], [71132, 71133], [71219, 71226], [71229, 71229], [71231, 71232], [71339, 71339], [71341, 71341], [71344, 71349], [71351, 71351], [71453, 71455], [71458, 71461], [71463, 71467], [71727, 71735], [71737, 71738], [72148, 72151], [72154, 72155], [72160, 72160], [72193, 72202], [72243, 72248], [72251, 72254], [72263, 72263], [72273, 72278], [72281, 72283], [72330, 72342], [72344, 72345], [72752, 72758], [72760, 72765], [72767, 72767], [72850, 72871], [72874, 72880], [72882, 72883], [72885, 72886], [73009, 73014], [73018, 73018], [73020, 73021], [73023, 73029], [73031, 73031], [73104, 73105], [73109, 73109], [73111, 73111], [73459, 73460], [78896, 78904], [92912, 92916], [92976, 92982], [94031, 94031], [94095, 94098], [113821, 113822], [113824, 113827], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [121344, 121398], [121403, 121452], [121461, 121461], [121476, 121476], [121499, 121503], [121505, 121519], [122880, 122886], [122888, 122904], [122907, 122913], [122915, 122916], [122918, 122922], [123184, 123190], [123628, 123631], [125136, 125142], [125252, 125258], [917505, 917505], [917536, 917631], [917760, 917999]], n = [[4352, 4447], [8986, 8987], [9001, 9002], [9193, 9196], [9200, 9200], [9203, 9203], [9725, 9726], [9748, 9749], [9800, 9811], [9855, 9855], [9875, 9875], [9889, 9889], [9898, 9899], [9917, 9918], [9924, 9925], [9934, 9934], [9940, 9940], [9962, 9962], [9970, 9971], [9973, 9973], [9978, 9978], [9981, 9981], [9989, 9989], [9994, 9995], [10024, 10024], [10060, 10060], [10062, 10062], [10067, 10069], [10071, 10071], [10133, 10135], [10160, 10160], [10175, 10175], [11035, 11036], [11088, 11088], [11093, 11093], [11904, 11929], [11931, 12019], [12032, 12245], [12272, 12283], [12288, 12329], [12334, 12350], [12353, 12438], [12443, 12543], [12549, 12591], [12593, 12686], [12688, 12730], [12736, 12771], [12784, 12830], [12832, 12871], [12880, 19903], [19968, 42124], [42128, 42182], [43360, 43388], [44032, 55203], [63744, 64255], [65040, 65049], [65072, 65106], [65108, 65126], [65128, 65131], [65281, 65376], [65504, 65510]], d = [[94176, 94179], [94208, 100343], [100352, 101106], [110592, 110878], [110928, 110930], [110948, 110951], [110960, 111355], [126980, 126980], [127183, 127183], [127374, 127374], [127377, 127386], [127488, 127490], [127504, 127547], [127552, 127560], [127568, 127569], [127584, 127589], [127744, 127776], [127789, 127797], [127799, 127868], [127870, 127891], [127904, 127946], [127951, 127955], [127968, 127984], [127988, 127988], [127992, 128062], [128064, 128064], [128066, 128252], [128255, 128317], [128331, 128334], [128336, 128359], [128378, 128378], [128405, 128406], [128420, 128420], [128507, 128591], [128640, 128709], [128716, 128716], [128720, 128722], [128725, 128725], [128747, 128748], [128756, 128762], [128992, 129003], [129293, 129393], [129395, 129398], [129402, 129442], [129445, 129450], [129454, 129482], [129485, 129535], [129648, 129651], [129656, 129658], [129664, 129666], [129680, 129685], [131072, 196605], [196608, 262141]];
8788
8769
  let c;
8789
- function a(e3, s3) {
8770
+ function l(e3, s3) {
8790
8771
  let t3, i3 = 0, r2 = s3.length - 1;
8791
8772
  if (e3 < s3[0][0] || e3 > s3[r2][1]) return false;
8792
8773
  for (; r2 >= i3; ) if (t3 = i3 + r2 >> 1, e3 > s3[t3][1]) i3 = t3 + 1;
@@ -8805,7 +8786,7 @@ var require_addon_unicode11 = __commonJS({
8805
8786
  }
8806
8787
  }
8807
8788
  wcwidth(e3) {
8808
- return e3 < 32 ? 0 : e3 < 127 ? 1 : e3 < 65536 ? c[e3] : a(e3, o) ? 0 : a(e3, d) ? 2 : 1;
8789
+ return e3 < 32 ? 0 : e3 < 127 ? 1 : e3 < 65536 ? c[e3] : l(e3, o) ? 0 : l(e3, d) ? 2 : 1;
8809
8790
  }
8810
8791
  charProperties(e3, s3) {
8811
8792
  let t3 = this.wcwidth(e3), r2 = 0 === t3 && 0 !== s3;
@@ -8855,15 +8836,22 @@ function createLogger(name) {
8855
8836
 
8856
8837
  // src/server/infra/terminals/daemon/daemon-server.ts
8857
8838
  import { randomBytes as randomBytes2, timingSafeEqual } from "node:crypto";
8858
- import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync, renameSync as renameSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync2 } from "node:fs";
8839
+ import { chmodSync as chmodSync2, lstatSync as lstatSync2, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync as unlinkSync3, writeFileSync as writeFileSync2 } from "node:fs";
8859
8840
  import { createServer } from "node:net";
8860
- import { dirname as dirname3 } from "node:path";
8841
+ import { dirname as dirname3, join as join6 } from "node:path";
8842
+
8843
+ // src/server/infra/terminals/node-pty-loader.ts
8844
+ var cachedImport;
8845
+ function preloadNodePty() {
8846
+ cachedImport ??= import("node-pty");
8847
+ return cachedImport;
8848
+ }
8861
8849
 
8862
8850
  // src/server/infra/terminals/terminal-pool.ts
8863
8851
  import { randomUUID } from "node:crypto";
8864
8852
  import { existsSync as existsSync2, unlinkSync, writeFileSync } from "node:fs";
8865
8853
  import { tmpdir } from "node:os";
8866
- import { join, sep } from "node:path";
8854
+ import { join as join3, sep } from "node:path";
8867
8855
 
8868
8856
  // src/server/infra/process/path.ts
8869
8857
  import { execFile } from "node:child_process";
@@ -8925,12 +8913,163 @@ async function shellPath() {
8925
8913
  return fallback;
8926
8914
  }
8927
8915
 
8916
+ // src/server/infra/terminals/claude-resume.ts
8917
+ import { readdirSync, statSync } from "node:fs";
8918
+ import { homedir } from "node:os";
8919
+ import { join } from "node:path";
8920
+ var CLAUDE_COMMAND_PATTERN = /^claude(\s|$)/;
8921
+ var CLAUDE_RESUME_FLAG_PATTERN = /(^|\s)(--resume|-r)(\s|$)/;
8922
+ var SESSION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8923
+ function isResumableClaudeCommand(command) {
8924
+ if (!command) return false;
8925
+ const trimmed = command.trim();
8926
+ return CLAUDE_COMMAND_PATTERN.test(trimmed) && !CLAUDE_RESUME_FLAG_PATTERN.test(trimmed);
8927
+ }
8928
+ function claudeProjectDir(cwd) {
8929
+ return join(homedir(), ".claude", "projects", cwd.replaceAll("/", "-"));
8930
+ }
8931
+ function findLatestClaudeSessionId(cwd) {
8932
+ const dir = claudeProjectDir(cwd);
8933
+ let names;
8934
+ try {
8935
+ names = readdirSync(dir).filter((name) => name.endsWith(".jsonl"));
8936
+ } catch {
8937
+ return null;
8938
+ }
8939
+ let newest = null;
8940
+ for (const name of names) {
8941
+ let mtimeMs;
8942
+ try {
8943
+ mtimeMs = statSync(join(dir, name)).mtimeMs;
8944
+ } catch {
8945
+ continue;
8946
+ }
8947
+ if (!newest || mtimeMs > newest.mtimeMs) {
8948
+ newest = { id: name.slice(0, -".jsonl".length), mtimeMs };
8949
+ }
8950
+ }
8951
+ if (!newest || !SESSION_ID_PATTERN.test(newest.id)) return null;
8952
+ return newest.id;
8953
+ }
8954
+ function buildClaudeResumeCommand(originalCommand, sessionId) {
8955
+ return `${originalCommand.trim()} --resume ${sessionId}`;
8956
+ }
8957
+
8958
+ // src/server/infra/terminals/pty-error-hints.ts
8959
+ var MODULE_LOAD_PATTERN = /Cannot find module|MODULE_NOT_FOUND|pty\.node/i;
8960
+ var RESOURCE_EXHAUSTION_PATTERN = /\b(EMFILE|ENFILE|ENOMEM|EAGAIN)\b/;
8961
+ function hintForPtySpawnError(err) {
8962
+ const message = err instanceof Error ? err.message : String(err);
8963
+ if (MODULE_LOAD_PATTERN.test(message)) {
8964
+ return "The terminal service could not load its native module. Restart the terminal service from Settings.";
8965
+ }
8966
+ if (RESOURCE_EXHAUSTION_PATTERN.test(message)) {
8967
+ return "Your system cannot start another terminal process. Close unused terminals and try again.";
8968
+ }
8969
+ return "Failed to start the terminal shell.";
8970
+ }
8971
+
8972
+ // src/server/infra/terminals/terminal-history.ts
8973
+ import { readdirSync as readdirSync2, readFileSync, rmSync } from "node:fs";
8974
+ import { mkdir, rename, writeFile } from "node:fs/promises";
8975
+ import { join as join2 } from "node:path";
8976
+ var log = createLogger("terminal-history");
8977
+ var CHECKPOINT_MAX_BYTES = 5 * 1024 * 1024;
8978
+ var TerminalHistoryManager = class {
8979
+ constructor(historyDir) {
8980
+ this.historyDir = historyDir;
8981
+ }
8982
+ sessionDir(terminalId) {
8983
+ return join2(this.historyDir, encodeURIComponent(terminalId));
8984
+ }
8985
+ readMeta(terminalId) {
8986
+ return readJson(join2(this.sessionDir(terminalId), "meta.json"));
8987
+ }
8988
+ readCheckpoint(terminalId) {
8989
+ return readJson(
8990
+ join2(this.sessionDir(terminalId), "checkpoint.json")
8991
+ );
8992
+ }
8993
+ /**
8994
+ * Async: called from the PTY output hot path (`TerminalPool.onData`), so
8995
+ * this must never block the daemon's single event loop the way the
8996
+ * synchronous `fs` calls it replaced (`writeFileSync`/`renameSync`) would —
8997
+ * a slow or networked filesystem could otherwise delay every other
8998
+ * terminal's output delivery, the exact regression issue #676 fixed for a
8999
+ * different code path.
9000
+ */
9001
+ async writeMeta(terminalId, meta) {
9002
+ await writeJson(this.sessionDir(terminalId), "meta.json", meta);
9003
+ }
9004
+ async writeCheckpoint(terminalId, checkpoint) {
9005
+ const serialized = JSON.stringify(checkpoint);
9006
+ const bytes = Buffer.byteLength(serialized);
9007
+ if (bytes > CHECKPOINT_MAX_BYTES) {
9008
+ log.warn({ terminalId, bytes }, "terminal history checkpoint too large; skipping this write");
9009
+ return;
9010
+ }
9011
+ await writeJson(this.sessionDir(terminalId), "checkpoint.json", checkpoint, serialized);
9012
+ }
9013
+ /** Drop a terminal's saved history: its tab or workspace was actually closed or deleted. */
9014
+ removeSession(terminalId) {
9015
+ try {
9016
+ rmSync(this.sessionDir(terminalId), { recursive: true, force: true });
9017
+ } catch (err) {
9018
+ log.warn({ err, terminalId }, "failed to remove terminal history directory");
9019
+ }
9020
+ }
9021
+ /**
9022
+ * Drop every saved session whose last known `workspaceId` is `workspaceId`
9023
+ * — used when a workspace is deleted. Scans the whole history directory
9024
+ * rather than the pool's live reverse index, which by then may already be
9025
+ * missing terminals that exited (and were never explicitly killed) before
9026
+ * the workspace was removed.
9027
+ */
9028
+ removeSessionsForWorkspace(workspaceId) {
9029
+ let names;
9030
+ try {
9031
+ names = readdirSync2(this.historyDir);
9032
+ } catch {
9033
+ return;
9034
+ }
9035
+ for (const name of names) {
9036
+ const dir = join2(this.historyDir, name);
9037
+ const meta = readJson(join2(dir, "meta.json"));
9038
+ if (meta?.workspaceId !== workspaceId) continue;
9039
+ try {
9040
+ rmSync(dir, { recursive: true, force: true });
9041
+ } catch (err) {
9042
+ log.warn({ err, dir }, "failed to remove terminal history directory");
9043
+ }
9044
+ }
9045
+ }
9046
+ };
9047
+ function readJson(path) {
9048
+ try {
9049
+ return JSON.parse(readFileSync(path, "utf8"));
9050
+ } catch {
9051
+ return null;
9052
+ }
9053
+ }
9054
+ async function writeJson(dir, name, value, serialized) {
9055
+ try {
9056
+ await mkdir(dir, { recursive: true, mode: 448 });
9057
+ const path = join2(dir, name);
9058
+ const tmp = `${path}.${process.pid}.${Date.now()}.tmp`;
9059
+ await writeFile(tmp, serialized ?? JSON.stringify(value), { mode: 384 });
9060
+ await rename(tmp, path);
9061
+ } catch (err) {
9062
+ log.warn({ err, dir, name }, "failed to write terminal history file");
9063
+ }
9064
+ }
9065
+
8928
9066
  // src/server/infra/terminals/terminal-pool.ts
8929
- var log = createLogger("terminal-pool");
9067
+ var log2 = createLogger("terminal-pool");
8930
9068
  var MAX_SCROLLBACK_SIZE = 1e5;
8931
9069
  var HEADLESS_SCROLLBACK_LINES = 1e4;
8932
9070
  var MAX_COLS = 1e3;
8933
9071
  var MAX_ROWS = 1e3;
9072
+ var HISTORY_CHECKPOINT_INTERVAL_MS = 1e4;
8934
9073
  var OutputTail = class {
8935
9074
  constructor(max) {
8936
9075
  this.max = max;
@@ -8964,6 +9103,22 @@ var OutputTail = class {
8964
9103
  }
8965
9104
  };
8966
9105
  var TerminalPool = class {
9106
+ historyStore;
9107
+ /**
9108
+ * terminalIds whose next `onExit` should prune (not checkpoint) their
9109
+ * history: set by an explicit `kill` / `killWorkspace`, i.e. the tab or
9110
+ * workspace is actually being closed or deleted. `killAll` (daemon
9111
+ * shutdown/restart) deliberately never adds to this set, so those sessions
9112
+ * stay cold-restorable.
9113
+ */
9114
+ pruneHistoryOnExit = /* @__PURE__ */ new Set();
9115
+ /**
9116
+ * In-flight history checkpoint writes (see {@link checkpointHistoryNow}).
9117
+ * `hasPendingHistoryWrites` lets the daemon's shutdown wait for these
9118
+ * before exiting, since they are async and no longer complete before
9119
+ * `onExit` returns.
9120
+ */
9121
+ pendingHistoryWrites = /* @__PURE__ */ new Set();
8967
9122
  /** terminalId -> session */
8968
9123
  terminals = /* @__PURE__ */ new Map();
8969
9124
  /** workspaceId -> Set<terminalId> (reverse index for workspace-level cleanup) */
@@ -8988,6 +9143,9 @@ var TerminalPool = class {
8988
9143
  /** terminalIds with a shrink-and-restore nudge in flight (see
8989
9144
  * {@link nudgeResize} for why concurrent nudges must not compound). */
8990
9145
  nudging = /* @__PURE__ */ new Set();
9146
+ constructor(options) {
9147
+ this.historyStore = options?.historyDir ? new TerminalHistoryManager(options.historyDir) : null;
9148
+ }
8991
9149
  /**
8992
9150
  * Spawn (or return the already-spawning/spawned) PTY for a terminalId.
8993
9151
  *
@@ -9014,6 +9172,8 @@ var TerminalPool = class {
9014
9172
  async spawnNew(workspaceId, terminalId, workspaceRoot, options, extras) {
9015
9173
  const shell = defaultShell();
9016
9174
  const resolvedPath = await shellPath();
9175
+ const historyMeta = this.historyStore?.readMeta(terminalId) ?? null;
9176
+ const checkpoint = historyMeta?.workspaceId === workspaceId ? this.historyStore?.readCheckpoint(terminalId) ?? null : null;
9017
9177
  const env = {};
9018
9178
  for (const [key, value] of Object.entries(extras?.baseEnv ?? process.env)) {
9019
9179
  if (value != null) {
@@ -9034,18 +9194,14 @@ var TerminalPool = class {
9034
9194
  env.BAND_DISPATCH = "terminal";
9035
9195
  let cwd = workspaceRoot;
9036
9196
  if (options?.cwd) {
9037
- const resolved = join(workspaceRoot, options.cwd);
9038
- if (resolved !== workspaceRoot && !resolved.startsWith(workspaceRoot + sep)) {
9039
- log.warn(
9040
- "Ignoring cwd %s \u2014 resolves outside workspace root %s",
9041
- options.cwd,
9042
- workspaceRoot
9043
- );
9044
- } else if (existsSync2(resolved)) {
9045
- cwd = resolved;
9046
- } else {
9047
- log.warn("Ignoring cwd %s \u2014 directory does not exist", options.cwd);
9048
- }
9197
+ cwd = resolveSafeCwd(join3(workspaceRoot, options.cwd), workspaceRoot, "cwd", options.cwd) ?? cwd;
9198
+ } else if (checkpoint?.cwd) {
9199
+ cwd = resolveSafeCwd(
9200
+ checkpoint.cwd,
9201
+ workspaceRoot,
9202
+ "saved terminal history cwd",
9203
+ checkpoint.cwd
9204
+ ) ?? cwd;
9049
9205
  }
9050
9206
  if (!existsSync2(cwd)) {
9051
9207
  throw new Error(`Workspace directory does not exist: ${cwd}`);
@@ -9053,16 +9209,16 @@ var TerminalPool = class {
9053
9209
  if (!existsSync2(shell)) {
9054
9210
  throw new Error(`Shell not found: ${shell}`);
9055
9211
  }
9056
- log.debug(
9212
+ log2.debug(
9057
9213
  "Spawning shell %s in %s for terminal %s (PATH=%s)",
9058
9214
  shell,
9059
9215
  cwd,
9060
9216
  terminalId,
9061
9217
  resolvedPath.slice(0, 200)
9062
9218
  );
9063
- const nodePty = await import("node-pty");
9064
9219
  let ptyProcess;
9065
9220
  try {
9221
+ const nodePty = await preloadNodePty();
9066
9222
  ptyProcess = nodePty.spawn(shell, [], {
9067
9223
  name: "xterm-256color",
9068
9224
  cols: 80,
@@ -9072,8 +9228,8 @@ var TerminalPool = class {
9072
9228
  });
9073
9229
  } catch (err) {
9074
9230
  const msg = err instanceof Error ? err.message : String(err);
9075
- log.error("pty.spawn failed: %s (shell=%s, cwd=%s)", msg, shell, cwd);
9076
- throw err;
9231
+ log2.error("pty.spawn failed: %s (shell=%s, cwd=%s)", msg, shell, cwd);
9232
+ throw new Error(hintForPtySpawnError(err));
9077
9233
  }
9078
9234
  let headless;
9079
9235
  let serializeAddon;
@@ -9099,7 +9255,7 @@ var TerminalPool = class {
9099
9255
  } catch (err) {
9100
9256
  ptyProcess.kill();
9101
9257
  const msg = err instanceof Error ? err.message : String(err);
9102
- log.error("headless mirror setup failed for terminal %s: %s", terminalId, msg);
9258
+ log2.error("headless mirror setup failed for terminal %s: %s", terminalId, msg);
9103
9259
  throw err;
9104
9260
  }
9105
9261
  const session = {
@@ -9110,11 +9266,25 @@ var TerminalPool = class {
9110
9266
  workspaceId,
9111
9267
  seq: 0,
9112
9268
  holds: 0,
9113
- cleanupOnExit: extras?.cleanupOnExit ?? false
9269
+ cleanupOnExit: extras?.cleanupOnExit ?? false,
9270
+ history: this.historyStore ? {
9271
+ cwd,
9272
+ startedAt: historyMeta?.startedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
9273
+ sessionCommand: options?.command ?? historyMeta?.sessionCommand,
9274
+ lastCheckpointAt: 0
9275
+ } : void 0
9114
9276
  };
9115
9277
  this.terminals.set(terminalId, session);
9116
- if (options?.command) {
9117
- this.autoRunCommand(session, options.command);
9278
+ if (checkpoint) {
9279
+ const restored = `${checkpoint.scrollback}\r
9280
+ \x1B[90m--- session restored ---\x1B[0m\r
9281
+ `;
9282
+ session.scrollback.append(restored);
9283
+ session.headless.write(restored);
9284
+ }
9285
+ const commandToRun = options?.command ?? this.claudeResumeCommand(checkpoint, historyMeta, cwd);
9286
+ if (commandToRun) {
9287
+ this.autoRunCommand(session, commandToRun);
9118
9288
  }
9119
9289
  let ids = this.workspaceTerminals.get(workspaceId);
9120
9290
  if (!ids) {
@@ -9136,9 +9306,10 @@ var TerminalPool = class {
9136
9306
  }
9137
9307
  }
9138
9308
  }
9309
+ this.maybeCheckpointHistory(terminalId, session);
9139
9310
  });
9140
9311
  ptyProcess.onExit(({ exitCode: exitCode2 }) => {
9141
- log.debug("Terminal exited: %s (workspace %s)", terminalId, workspaceId);
9312
+ log2.debug("Terminal exited: %s (workspace %s)", terminalId, workspaceId);
9142
9313
  const explicitlyKilled = !this.terminals.has(terminalId);
9143
9314
  this.terminals.delete(terminalId);
9144
9315
  this.outputListeners.delete(terminalId);
@@ -9155,6 +9326,13 @@ var TerminalPool = class {
9155
9326
  } catch {
9156
9327
  }
9157
9328
  }
9329
+ if (this.historyStore) {
9330
+ if (this.pruneHistoryOnExit.delete(terminalId)) {
9331
+ this.historyStore.removeSession(terminalId);
9332
+ } else if (session.history) {
9333
+ this.checkpointHistoryNow(terminalId, session);
9334
+ }
9335
+ }
9158
9336
  session.headless.dispose();
9159
9337
  const event = {
9160
9338
  terminalId,
@@ -9167,12 +9345,86 @@ var TerminalPool = class {
9167
9345
  try {
9168
9346
  listener(event);
9169
9347
  } catch (err) {
9170
- log.warn("exit listener threw for terminal %s: %s", terminalId, err);
9348
+ log2.warn("exit listener threw for terminal %s: %s", terminalId, err);
9171
9349
  }
9172
9350
  }
9173
9351
  });
9174
9352
  return session;
9175
9353
  }
9354
+ /**
9355
+ * A resumable Claude Code command for a cold-restored terminal, or
9356
+ * `undefined` if this isn't one: the checkpoint's saved command must look
9357
+ * like a plain `claude` invocation (see `claude-resume.ts`) and there must
9358
+ * be a Claude Code session transcript for `cwd`. Scoped to Claude Code
9359
+ * only — its on-disk session layout is documented and stable; other
9360
+ * agents' formats weren't verified for this feature.
9361
+ *
9362
+ * Takes the already boundary-checked `cwd` the new shell is actually
9363
+ * spawning in, not the checkpoint's raw saved cwd: if that saved cwd fell
9364
+ * outside the workspace root and `cwd` fell back to `workspaceRoot`, the
9365
+ * resume lookup must follow, not probe a directory the spawn itself
9366
+ * decided not to trust.
9367
+ */
9368
+ claudeResumeCommand(checkpoint, meta, cwd) {
9369
+ const command = meta?.sessionCommand;
9370
+ if (!checkpoint || !command || !isResumableClaudeCommand(command)) return void 0;
9371
+ const sessionId = findLatestClaudeSessionId(cwd);
9372
+ return sessionId ? buildClaudeResumeCommand(command, sessionId) : void 0;
9373
+ }
9374
+ /**
9375
+ * Checkpoint at most every `HISTORY_CHECKPOINT_INTERVAL_MS`, driven by
9376
+ * output arriving. Deferred off the PTY-output hot path via `setImmediate`:
9377
+ * `serialize()` is synchronous CPU work proportional to the scrollback
9378
+ * size, and running it inline in `onData` would delay delivering this (and
9379
+ * every other terminal's already-pending) output on the daemon's single
9380
+ * event loop — the class of regression issue #676 fixed for a different
9381
+ * code path.
9382
+ */
9383
+ maybeCheckpointHistory(terminalId, session) {
9384
+ if (!this.historyStore || !session.history) return;
9385
+ const now = Date.now();
9386
+ if (now - session.history.lastCheckpointAt < HISTORY_CHECKPOINT_INTERVAL_MS) return;
9387
+ session.history.lastCheckpointAt = now;
9388
+ setImmediate(() => {
9389
+ if (this.terminals.get(terminalId) === session) {
9390
+ this.checkpointHistoryNow(terminalId, session);
9391
+ }
9392
+ });
9393
+ }
9394
+ /**
9395
+ * Serializes the current screen synchronously — the only part of a
9396
+ * checkpoint that must be, since it must run before `headless.dispose()` on
9397
+ * exit — then hands the actual write off to `TerminalHistoryManager`'s async,
9398
+ * non-blocking I/O. The write is tracked in {@link pendingHistoryWrites} so
9399
+ * a daemon shutdown can wait for it rather than exiting mid-write and
9400
+ * losing a session's last checkpoint; `TerminalHistoryManager` logs its own
9401
+ * failures and never rejects, so there is nothing for this method's caller
9402
+ * to await or catch.
9403
+ */
9404
+ checkpointHistoryNow(terminalId, session) {
9405
+ if (!this.historyStore || !session.history) return;
9406
+ const { cols, rows } = session.headless;
9407
+ const { cwd, startedAt, sessionCommand } = session.history;
9408
+ const pending = Promise.all([
9409
+ this.historyStore.writeCheckpoint(terminalId, {
9410
+ scrollback: session.serializeAddon.serialize(),
9411
+ cwd,
9412
+ cols,
9413
+ rows
9414
+ }),
9415
+ this.historyStore.writeMeta(terminalId, {
9416
+ workspaceId: session.workspaceId,
9417
+ cwd,
9418
+ cols,
9419
+ rows,
9420
+ startedAt,
9421
+ checkpointedAt: (/* @__PURE__ */ new Date()).toISOString(),
9422
+ sessionCommand
9423
+ })
9424
+ ]);
9425
+ this.pendingHistoryWrites.add(pending);
9426
+ void pending.finally(() => this.pendingHistoryWrites.delete(pending));
9427
+ }
9176
9428
  /**
9177
9429
  * Auto-run the workspace's initial command inside a freshly spawned PTY,
9178
9430
  * robustly.
@@ -9204,12 +9456,12 @@ var TerminalPool = class {
9204
9456
  const pty = session.pty;
9205
9457
  let cmdFile;
9206
9458
  try {
9207
- cmdFile = join(tmpdir(), `band-autorun-${randomUUID()}.sh`);
9459
+ cmdFile = join3(tmpdir(), `band-autorun-${randomUUID()}.sh`);
9208
9460
  writeFileSync(cmdFile, `${command}
9209
9461
  `, { encoding: "utf-8", mode: 384, flag: "wx" });
9210
9462
  session.autoRunFile = cmdFile;
9211
9463
  } catch (err) {
9212
- log.warn(
9464
+ log2.warn(
9213
9465
  "autoRunCommand: temp-file staging failed (%s); writing command directly",
9214
9466
  err instanceof Error ? err.message : String(err)
9215
9467
  );
@@ -9227,7 +9479,7 @@ var TerminalPool = class {
9227
9479
  try {
9228
9480
  pty.write(sourceLine);
9229
9481
  } catch (err) {
9230
- log.warn("autoRunCommand: failed to inject command line (%s)", err);
9482
+ log2.warn("autoRunCommand: failed to inject command line (%s)", err);
9231
9483
  }
9232
9484
  };
9233
9485
  let dataDisposed = false;
@@ -9480,7 +9732,7 @@ var TerminalPool = class {
9480
9732
  try {
9481
9733
  snapshot = await this.serialize(terminalId);
9482
9734
  } catch (err) {
9483
- log.error("Failed to serialize terminal %s for replay: %s", terminalId, err);
9735
+ log2.error("Failed to serialize terminal %s for replay: %s", terminalId, err);
9484
9736
  snapshot = { data: "", seq: 0 };
9485
9737
  }
9486
9738
  if (!snapshot) {
@@ -9523,6 +9775,7 @@ var TerminalPool = class {
9523
9775
  kill(terminalId) {
9524
9776
  const session = this.terminals.get(terminalId);
9525
9777
  if (session) {
9778
+ this.pruneHistoryOnExit.add(terminalId);
9526
9779
  session.pty.kill();
9527
9780
  this.terminals.delete(terminalId);
9528
9781
  const set = this.workspaceTerminals.get(session.workspaceId);
@@ -9532,6 +9785,8 @@ var TerminalPool = class {
9532
9785
  this.workspaceTerminals.delete(session.workspaceId);
9533
9786
  }
9534
9787
  }
9788
+ } else {
9789
+ this.historyStore?.removeSession(terminalId);
9535
9790
  }
9536
9791
  }
9537
9792
  /**
@@ -9539,15 +9794,18 @@ var TerminalPool = class {
9539
9794
  */
9540
9795
  killWorkspace(workspaceId) {
9541
9796
  const ids = this.workspaceTerminals.get(workspaceId);
9542
- if (!ids) return;
9543
- for (const terminalId of ids) {
9544
- const session = this.terminals.get(terminalId);
9545
- if (session) {
9546
- session.pty.kill();
9547
- this.terminals.delete(terminalId);
9797
+ if (ids) {
9798
+ for (const terminalId of ids) {
9799
+ const session = this.terminals.get(terminalId);
9800
+ if (session) {
9801
+ this.pruneHistoryOnExit.add(terminalId);
9802
+ session.pty.kill();
9803
+ this.terminals.delete(terminalId);
9804
+ }
9548
9805
  }
9806
+ this.workspaceTerminals.delete(workspaceId);
9549
9807
  }
9550
- this.workspaceTerminals.delete(workspaceId);
9808
+ this.historyStore?.removeSessionsForWorkspace(workspaceId);
9551
9809
  }
9552
9810
  /**
9553
9811
  * Kill every tracked PTY (server shutdown path).
@@ -9560,7 +9818,27 @@ var TerminalPool = class {
9560
9818
  this.workspaceTerminals.clear();
9561
9819
  this.outputListeners.clear();
9562
9820
  }
9821
+ /**
9822
+ * True while a history checkpoint write is still in flight. The daemon's
9823
+ * shutdown polls this alongside its shells' liveness so it never exits
9824
+ * mid-write and loses the last checkpoint a dying session's `onExit`
9825
+ * kicked off (see {@link checkpointHistoryNow}).
9826
+ */
9827
+ hasPendingHistoryWrites() {
9828
+ return this.pendingHistoryWrites.size > 0;
9829
+ }
9563
9830
  };
9831
+ function resolveSafeCwd(candidate, workspaceRoot, label, original) {
9832
+ if (candidate !== workspaceRoot && !candidate.startsWith(workspaceRoot + sep)) {
9833
+ log2.warn("Ignoring %s %s \u2014 resolves outside workspace root %s", label, original, workspaceRoot);
9834
+ return null;
9835
+ }
9836
+ if (!existsSync2(candidate)) {
9837
+ log2.warn("Ignoring %s %s \u2014 directory does not exist", label, original);
9838
+ return null;
9839
+ }
9840
+ return candidate;
9841
+ }
9564
9842
 
9565
9843
  // src/server/infra/terminals/daemon/endpoint.ts
9566
9844
  import { randomBytes } from "node:crypto";
@@ -9570,11 +9848,11 @@ import {
9570
9848
  lstatSync,
9571
9849
  mkdirSync,
9572
9850
  renameSync,
9573
- statSync,
9851
+ statSync as statSync2,
9574
9852
  unlinkSync as unlinkSync2
9575
9853
  } from "node:fs";
9576
9854
  import { connect } from "node:net";
9577
- import { dirname, join as join2 } from "node:path";
9855
+ import { dirname, join as join4 } from "node:path";
9578
9856
  var PROBE_TIMEOUT_MS = 500;
9579
9857
  var PUBLISH_ATTEMPTS = 3;
9580
9858
  function isProvenDead(outcome) {
@@ -9609,10 +9887,10 @@ function probeEndpoint(socketPath) {
9609
9887
  });
9610
9888
  }
9611
9889
  function privateBindPath(socketPath) {
9612
- return join2(dirname(socketPath), `.p${randomBytes(5).toString("hex")}`);
9890
+ return join4(dirname(socketPath), `.p${randomBytes(5).toString("hex")}`);
9613
9891
  }
9614
9892
  async function publishEndpoint(boundPath, canonicalPath, supersede2) {
9615
- const identity = entryIdentity(boundPath, statSync);
9893
+ const identity = entryIdentity(boundPath, statSync2);
9616
9894
  if (!identity) throw new Error(`Cannot stat the bound daemon socket at ${boundPath}`);
9617
9895
  for (let attempt = 0; attempt < PUBLISH_ATTEMPTS; attempt++) {
9618
9896
  try {
@@ -9669,7 +9947,7 @@ function sameEntry(a, b) {
9669
9947
  function confirmPublished(canonicalPath, identity, superseded) {
9670
9948
  let published;
9671
9949
  try {
9672
- const stats = statSync(canonicalPath, { bigint: true });
9950
+ const stats = statSync2(canonicalPath, { bigint: true });
9673
9951
  published = { dev: stats.dev, ino: stats.ino };
9674
9952
  } catch (err) {
9675
9953
  return errorCode(err) === "ENOENT" ? { status: "lost" } : { status: "inconclusive" };
@@ -9678,7 +9956,7 @@ function confirmPublished(canonicalPath, identity, superseded) {
9678
9956
  }
9679
9957
  function endpointOwnership(canonicalPath, owned) {
9680
9958
  try {
9681
- const stats = statSync(canonicalPath, { bigint: true });
9959
+ const stats = statSync2(canonicalPath, { bigint: true });
9682
9960
  return stats.dev === owned.dev && stats.ino === owned.ino ? "owned" : "lost";
9683
9961
  } catch (err) {
9684
9962
  return errorCode(err) === "ENOENT" ? "lost" : "indeterminate";
@@ -9706,36 +9984,37 @@ function errorCode(err) {
9706
9984
 
9707
9985
  // src/server/infra/terminals/daemon/protocol.ts
9708
9986
  import { createHash } from "node:crypto";
9709
- import { basename, dirname as dirname2, join as join3 } from "node:path";
9987
+ import { basename, dirname as dirname2, join as join5 } from "node:path";
9710
9988
  var PROTOCOL_VERSION = 1;
9711
9989
  var EXIT_ENDPOINT_OCCUPIED = 20;
9712
9990
  var EXIT_ENDPOINT_UNAVAILABLE = 21;
9991
+ var EXIT_NODE_PTY_UNAVAILABLE = 22;
9713
9992
  var ENDPOINT_LOST_ERROR = "Terminal daemon no longer owns its endpoint";
9714
9993
  var MAX_SOCKET_PATH_BYTES = 103;
9715
9994
  function daemonPaths(runDir2, version = PROTOCOL_VERSION) {
9716
- const inRunDir = join3(runDir2, `terminal-daemon-v${version}.sock`);
9717
- const socket = Buffer.byteLength(inRunDir) <= MAX_SOCKET_PATH_BYTES ? inRunDir : join3(
9995
+ const inRunDir = join5(runDir2, `terminal-daemon-v${version}.sock`);
9996
+ const socket = Buffer.byteLength(inRunDir) <= MAX_SOCKET_PATH_BYTES ? inRunDir : join5(
9718
9997
  shortSocketDir(),
9719
9998
  `td-${createHash("sha256").update(runDir2).digest("hex").slice(0, 16)}-v${version}.sock`
9720
9999
  );
9721
10000
  return {
9722
10001
  runDir: runDir2,
9723
10002
  socket,
9724
- token: join3(runDir2, `terminal-daemon-v${version}.token`),
9725
- pid: join3(runDir2, `terminal-daemon-v${version}.pid`),
9726
- log: join3(runDir2, "terminal-daemon.log")
10003
+ token: join5(runDir2, `terminal-daemon-v${version}.token`),
10004
+ pid: join5(runDir2, `terminal-daemon-v${version}.pid`),
10005
+ log: join5(runDir2, "terminal-daemon.log")
9727
10006
  };
9728
10007
  }
9729
10008
  function retiredDaemonPaths(paths, tag) {
9730
10009
  return {
9731
10010
  ...paths,
9732
- socket: join3(dirname2(paths.socket), `.r${tag}`),
10011
+ socket: join5(dirname2(paths.socket), `.r${tag}`),
9733
10012
  token: paths.token.replace(/\.token$/, `.retired-${tag}.token`),
9734
10013
  pid: paths.pid.replace(/\.pid$/, `.retired-${tag}.pid`)
9735
10014
  };
9736
10015
  }
9737
10016
  function shortSocketDir() {
9738
- return join3("/tmp", `band-${process.getuid?.() ?? "user"}`);
10017
+ return join5("/tmp", `band-${process.getuid?.() ?? "user"}`);
9739
10018
  }
9740
10019
  function writeFrame(socket, message) {
9741
10020
  socket.write(`${JSON.stringify(message)}
@@ -9782,7 +10061,7 @@ function readFrames(socket, onFrame, maxLineBytes = 64 * 1024 * 1024) {
9782
10061
  }
9783
10062
 
9784
10063
  // src/server/infra/terminals/daemon/daemon-server.ts
9785
- var log2 = createLogger("terminal-daemon");
10064
+ var log3 = createLogger("terminal-daemon");
9786
10065
  var HELLO_TIMEOUT_MS = 5e3;
9787
10066
  var WATCHDOG_INTERVAL_MS = 2e3;
9788
10067
  var SHUTDOWN_GRACE_MS = 2e3;
@@ -9792,10 +10071,16 @@ var STREAM_HOLD_BYTES = 128 * 1024;
9792
10071
  var SMALL_SESSION_CHARS = 4 * 1024;
9793
10072
  async function runDaemon(options) {
9794
10073
  const { paths, buildId, supersede: supersede2 } = options;
10074
+ try {
10075
+ await preloadNodePty();
10076
+ } catch (err) {
10077
+ log3.error({ err }, "terminal daemon could not load its native module (node-pty); exiting");
10078
+ return EXIT_NODE_PTY_UNAVAILABLE;
10079
+ }
9795
10080
  ensurePrivateDir(paths.runDir);
9796
10081
  ensurePrivateDir(dirname3(paths.socket));
9797
10082
  const token = randomBytes2(32).toString("hex");
9798
- const pool = new TerminalPool();
10083
+ const pool = new TerminalPool({ historyDir: join6(dirname3(paths.runDir), "terminal-history") });
9799
10084
  const clients = /* @__PURE__ */ new Map();
9800
10085
  let shuttingDown = false;
9801
10086
  let openConnections = 0;
@@ -9827,13 +10112,13 @@ async function runDaemon(options) {
9827
10112
  retired = null;
9828
10113
  }
9829
10114
  if (outcome.status !== "published") {
9830
- log2.warn({ outcome: outcome.status }, "terminal daemon could not publish its endpoint");
10115
+ log3.warn({ outcome: outcome.status }, "terminal daemon could not publish its endpoint");
9831
10116
  await closeServer(server);
9832
10117
  return outcome.status === "occupied" ? EXIT_ENDPOINT_OCCUPIED : EXIT_ENDPOINT_UNAVAILABLE;
9833
10118
  }
9834
10119
  const identity = outcome.identity;
9835
10120
  if (retired) {
9836
- log2.info({ retired: retired.socket }, "terminal daemon superseded a daemon of another build");
10121
+ log3.info({ retired: retired.socket }, "terminal daemon superseded a daemon of another build");
9837
10122
  }
9838
10123
  let probingRetired = false;
9839
10124
  writePrivateFile(paths.token, token);
@@ -9846,11 +10131,12 @@ async function runDaemon(options) {
9846
10131
  entry: options.entry
9847
10132
  };
9848
10133
  writePrivateFile(paths.pid, JSON.stringify(pidRecord));
9849
- log2.info({ pid: process.pid, socket: paths.socket, buildId }, "terminal daemon ready");
10134
+ log3.info({ pid: process.pid, socket: paths.socket, buildId }, "terminal daemon ready");
9850
10135
  pool.onExit((event) => {
9851
10136
  for (const client of clients.values()) {
9852
10137
  client.attached.delete(event.terminalId);
9853
10138
  client.held.delete(event.terminalId);
10139
+ client.flowHeld.delete(event.terminalId);
9854
10140
  send(client, "stream", { t: "exit", ...event });
9855
10141
  }
9856
10142
  reevaluateIdle();
@@ -9862,7 +10148,7 @@ async function runDaemon(options) {
9862
10148
  }
9863
10149
  if (!endpointLost && endpointOwnership(paths.socket, identity) === "lost") {
9864
10150
  endpointLost = true;
9865
- log2.warn({ sessions: pool.size }, "terminal daemon lost its endpoint; draining");
10151
+ log3.warn({ sessions: pool.size }, "terminal daemon lost its endpoint; draining");
9866
10152
  reevaluateIdle();
9867
10153
  }
9868
10154
  if (retired && !probingRetired) {
@@ -9873,7 +10159,7 @@ async function runDaemon(options) {
9873
10159
  if (!isProvenDead(probe) || retired !== target) return;
9874
10160
  removeRetiredFiles(target);
9875
10161
  retired = null;
9876
- log2.info({ retired: target.socket }, "superseded terminal daemon exited");
10162
+ log3.info({ retired: target.socket }, "superseded terminal daemon exited");
9877
10163
  reevaluateIdle();
9878
10164
  });
9879
10165
  }
@@ -9906,9 +10192,9 @@ async function runDaemon(options) {
9906
10192
  if (shuttingDown) return;
9907
10193
  shuttingDown = true;
9908
10194
  if (retired) {
9909
- log2.warn({ retired: retired.socket }, "exiting while a superseded daemon is still running");
10195
+ log3.warn({ retired: retired.socket }, "exiting while a superseded daemon is still running");
9910
10196
  }
9911
- log2.info({ reason, sessions: pool.size }, "terminal daemon shutting down");
10197
+ log3.info({ reason, sessions: pool.size }, "terminal daemon shutting down");
9912
10198
  clearInterval(watchdog);
9913
10199
  if (adoptionTimer) clearTimeout(adoptionTimer);
9914
10200
  const shells = pool.listAll().map((entry) => entry.pid);
@@ -9919,7 +10205,7 @@ async function runDaemon(options) {
9919
10205
  }
9920
10206
  const deadline = Date.now() + SHUTDOWN_GRACE_MS;
9921
10207
  const waitForShells = setInterval(() => {
9922
- if (Date.now() < deadline && shells.some(isAlive)) return;
10208
+ if (Date.now() < deadline && (shells.some(isAlive) || pool.hasPendingHistoryWrites())) return;
9923
10209
  clearInterval(waitForShells);
9924
10210
  process.exit(0);
9925
10211
  }, 50);
@@ -9957,7 +10243,7 @@ async function runDaemon(options) {
9957
10243
  return;
9958
10244
  }
9959
10245
  if (hello.buildId !== buildId) {
9960
- log2.info({ daemon: buildId, server: hello.buildId }, "server build differs from daemon");
10246
+ log3.info({ daemon: buildId, server: hello.buildId }, "server build differs from daemon");
9961
10247
  }
9962
10248
  role = hello.role;
9963
10249
  client = registerClient(hello.clientId, role, socket);
@@ -9989,7 +10275,8 @@ async function runDaemon(options) {
9989
10275
  stream: null,
9990
10276
  attached: /* @__PURE__ */ new Map(),
9991
10277
  held: /* @__PURE__ */ new Set(),
9992
- sentSinceEmpty: /* @__PURE__ */ new Map()
10278
+ sentSinceEmpty: /* @__PURE__ */ new Map(),
10279
+ flowHeld: /* @__PURE__ */ new Set()
9993
10280
  };
9994
10281
  clients.set(clientId, client);
9995
10282
  }
@@ -10008,6 +10295,8 @@ async function runDaemon(options) {
10008
10295
  for (const unsubscribe of client.attached.values()) unsubscribe();
10009
10296
  client.attached.clear();
10010
10297
  releaseHolds(client);
10298
+ for (const terminalId of client.flowHeld) pool.releaseOutput(terminalId);
10299
+ client.flowHeld.clear();
10011
10300
  client.control?.destroy();
10012
10301
  client.stream?.destroy();
10013
10302
  if (clients.size === 0) retirementRequested = true;
@@ -10017,7 +10306,7 @@ async function runDaemon(options) {
10017
10306
  const socket = client[role];
10018
10307
  if (!socket || socket.destroyed) return;
10019
10308
  if (socket.writableLength > MAX_STREAM_BACKLOG_BYTES) {
10020
- log2.warn({ clientId: client.id }, "server stopped reading; dropping its connection");
10309
+ log3.warn({ clientId: client.id }, "server stopped reading; dropping its connection");
10021
10310
  dropClient(client);
10022
10311
  return;
10023
10312
  }
@@ -10080,8 +10369,19 @@ async function runDaemon(options) {
10080
10369
  client.attached.delete(message.terminalId);
10081
10370
  unsubscribe?.();
10082
10371
  if (client.held.delete(message.terminalId)) pool.releaseOutput(message.terminalId);
10372
+ if (client.flowHeld.delete(message.terminalId)) pool.releaseOutput(message.terminalId);
10083
10373
  return;
10084
10374
  }
10375
+ case "hold":
10376
+ if (!client.attached.has(message.terminalId) || client.flowHeld.has(message.terminalId)) {
10377
+ return;
10378
+ }
10379
+ client.flowHeld.add(message.terminalId);
10380
+ pool.holdOutput(message.terminalId);
10381
+ return;
10382
+ case "release":
10383
+ if (client.flowHeld.delete(message.terminalId)) pool.releaseOutput(message.terminalId);
10384
+ return;
10085
10385
  case "shutdown":
10086
10386
  return;
10087
10387
  }
@@ -10185,7 +10485,7 @@ function writePrivateFile(path, content) {
10185
10485
  function copyPrivateFile(from, to) {
10186
10486
  let content;
10187
10487
  try {
10188
- content = readFileSync(from, "utf8");
10488
+ content = readFileSync2(from, "utf8");
10189
10489
  } catch {
10190
10490
  return;
10191
10491
  }
@@ -10220,12 +10520,12 @@ function closeServer(server) {
10220
10520
  }
10221
10521
 
10222
10522
  // terminal-daemon.ts
10223
- var log3 = createLogger("terminal-daemon");
10523
+ var log4 = createLogger("terminal-daemon");
10224
10524
  process.on("uncaughtException", (err) => {
10225
- log3.error({ err }, "uncaught exception in terminal daemon");
10525
+ log4.error({ err }, "uncaught exception in terminal daemon");
10226
10526
  });
10227
10527
  process.on("unhandledRejection", (err) => {
10228
- log3.error({ err }, "unhandled rejection in terminal daemon");
10528
+ log4.error({ err }, "unhandled rejection in terminal daemon");
10229
10529
  });
10230
10530
  var { values } = parseArgs({
10231
10531
  options: {
@@ -10236,12 +10536,12 @@ var { values } = parseArgs({
10236
10536
  });
10237
10537
  var runDir = values["run-dir"];
10238
10538
  if (!runDir) {
10239
- log3.error("terminal daemon needs --run-dir");
10539
+ log4.error("terminal daemon needs --run-dir");
10240
10540
  process.exit(2);
10241
10541
  }
10242
10542
  var supersede = values.supersede?.match(/^(\d+):(\d+)$/);
10243
10543
  if (values.supersede !== void 0 && !supersede) {
10244
- log3.error({ supersede: values.supersede }, "terminal daemon got a malformed --supersede");
10544
+ log4.error({ supersede: values.supersede }, "terminal daemon got a malformed --supersede");
10245
10545
  process.exit(2);
10246
10546
  }
10247
10547
  var exitCode = await runDaemon({