tmex-cli 0.4.5 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/runtime/server.js +340 -36
  2. package/package.json +1 -1
  3. package/resources/fe-dist/assets/DevicePage-CQuQ0yeD.js +36 -0
  4. package/resources/fe-dist/assets/DevicePage-CQuQ0yeD.js.map +1 -0
  5. package/resources/fe-dist/assets/{DevicesPage-dj7Pel6f.js → DevicesPage-_g8yXgKX.js} +2 -2
  6. package/resources/fe-dist/assets/{DevicesPage-dj7Pel6f.js.map → DevicesPage-_g8yXgKX.js.map} +1 -1
  7. package/resources/fe-dist/assets/{SettingsPage-DwpbDA_e.js → SettingsPage-Bi8Kez5a.js} +2 -2
  8. package/resources/fe-dist/assets/{SettingsPage-DwpbDA_e.js.map → SettingsPage-Bi8Kez5a.js.map} +1 -1
  9. package/resources/fe-dist/assets/{index-61hq_aNX.js → index-kXpemMRY.js} +8 -8
  10. package/resources/fe-dist/assets/index-kXpemMRY.js.map +1 -0
  11. package/resources/fe-dist/assets/index-otkzncJS.css +1 -0
  12. package/resources/fe-dist/assets/{select-DI4HQZd4.js → select-v4N0NzCz.js} +2 -2
  13. package/resources/fe-dist/assets/{select-DI4HQZd4.js.map → select-v4N0NzCz.js.map} +1 -1
  14. package/resources/fe-dist/assets/{switch-DsfDIUrU.js → switch-BJu9baQM.js} +2 -2
  15. package/resources/fe-dist/assets/{switch-DsfDIUrU.js.map → switch-BJu9baQM.js.map} +1 -1
  16. package/resources/fe-dist/assets/{useValueChanged-AVaPYvln.js → useValueChanged-D47LrxaP.js} +2 -2
  17. package/resources/fe-dist/assets/{useValueChanged-AVaPYvln.js.map → useValueChanged-D47LrxaP.js.map} +1 -1
  18. package/resources/fe-dist/index.html +2 -2
  19. package/resources/fe-dist/assets/DevicePage-Di11uzbS.js +0 -26
  20. package/resources/fe-dist/assets/DevicePage-Di11uzbS.js.map +0 -1
  21. package/resources/fe-dist/assets/index-40zyi_9K.css +0 -1
  22. package/resources/fe-dist/assets/index-61hq_aNX.js.map +0 -1
@@ -20442,7 +20442,13 @@ var I18N_RESOURCES = {
20442
20442
  inputModeEditor: "Editor",
20443
20443
  newWindow: "New Window",
20444
20444
  closeWindow: "Close Window",
20445
- closePane: "Close Pane"
20445
+ closePane: "Close Pane",
20446
+ copy: "Copy",
20447
+ paste: "Paste",
20448
+ copied: "Copied to clipboard",
20449
+ copyFailed: "Copy failed",
20450
+ pasteFailed: "Could not read clipboard, check browser permissions",
20451
+ clearSelection: "Dismiss selection"
20446
20452
  },
20447
20453
  settings: {
20448
20454
  title: "System Settings",
@@ -20801,7 +20807,13 @@ Time: {{time}}`,
20801
20807
  inputModeEditor: "\u7F16\u8F91\u5668",
20802
20808
  newWindow: "\u65B0\u5EFA\u7A97\u53E3",
20803
20809
  closeWindow: "\u5173\u95ED\u7A97\u53E3",
20804
- closePane: "\u5173\u95ED pane"
20810
+ closePane: "\u5173\u95ED pane",
20811
+ copy: "\u590D\u5236",
20812
+ paste: "\u7C98\u8D34",
20813
+ copied: "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
20814
+ copyFailed: "\u590D\u5236\u5931\u8D25",
20815
+ pasteFailed: "\u65E0\u6CD5\u8BFB\u53D6\u526A\u8D34\u677F\uFF0C\u8BF7\u68C0\u67E5\u6D4F\u89C8\u5668\u6743\u9650",
20816
+ clearSelection: "\u53D6\u6D88\u9009\u62E9"
20805
20817
  },
20806
20818
  settings: {
20807
20819
  title: "\u7CFB\u7EDF\u8BBE\u7F6E",
@@ -21160,7 +21172,13 @@ Bot\uFF1A{{botName}}
21160
21172
  inputModeEditor: "\u30A8\u30C7\u30A3\u30BF",
21161
21173
  newWindow: "\u65B0\u898F\u30A6\u30A3\u30F3\u30C9\u30A6",
21162
21174
  closeWindow: "\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u9589\u3058\u308B",
21163
- closePane: "\u30DA\u30A4\u30F3\u3092\u9589\u3058\u308B"
21175
+ closePane: "\u30DA\u30A4\u30F3\u3092\u9589\u3058\u308B",
21176
+ copy: "\u30B3\u30D4\u30FC",
21177
+ paste: "\u8CBC\u308A\u4ED8\u3051",
21178
+ copied: "\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u306B\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F",
21179
+ copyFailed: "\u30B3\u30D4\u30FC\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
21180
+ pasteFailed: "\u30AF\u30EA\u30C3\u30D7\u30DC\u30FC\u30C9\u3092\u8AAD\u307F\u53D6\u308C\u307E\u305B\u3093\u3002\u30D6\u30E9\u30A6\u30B6\u306E\u6A29\u9650\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044",
21181
+ clearSelection: "\u9078\u629E\u3092\u89E3\u9664"
21164
21182
  },
21165
21183
  settings: {
21166
21184
  title: "\u30B7\u30B9\u30C6\u30E0\u8A2D\u5B9A",
@@ -22098,12 +22116,14 @@ function resetChunkStreamId() {
22098
22116
  var notificationSourceToU8 = {
22099
22117
  osc9: 1,
22100
22118
  osc777: 2,
22101
- osc1337: 3
22119
+ osc1337: 3,
22120
+ osc99: 4
22102
22121
  };
22103
22122
  var notificationSourceFromU8 = {
22104
22123
  1: "osc9",
22105
22124
  2: "osc777",
22106
- 3: "osc1337"
22125
+ 3: "osc1337",
22126
+ 4: "osc99"
22107
22127
  };
22108
22128
  function encodeDeviceEventPayload(payload) {
22109
22129
  const eventTypeMap = {
@@ -22472,6 +22492,7 @@ var config = {
22472
22492
  bellThrottleSecondsDefault: Number.parseInt(getEnv("TMEX_BELL_THROTTLE_SECONDS", "6"), 10),
22473
22493
  notificationThrottleSecondsDefault: Number.parseInt(getEnv("TMEX_NOTIFICATION_THROTTLE_SECONDS", "3"), 10),
22474
22494
  tmuxAllowPassthrough: getBooleanEnv("TMEX_TMUX_ALLOW_PASSTHROUGH", false),
22495
+ tmuxTermProgram: getEnv("TMEX_TMUX_TERM_PROGRAM", "ghostty"),
22475
22496
  sshReconnectMaxRetriesDefault: Number.parseInt(getEnv("TMEX_SSH_RECONNECT_MAX_RETRIES", "2"), 10),
22476
22497
  sshReconnectDelaySecondsDefault: Number.parseInt(getEnv("TMEX_SSH_RECONNECT_DELAY_SECONDS", "10"), 10),
22477
22498
  languageDefault: getEnv("TMEX_DEFAULT_LANGUAGE", "en_US"),
@@ -52550,6 +52571,101 @@ function createRuntimeFsPaths(options) {
52550
52571
  };
52551
52572
  }
52552
52573
 
52574
+ // ../../apps/gateway/src/tmux-client/ghostty-terminfo.ts
52575
+ var XTERM_GHOSTTY_TERMINFO_SOURCE = `xterm-ghostty|ghostty|Ghostty,
52576
+ am, bce, ccc, hs, km, mc5i, mir, msgr, npc, xenl, AX, Su, Tc, XT, fullkbd,
52577
+ colors#0x100, cols#80, it#8, lines#24, pairs#0x7fff,
52578
+ acsc=++\\,\\,--..00\`\`aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
52579
+ bel=^G, blink=\\E[5m, bold=\\E[1m, cbt=\\E[Z, civis=\\E[?25l,
52580
+ clear=\\E[H\\E[2J, cnorm=\\E[?12l\\E[?25h, cr=\\r,
52581
+ csr=\\E[%i%p1%d;%p2%dr, cub=\\E[%p1%dD, cub1=^H,
52582
+ cud=\\E[%p1%dB, cud1=\\n, cuf=\\E[%p1%dC, cuf1=\\E[C,
52583
+ cup=\\E[%i%p1%d;%p2%dH, cuu=\\E[%p1%dA, cuu1=\\E[A,
52584
+ cvvis=\\E[?12;25h, dch=\\E[%p1%dP, dch1=\\E[P, dim=\\E[2m,
52585
+ dl=\\E[%p1%dM, dl1=\\E[M, dsl=\\E]2;\\007, ech=\\E[%p1%dX,
52586
+ ed=\\E[J, el=\\E[K, el1=\\E[1K, flash=\\E[?5h$<100/>\\E[?5l,
52587
+ fsl=^G, home=\\E[H, hpa=\\E[%i%p1%dG, ht=^I, hts=\\EH,
52588
+ ich=\\E[%p1%d@, ich1=\\E[@, il=\\E[%p1%dL, il1=\\E[L, ind=\\n,
52589
+ indn=\\E[%p1%dS,
52590
+ initc=\\E]4;%p1%d;rgb:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\\E\\\\,
52591
+ invis=\\E[8m, kDC=\\E[3;2~, kEND=\\E[1;2F, kHOM=\\E[1;2H,
52592
+ kIC=\\E[2;2~, kLFT=\\E[1;2D, kNXT=\\E[6;2~, kPRV=\\E[5;2~,
52593
+ kRIT=\\E[1;2C, kbs=^?, kcbt=\\E[Z, kcub1=\\EOD, kcud1=\\EOB,
52594
+ kcuf1=\\EOC, kcuu1=\\EOA, kdch1=\\E[3~, kend=\\EOF, kent=\\EOM,
52595
+ kf1=\\EOP, kf10=\\E[21~, kf11=\\E[23~, kf12=\\E[24~,
52596
+ kf13=\\E[1;2P, kf14=\\E[1;2Q, kf15=\\E[1;2R, kf16=\\E[1;2S,
52597
+ kf17=\\E[15;2~, kf18=\\E[17;2~, kf19=\\E[18;2~, kf2=\\EOQ,
52598
+ kf20=\\E[19;2~, kf21=\\E[20;2~, kf22=\\E[21;2~,
52599
+ kf23=\\E[23;2~, kf24=\\E[24;2~, kf25=\\E[1;5P, kf26=\\E[1;5Q,
52600
+ kf27=\\E[1;5R, kf28=\\E[1;5S, kf29=\\E[15;5~, kf3=\\EOR,
52601
+ kf30=\\E[17;5~, kf31=\\E[18;5~, kf32=\\E[19;5~,
52602
+ kf33=\\E[20;5~, kf34=\\E[21;5~, kf35=\\E[23;5~,
52603
+ kf36=\\E[24;5~, kf37=\\E[1;6P, kf38=\\E[1;6Q, kf39=\\E[1;6R,
52604
+ kf4=\\EOS, kf40=\\E[1;6S, kf41=\\E[15;6~, kf42=\\E[17;6~,
52605
+ kf43=\\E[18;6~, kf44=\\E[19;6~, kf45=\\E[20;6~,
52606
+ kf46=\\E[21;6~, kf47=\\E[23;6~, kf48=\\E[24;6~,
52607
+ kf49=\\E[1;3P, kf5=\\E[15~, kf50=\\E[1;3Q, kf51=\\E[1;3R,
52608
+ kf52=\\E[1;3S, kf53=\\E[15;3~, kf54=\\E[17;3~,
52609
+ kf55=\\E[18;3~, kf56=\\E[19;3~, kf57=\\E[20;3~,
52610
+ kf58=\\E[21;3~, kf59=\\E[23;3~, kf6=\\E[17~, kf60=\\E[24;3~,
52611
+ kf61=\\E[1;4P, kf62=\\E[1;4Q, kf63=\\E[1;4R, kf7=\\E[18~,
52612
+ kf8=\\E[19~, kf9=\\E[20~, khome=\\EOH, kich1=\\E[2~,
52613
+ kind=\\E[1;2B, kmous=\\E[<, knp=\\E[6~, kpp=\\E[5~,
52614
+ kri=\\E[1;2A, oc=\\E]104\\007, op=\\E[39;49m, rc=\\E8,
52615
+ rep=%p1%c\\E[%p2%{1}%-%db, rev=\\E[7m, ri=\\EM,
52616
+ rin=\\E[%p1%dT, ritm=\\E[23m, rmacs=\\E(B, rmam=\\E[?7l,
52617
+ rmcup=\\E[?1049l, rmir=\\E[4l, rmkx=\\E[?1l\\E>, rmso=\\E[27m,
52618
+ rmul=\\E[24m, rs1=\\E]\\E\\\\\\Ec, sc=\\E7,
52619
+ setab=\\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m,
52620
+ setaf=\\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m,
52621
+ sgr=%?%p9%t\\E(0%e\\E(B%;\\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
52622
+ sgr0=\\E(B\\E[m, sitm=\\E[3m, smacs=\\E(0, smam=\\E[?7h,
52623
+ smcup=\\E[?1049h, smir=\\E[4h, smkx=\\E[?1h\\E=, smso=\\E[7m,
52624
+ smul=\\E[4m, tbc=\\E[3g, tsl=\\E]2;, u6=\\E[%i%d;%dR, u7=\\E[6n,
52625
+ u8=\\E[?%[;0123456789]c, u9=\\E[c, vpa=\\E[%i%p1%dd,
52626
+ BD=\\E[?2004l, BE=\\E[?2004h, Clmg=\\E[s,
52627
+ Cmg=\\E[%i%p1%d;%p2%ds, Dsmg=\\E[?69l, E3=\\E[3J,
52628
+ Enmg=\\E[?69h, Ms=\\E]52;%p1%s;%p2%s\\007, PE=\\E[201~,
52629
+ PS=\\E[200~, RV=\\E[>c, Se=\\E[2 q,
52630
+ Setulc=\\E[58:2::%p1%{65536}%/%d:%p1%{256}%/%{255}%&%d:%p1%{255}%&%d%;m,
52631
+ Smulx=\\E[4:%p1%dm, Ss=\\E[%p1%d q,
52632
+ Sync=\\E[?2026%?%p1%{1}%-%tl%eh%;,
52633
+ XM=\\E[?1006;1000%?%p1%{1}%=%th%el%;, XR=\\E[>0q,
52634
+ fd=\\E[?1004l, fe=\\E[?1004h, kDC3=\\E[3;3~, kDC4=\\E[3;4~,
52635
+ kDC5=\\E[3;5~, kDC6=\\E[3;6~, kDC7=\\E[3;7~, kDN=\\E[1;2B,
52636
+ kDN3=\\E[1;3B, kDN4=\\E[1;4B, kDN5=\\E[1;5B, kDN6=\\E[1;6B,
52637
+ kDN7=\\E[1;7B, kEND3=\\E[1;3F, kEND4=\\E[1;4F,
52638
+ kEND5=\\E[1;5F, kEND6=\\E[1;6F, kEND7=\\E[1;7F,
52639
+ kHOM3=\\E[1;3H, kHOM4=\\E[1;4H, kHOM5=\\E[1;5H,
52640
+ kHOM6=\\E[1;6H, kHOM7=\\E[1;7H, kIC3=\\E[2;3~, kIC4=\\E[2;4~,
52641
+ kIC5=\\E[2;5~, kIC6=\\E[2;6~, kIC7=\\E[2;7~, kLFT3=\\E[1;3D,
52642
+ kLFT4=\\E[1;4D, kLFT5=\\E[1;5D, kLFT6=\\E[1;6D,
52643
+ kLFT7=\\E[1;7D, kNXT3=\\E[6;3~, kNXT4=\\E[6;4~,
52644
+ kNXT5=\\E[6;5~, kNXT6=\\E[6;6~, kNXT7=\\E[6;7~,
52645
+ kPRV3=\\E[5;3~, kPRV4=\\E[5;4~, kPRV5=\\E[5;5~,
52646
+ kPRV6=\\E[5;6~, kPRV7=\\E[5;7~, kRIT3=\\E[1;3C,
52647
+ kRIT4=\\E[1;4C, kRIT5=\\E[1;5C, kRIT6=\\E[1;6C,
52648
+ kRIT7=\\E[1;7C, kUP=\\E[1;2A, kUP3=\\E[1;3A, kUP4=\\E[1;4A,
52649
+ kUP5=\\E[1;5A, kUP6=\\E[1;6A, kUP7=\\E[1;7A, kxIN=\\E[I,
52650
+ kxOUT=\\E[O, rmxx=\\E[29m, rv=\\E\\\\[[0-9]+;[0-9]+;[0-9]+c,
52651
+ setrgbb=\\E[48:2:%p1%d:%p2%d:%p3%dm,
52652
+ setrgbf=\\E[38:2:%p1%d:%p2%d:%p3%dm, smxx=\\E[9m,
52653
+ xm=\\E[<%i%p3%d;%p1%d;%p2%d;%?%p4%tM%em%;,
52654
+ xr=\\EP>\\\\|[ -~]+a\\E\\\\,
52655
+ `;
52656
+ var HEREDOC_MARKER = "TMEX_TERMINFO_EOF";
52657
+ function buildEnsureGhosttyTerminfoScript() {
52658
+ return [
52659
+ "if ! infocmp xterm-ghostty >/dev/null 2>&1; then",
52660
+ `tic -x - <<'${HEREDOC_MARKER}' >/dev/null 2>&1`,
52661
+ XTERM_GHOSTTY_TERMINFO_SOURCE.trimEnd(),
52662
+ HEREDOC_MARKER,
52663
+ "fi",
52664
+ "infocmp xterm-ghostty >/dev/null 2>&1"
52665
+ ].join(`
52666
+ `);
52667
+ }
52668
+
52553
52669
  // ../../apps/gateway/src/tmux-client/input-encoder.ts
52554
52670
  var encoder = new TextEncoder;
52555
52671
  var SEND_KEYS_HEX_CHUNK_BYTES = 256;
@@ -52567,12 +52683,19 @@ function encodeInputToHexChunks(input, chunkBytes = SEND_KEYS_HEX_CHUNK_BYTES) {
52567
52683
  var decoder = new TextDecoder;
52568
52684
  var MAX_OSC_KIND_BYTES = 16;
52569
52685
  var MAX_OSC_PAYLOAD_BYTES = 8 * 1024;
52686
+ var MAX_DCS_PASSTHROUGH_BYTES = 64 * 1024;
52687
+ var MAX_KITTY_PENDING_IDS = 16;
52688
+ var TMUX_PASSTHROUGH_PREFIX = "tmux;";
52570
52689
  function createPaneStreamParser(options) {
52571
52690
  let phase = "normal";
52572
52691
  let oscKind = "";
52573
52692
  let oscPayloadBytes = [];
52574
52693
  let titleBytes = [];
52575
52694
  let warnedOscPayloadOverflow = false;
52695
+ let warnedDcsOverflow = false;
52696
+ let dcsPrefix = "";
52697
+ let dcsBytes = [];
52698
+ const kittyPending = new Map;
52576
52699
  function resetOscState() {
52577
52700
  oscKind = "";
52578
52701
  oscPayloadBytes = [];
@@ -52611,6 +52734,46 @@ function createPaneStreamParser(options) {
52611
52734
  }
52612
52735
  options.onNotification({ source: "osc9", body: payload });
52613
52736
  return;
52737
+ case "99": {
52738
+ const metadataSeparatorIndex = payload.indexOf(";");
52739
+ const metadata = metadataSeparatorIndex >= 0 ? payload.slice(0, metadataSeparatorIndex) : payload;
52740
+ const content = metadataSeparatorIndex >= 0 ? payload.slice(metadataSeparatorIndex + 1) : "";
52741
+ const fields = new Map;
52742
+ for (const part2 of metadata.split(":")) {
52743
+ const equalsIndex = part2.indexOf("=");
52744
+ if (equalsIndex > 0) {
52745
+ fields.set(part2.slice(0, equalsIndex), part2.slice(equalsIndex + 1));
52746
+ }
52747
+ }
52748
+ const id = fields.get("i") ?? "0";
52749
+ const done = fields.get("d") !== "0";
52750
+ const part = fields.get("p") ?? "body";
52751
+ const pending = kittyPending.get(id) ?? { title: "", body: "" };
52752
+ if (part === "title") {
52753
+ pending.title += content;
52754
+ } else if (part === "body") {
52755
+ pending.body += content;
52756
+ }
52757
+ if (!done) {
52758
+ if (!kittyPending.has(id) && kittyPending.size >= MAX_KITTY_PENDING_IDS) {
52759
+ const oldestId = kittyPending.keys().next().value;
52760
+ if (oldestId !== undefined) {
52761
+ kittyPending.delete(oldestId);
52762
+ }
52763
+ }
52764
+ kittyPending.set(id, pending);
52765
+ return;
52766
+ }
52767
+ kittyPending.delete(id);
52768
+ if (pending.title || pending.body) {
52769
+ options.onNotification({
52770
+ source: "osc99",
52771
+ title: pending.title || undefined,
52772
+ body: pending.body
52773
+ });
52774
+ }
52775
+ return;
52776
+ }
52614
52777
  case "777": {
52615
52778
  const verbSeparatorIndex = payload.indexOf(";");
52616
52779
  const verb = verbSeparatorIndex >= 0 ? payload.slice(0, verbSeparatorIndex) : payload;
@@ -52640,127 +52803,218 @@ function createPaneStreamParser(options) {
52640
52803
  return {
52641
52804
  push(data) {
52642
52805
  const output = [];
52643
- for (const byte of data) {
52806
+ function flushTmuxPassthrough() {
52807
+ const content = dcsBytes;
52808
+ dcsBytes = [];
52809
+ dcsPrefix = "";
52810
+ phase = "normal";
52811
+ for (const byte of content) {
52812
+ processByte(byte);
52813
+ }
52814
+ }
52815
+ function appendDcsByte(byte) {
52816
+ if (dcsBytes.length >= MAX_DCS_PASSTHROUGH_BYTES) {
52817
+ if (!warnedDcsOverflow) {
52818
+ warnedDcsOverflow = true;
52819
+ console.warn("[tmex] pane stream parser dropped oversized tmux passthrough payload");
52820
+ }
52821
+ dcsBytes = [];
52822
+ phase = "dcs-tmux-ignore";
52823
+ return false;
52824
+ }
52825
+ dcsBytes.push(byte);
52826
+ return true;
52827
+ }
52828
+ function processByte(byte) {
52644
52829
  if (phase === "normal") {
52645
52830
  if (byte === 27) {
52646
52831
  phase = "esc";
52647
- continue;
52832
+ return;
52648
52833
  }
52649
52834
  if (byte === 7) {
52650
52835
  options.onBell();
52651
- continue;
52836
+ return;
52652
52837
  }
52653
52838
  output.push(byte);
52654
- continue;
52839
+ return;
52655
52840
  }
52656
52841
  if (phase === "esc") {
52657
52842
  if (byte === 93) {
52658
52843
  resetOscState();
52659
52844
  phase = "osc-params";
52660
- continue;
52845
+ return;
52661
52846
  }
52662
52847
  if (byte === 107) {
52663
52848
  titleBytes = [];
52664
52849
  phase = "screen-title";
52665
- continue;
52850
+ return;
52851
+ }
52852
+ if (byte === 80) {
52853
+ dcsPrefix = "";
52854
+ phase = "dcs-detect";
52855
+ return;
52666
52856
  }
52667
52857
  output.push(27, byte);
52668
52858
  phase = "normal";
52669
- continue;
52859
+ return;
52860
+ }
52861
+ if (phase === "dcs-detect") {
52862
+ const expected = TMUX_PASSTHROUGH_PREFIX.charCodeAt(dcsPrefix.length);
52863
+ if (byte === expected) {
52864
+ dcsPrefix += String.fromCharCode(byte);
52865
+ if (dcsPrefix.length === TMUX_PASSTHROUGH_PREFIX.length) {
52866
+ dcsBytes = [];
52867
+ phase = "dcs-tmux";
52868
+ }
52869
+ return;
52870
+ }
52871
+ output.push(27, 80);
52872
+ for (const prefixChar of dcsPrefix) {
52873
+ output.push(prefixChar.charCodeAt(0));
52874
+ }
52875
+ dcsPrefix = "";
52876
+ phase = "normal";
52877
+ processByte(byte);
52878
+ return;
52879
+ }
52880
+ if (phase === "dcs-tmux") {
52881
+ if (byte === 27) {
52882
+ phase = "dcs-tmux-esc";
52883
+ return;
52884
+ }
52885
+ appendDcsByte(byte);
52886
+ return;
52887
+ }
52888
+ if (phase === "dcs-tmux-esc") {
52889
+ if (byte === 92) {
52890
+ flushTmuxPassthrough();
52891
+ return;
52892
+ }
52893
+ if (byte === 27) {
52894
+ phase = "dcs-tmux";
52895
+ appendDcsByte(27);
52896
+ return;
52897
+ }
52898
+ phase = "dcs-tmux";
52899
+ if (appendDcsByte(27)) {
52900
+ appendDcsByte(byte);
52901
+ }
52902
+ return;
52903
+ }
52904
+ if (phase === "dcs-tmux-ignore") {
52905
+ if (byte === 27) {
52906
+ phase = "dcs-tmux-ignore-esc";
52907
+ }
52908
+ return;
52909
+ }
52910
+ if (phase === "dcs-tmux-ignore-esc") {
52911
+ if (byte === 92) {
52912
+ dcsBytes = [];
52913
+ dcsPrefix = "";
52914
+ phase = "normal";
52915
+ return;
52916
+ }
52917
+ if (byte !== 27) {
52918
+ phase = "dcs-tmux-ignore";
52919
+ }
52920
+ return;
52670
52921
  }
52671
52922
  if (phase === "osc-params") {
52672
52923
  if (byte === 59) {
52673
- phase = oscKind === "0" || oscKind === "1" || oscKind === "2" || oscKind === "9" || oscKind === "777" || oscKind === "1337" ? "osc-body" : "osc-body-ignore";
52674
- continue;
52924
+ phase = oscKind === "0" || oscKind === "1" || oscKind === "2" || oscKind === "9" || oscKind === "99" || oscKind === "777" || oscKind === "1337" ? "osc-body" : "osc-body-ignore";
52925
+ return;
52675
52926
  }
52676
52927
  if (byte === 7) {
52677
52928
  emitOsc();
52678
52929
  resetOscState();
52679
52930
  phase = "normal";
52680
- continue;
52931
+ return;
52681
52932
  }
52682
52933
  if (byte === 27) {
52683
52934
  phase = "osc-st";
52684
- continue;
52935
+ return;
52685
52936
  }
52686
52937
  if (oscKind.length >= MAX_OSC_KIND_BYTES) {
52687
52938
  resetOscState();
52688
52939
  phase = "osc-body-ignore";
52689
- continue;
52940
+ return;
52690
52941
  }
52691
52942
  oscKind += String.fromCharCode(byte);
52692
- continue;
52943
+ return;
52693
52944
  }
52694
52945
  if (phase === "osc-body") {
52695
52946
  if (byte === 7) {
52696
52947
  emitOsc();
52697
52948
  resetOscState();
52698
52949
  phase = "normal";
52699
- continue;
52950
+ return;
52700
52951
  }
52701
52952
  if (byte === 27) {
52702
52953
  phase = "osc-st";
52703
- continue;
52954
+ return;
52704
52955
  }
52705
52956
  appendOscPayloadByte(byte);
52706
- continue;
52957
+ return;
52707
52958
  }
52708
52959
  if (phase === "osc-body-ignore") {
52709
52960
  if (byte === 7) {
52710
52961
  resetOscState();
52711
52962
  phase = "normal";
52712
- continue;
52963
+ return;
52713
52964
  }
52714
52965
  if (byte === 27) {
52715
52966
  phase = "osc-st-ignore";
52716
52967
  }
52717
- continue;
52968
+ return;
52718
52969
  }
52719
52970
  if (phase === "osc-st") {
52720
52971
  if (byte === 92) {
52721
52972
  emitOsc();
52722
52973
  resetOscState();
52723
52974
  phase = "normal";
52724
- continue;
52975
+ return;
52725
52976
  }
52726
- if (!appendOscPayloadByte(27)) {
52727
- continue;
52977
+ phase = "osc-body";
52978
+ if (appendOscPayloadByte(27)) {
52979
+ appendOscPayloadByte(byte);
52728
52980
  }
52729
- appendOscPayloadByte(byte);
52730
- continue;
52981
+ return;
52731
52982
  }
52732
52983
  if (phase === "osc-st-ignore") {
52733
52984
  if (byte === 92) {
52734
52985
  resetOscState();
52735
52986
  phase = "normal";
52736
- continue;
52987
+ return;
52737
52988
  }
52738
52989
  phase = "osc-body-ignore";
52739
- continue;
52990
+ return;
52740
52991
  }
52741
52992
  if (phase === "screen-title") {
52742
52993
  if (byte === 7) {
52743
52994
  emitTitle(titleBytes);
52744
52995
  titleBytes = [];
52745
52996
  phase = "normal";
52746
- continue;
52997
+ return;
52747
52998
  }
52748
52999
  if (byte === 27) {
52749
53000
  phase = "screen-title-st";
52750
- continue;
53001
+ return;
52751
53002
  }
52752
53003
  titleBytes.push(byte);
52753
- continue;
53004
+ return;
52754
53005
  }
52755
53006
  if (byte === 92) {
52756
53007
  emitTitle(titleBytes);
52757
53008
  titleBytes = [];
52758
53009
  phase = "normal";
52759
- continue;
53010
+ return;
52760
53011
  }
52761
53012
  titleBytes.push(27, byte);
52762
53013
  phase = "screen-title";
52763
53014
  }
53015
+ for (const byte of data) {
53016
+ processByte(byte);
53017
+ }
52764
53018
  return new Uint8Array(output);
52765
53019
  }
52766
53020
  };
@@ -52827,7 +53081,11 @@ class LocalExternalTmuxConnection {
52827
53081
  this.deps = {
52828
53082
  enableHooks: inputDeps.enableHooks ?? true,
52829
53083
  getDevice: inputDeps.getDevice ?? ((deviceId) => getDeviceById(deviceId)),
52830
- run: inputDeps.run ?? defaultRun
53084
+ run: inputDeps.run ?? defaultRun,
53085
+ ensureGhosttyTerminfo: inputDeps.ensureGhosttyTerminfo ?? (async () => {
53086
+ const result = await this.deps.run(["/bin/sh", "-c", buildEnsureGhosttyTerminfoScript()]);
53087
+ return result.exitCode === 0;
53088
+ })
52831
53089
  };
52832
53090
  }
52833
53091
  async connect() {
@@ -52984,6 +53242,25 @@ class LocalExternalTmuxConnection {
52984
53242
  "csi-u"
52985
53243
  ]);
52986
53244
  await this.runTmuxAllowFailure(["set-option", "-t", this.sessionName, "-g", "focus-events", "on"]);
53245
+ const termProgram = config.tmuxTermProgram.trim();
53246
+ if (termProgram && termProgram.toLowerCase() !== "off") {
53247
+ await this.runTmuxAllowFailure([
53248
+ "set-environment",
53249
+ "-t",
53250
+ this.sessionName,
53251
+ "TERM_PROGRAM",
53252
+ termProgram
53253
+ ]);
53254
+ if (termProgram === "ghostty" && await this.deps.ensureGhosttyTerminfo()) {
53255
+ await this.runTmuxAllowFailure([
53256
+ "set-option",
53257
+ "-t",
53258
+ this.sessionName,
53259
+ "default-terminal",
53260
+ "xterm-ghostty"
53261
+ ]);
53262
+ }
53263
+ }
52987
53264
  }
52988
53265
  ensureRuntimeDirs() {
52989
53266
  mkdirSync(this.fsPaths.rootDir, { recursive: true, mode: 448 });
@@ -54132,6 +54409,33 @@ class SshExternalTmuxConnection {
54132
54409
  "csi-u"
54133
54410
  ]);
54134
54411
  await this.runTmuxAllowFailure(["set-option", "-t", this.sessionName, "-g", "focus-events", "on"]);
54412
+ const termProgram = config.tmuxTermProgram.trim();
54413
+ if (termProgram && termProgram.toLowerCase() !== "off") {
54414
+ await this.runTmuxAllowFailure([
54415
+ "set-environment",
54416
+ "-t",
54417
+ this.sessionName,
54418
+ "TERM_PROGRAM",
54419
+ termProgram
54420
+ ]);
54421
+ if (termProgram === "ghostty" && await this.ensureGhosttyTerminfo()) {
54422
+ await this.runTmuxAllowFailure([
54423
+ "set-option",
54424
+ "-t",
54425
+ this.sessionName,
54426
+ "default-terminal",
54427
+ "xterm-ghostty"
54428
+ ]);
54429
+ }
54430
+ }
54431
+ }
54432
+ async ensureGhosttyTerminfo() {
54433
+ try {
54434
+ const result = await this.runShellAllowFailure(buildEnsureGhosttyTerminfoScript(), 15000);
54435
+ return result.exitCode === 0;
54436
+ } catch {
54437
+ return false;
54438
+ }
54135
54439
  }
54136
54440
  async startHooks() {
54137
54441
  await this.ensureRemoteRuntimeDirs();
@@ -57024,7 +57328,7 @@ class WebSocketServer {
57024
57328
  };
57025
57329
  }
57026
57330
  const raw = event.data ?? {};
57027
- const source = raw.source === "osc9" || raw.source === "osc777" || raw.source === "osc1337" ? raw.source : "osc9";
57331
+ const source = raw.source === "osc9" || raw.source === "osc99" || raw.source === "osc777" || raw.source === "osc1337" ? raw.source : "osc9";
57028
57332
  const title = typeof raw.title === "string" && raw.title ? raw.title : undefined;
57029
57333
  const body = typeof raw.body === "string" ? raw.body : "";
57030
57334
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmex-cli",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tmex": "./bin/tmex.js",