tmex-cli 0.6.6 → 0.6.7

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.
@@ -20666,7 +20666,17 @@ Time: {{time}}`,
20666
20666
  },
20667
20667
  window: {
20668
20668
  noWindows: "No windows",
20669
- new: "New Window"
20669
+ new: "New Window",
20670
+ close: "Close window",
20671
+ closePane: "Close pane",
20672
+ closeConfirmTitle: "Close this window?",
20673
+ closePaneConfirmTitle: "Close this pane?",
20674
+ closeConfirmDesc: 'Processes running in "{{name}}" will be terminated. This action cannot be undone.',
20675
+ menu: "Window actions",
20676
+ rename: "Rename window",
20677
+ renamePlaceholder: "Enter a name",
20678
+ renameDesc: "The custom name overrides the title set by the terminal and is kept until the gateway restarts.",
20679
+ renameReset: "Use automatic name"
20670
20680
  },
20671
20681
  validation: {
20672
20682
  deviceNameRequired: "Device name is required",
@@ -21031,7 +21041,17 @@ Bot\uFF1A{{botName}}
21031
21041
  },
21032
21042
  window: {
21033
21043
  noWindows: "\u6682\u65E0\u7A97\u53E3",
21034
- new: "\u65B0\u5EFA\u7A97\u53E3"
21044
+ new: "\u65B0\u5EFA\u7A97\u53E3",
21045
+ close: "\u5173\u95ED\u7A97\u53E3",
21046
+ closePane: "\u5173\u95ED\u9762\u677F",
21047
+ closeConfirmTitle: "\u5173\u95ED\u6B64\u7A97\u53E3\uFF1F",
21048
+ closePaneConfirmTitle: "\u5173\u95ED\u6B64\u9762\u677F\uFF1F",
21049
+ closeConfirmDesc: '"{{name}}" \u4E2D\u8FD0\u884C\u7684\u8FDB\u7A0B\u5C06\u88AB\u7EC8\u6B62\uFF0C\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u9500\u3002',
21050
+ menu: "\u7A97\u53E3\u64CD\u4F5C",
21051
+ rename: "\u91CD\u547D\u540D\u7A97\u53E3",
21052
+ renamePlaceholder: "\u8F93\u5165\u540D\u79F0",
21053
+ renameDesc: "\u81EA\u5B9A\u4E49\u540D\u79F0\u4F1A\u8986\u76D6\u7EC8\u7AEF\u8BBE\u7F6E\u7684\u6807\u9898\uFF0C\u5E76\u4FDD\u7559\u81F3 gateway \u91CD\u542F\u3002",
21054
+ renameReset: "\u6062\u590D\u81EA\u52A8\u540D\u79F0"
21035
21055
  },
21036
21056
  validation: {
21037
21057
  deviceNameRequired: "\u8BBE\u5907\u540D\u79F0\u4E3A\u5FC5\u586B\u9879",
@@ -21396,7 +21416,17 @@ Bot\uFF1A{{botName}}
21396
21416
  },
21397
21417
  window: {
21398
21418
  noWindows: "\u30A6\u30A3\u30F3\u30C9\u30A6\u304C\u3042\u308A\u307E\u305B\u3093",
21399
- new: "\u65B0\u898F\u30A6\u30A3\u30F3\u30C9\u30A6"
21419
+ new: "\u65B0\u898F\u30A6\u30A3\u30F3\u30C9\u30A6",
21420
+ close: "\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u9589\u3058\u308B",
21421
+ closePane: "\u30DA\u30A4\u30F3\u3092\u9589\u3058\u308B",
21422
+ closeConfirmTitle: "\u3053\u306E\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u9589\u3058\u307E\u3059\u304B\uFF1F",
21423
+ closePaneConfirmTitle: "\u3053\u306E\u30DA\u30A4\u30F3\u3092\u9589\u3058\u307E\u3059\u304B\uFF1F",
21424
+ closeConfirmDesc: '"{{name}}" \u3067\u5B9F\u884C\u4E2D\u306E\u30D7\u30ED\u30BB\u30B9\u306F\u7D42\u4E86\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u64CD\u4F5C\u306F\u53D6\u308A\u6D88\u305B\u307E\u305B\u3093\u3002',
21425
+ menu: "\u30A6\u30A3\u30F3\u30C9\u30A6\u64CD\u4F5C",
21426
+ rename: "\u30A6\u30A3\u30F3\u30C9\u30A6\u540D\u3092\u5909\u66F4",
21427
+ renamePlaceholder: "\u540D\u524D\u3092\u5165\u529B",
21428
+ renameDesc: "\u30AB\u30B9\u30BF\u30E0\u540D\u306F\u30BF\u30FC\u30DF\u30CA\u30EB\u304C\u8A2D\u5B9A\u3057\u305F\u30BF\u30A4\u30C8\u30EB\u3092\u4E0A\u66F8\u304D\u3057\u3001\u30B2\u30FC\u30C8\u30A6\u30A7\u30A4\u304C\u518D\u8D77\u52D5\u3059\u308B\u307E\u3067\u4FDD\u6301\u3055\u308C\u307E\u3059\u3002",
21429
+ renameReset: "\u81EA\u52D5\u540D\u306B\u623B\u3059"
21400
21430
  },
21401
21431
  validation: {
21402
21432
  deviceNameRequired: "\u30C7\u30D0\u30A4\u30B9\u540D\u306F\u5FC5\u9808\u3067\u3059",
@@ -21836,6 +21866,7 @@ var PaneWireSchema = import_zorsh.b.struct({
21836
21866
  var WindowWireSchema = import_zorsh.b.struct({
21837
21867
  id: import_zorsh.b.string(),
21838
21868
  name: import_zorsh.b.string(),
21869
+ customName: OptionStringSchema,
21839
21870
  index: import_zorsh.b.u16(),
21840
21871
  active: import_zorsh.b.bool(),
21841
21872
  panes: import_zorsh.b.vec(PaneWireSchema)
@@ -22256,6 +22287,7 @@ function encodeWindowWire(window2) {
22256
22287
  return {
22257
22288
  id: window2.id,
22258
22289
  name: window2.name,
22290
+ customName: window2.customName ?? null,
22259
22291
  index: window2.index,
22260
22292
  active: window2.active,
22261
22293
  panes: window2.panes.map(encodePaneWire)
@@ -22382,6 +22414,7 @@ function decodeWindowWire(wire) {
22382
22414
  return {
22383
22415
  id: wire.id,
22384
22416
  name: wire.name,
22417
+ customName: wire.customName ?? undefined,
22385
22418
  index: wire.index,
22386
22419
  active: wire.active,
22387
22420
  panes: wire.panes.map(decodePaneWire)
@@ -53985,10 +54018,11 @@ class LocalExternalTmuxConnection {
53985
54018
  ]),
53986
54019
  this.runTmuxAllowFailure([
53987
54020
  "list-panes",
54021
+ "-s",
53988
54022
  "-t",
53989
54023
  this.sessionName,
53990
54024
  "-F",
53991
- "#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_title}\t#{pane_active}\t#{pane_width}\t#{pane_height}"
54025
+ "#{pane_id}\t#{window_id}\t#{pane_index}\t#{pane_title}\t#{pane_active}\t#{pane_width}\t#{pane_height}\t#{window_active}"
53992
54026
  ])
53993
54027
  ]);
53994
54028
  if (sessionRes.exitCode !== 0 || windowsRes.exitCode !== 0 || panesRes.exitCode !== 0) {
@@ -54060,7 +54094,7 @@ ${panesRes.stderr}`;
54060
54094
  if (!line.trim()) {
54061
54095
  continue;
54062
54096
  }
54063
- const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw] = line.split("\t");
54097
+ const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw, windowActiveRaw] = line.split("\t");
54064
54098
  if (!paneId || !windowId) {
54065
54099
  continue;
54066
54100
  }
@@ -54076,7 +54110,7 @@ ${panesRes.stderr}`;
54076
54110
  width: Number.isNaN(width) ? 0 : width,
54077
54111
  height: Number.isNaN(height) ? 0 : height
54078
54112
  };
54079
- if (pane.active) {
54113
+ if (pane.active && windowActiveRaw === "1") {
54080
54114
  this.activePaneId = paneId;
54081
54115
  this.activeWindowId = windowId;
54082
54116
  }
@@ -54581,12 +54615,13 @@ function splitSnapshotFields(line, fieldCount) {
54581
54615
  if (fieldCount === 4) {
54582
54616
  return [parts[0] ?? "", parts[1] ?? "", parts.slice(2, -1).join(SNAPSHOT_FIELD_SEPARATOR), parts.at(-1) ?? ""];
54583
54617
  }
54584
- if (fieldCount === 7) {
54618
+ if (fieldCount === 8) {
54585
54619
  return [
54586
54620
  parts[0] ?? "",
54587
54621
  parts[1] ?? "",
54588
54622
  parts[2] ?? "",
54589
- parts.slice(3, -3).join(SNAPSHOT_FIELD_SEPARATOR),
54623
+ parts.slice(3, -4).join(SNAPSHOT_FIELD_SEPARATOR),
54624
+ parts.at(-4) ?? "",
54590
54625
  parts.at(-3) ?? "",
54591
54626
  parts.at(-2) ?? "",
54592
54627
  parts.at(-1) ?? ""
@@ -55185,10 +55220,11 @@ class SshExternalTmuxConnection {
55185
55220
  ]),
55186
55221
  this.runTmuxAllowFailure([
55187
55222
  "list-panes",
55223
+ "-s",
55188
55224
  "-t",
55189
55225
  this.sessionName,
55190
55226
  "-F",
55191
- "#{pane_id}|#{window_id}|#{pane_index}|#{pane_title}|#{pane_active}|#{pane_width}|#{pane_height}"
55227
+ "#{pane_id}|#{window_id}|#{pane_index}|#{pane_title}|#{pane_active}|#{pane_width}|#{pane_height}|#{window_active}"
55192
55228
  ])
55193
55229
  ]);
55194
55230
  if (sessionRes.exitCode !== 0 || windowsRes.exitCode !== 0 || panesRes.exitCode !== 0) {
@@ -55260,7 +55296,7 @@ ${panesRes.stderr}`;
55260
55296
  if (!line.trim()) {
55261
55297
  continue;
55262
55298
  }
55263
- const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw] = splitSnapshotFields(line, 7);
55299
+ const [paneId, windowId, indexRaw, titleRaw, activeRaw, widthRaw, heightRaw, windowActiveRaw] = splitSnapshotFields(line, 8);
55264
55300
  if (!paneId || !windowId) {
55265
55301
  continue;
55266
55302
  }
@@ -55276,7 +55312,7 @@ ${panesRes.stderr}`;
55276
55312
  width: Number.isNaN(width) ? 0 : width,
55277
55313
  height: Number.isNaN(height) ? 0 : height
55278
55314
  };
55279
- if (pane.active) {
55315
+ if (pane.active && windowActiveRaw === "1") {
55280
55316
  this.activePaneId = paneId;
55281
55317
  this.activeWindowId = windowId;
55282
55318
  }
@@ -57279,6 +57315,7 @@ var defaultDeps2 = {
57279
57315
  class WebSocketServer {
57280
57316
  connections = new Map;
57281
57317
  pendingConnectionEntries = new Map;
57318
+ windowCustomNames = new Map;
57282
57319
  deps;
57283
57320
  constructor(options = {}) {
57284
57321
  this.deps = {
@@ -57638,7 +57675,7 @@ class WebSocketServer {
57638
57675
  });
57639
57676
  this.sendEnvelope(ws, exports_ws_borsh.KIND_DEVICE_CONNECTED, connectedPayload);
57640
57677
  if (entry.lastSnapshot) {
57641
- const snapshotBytes = exports_ws_borsh.encodeStateSnapshot(entry.lastSnapshot);
57678
+ const snapshotBytes = exports_ws_borsh.encodeStateSnapshot(this.applyWindowCustomNames(entry.lastSnapshot));
57642
57679
  this.sendChunked(ws, exports_ws_borsh.KIND_STATE_SNAPSHOT, snapshotBytes);
57643
57680
  } else {
57644
57681
  entry.runtime.requestSnapshot();
@@ -57742,10 +57779,46 @@ class WebSocketServer {
57742
57779
  entry.runtime.closePane(paneId);
57743
57780
  }
57744
57781
  handleRenameWindow(deviceId, windowId, name) {
57782
+ const trimmed = name.trim().slice(0, 64);
57783
+ const names = this.windowCustomNames.get(deviceId);
57784
+ if (!trimmed) {
57785
+ names?.delete(windowId);
57786
+ } else if (names) {
57787
+ names.set(windowId, trimmed);
57788
+ } else {
57789
+ this.windowCustomNames.set(deviceId, new Map([[windowId, trimmed]]));
57790
+ }
57745
57791
  const entry = this.connections.get(deviceId);
57746
- if (!entry)
57792
+ if (!entry?.lastSnapshot)
57747
57793
  return;
57748
- entry.runtime.renameWindow(windowId, name);
57794
+ this.sendSnapshotToClients(entry, entry.lastSnapshot);
57795
+ }
57796
+ applyWindowCustomNames(payload) {
57797
+ const names = this.windowCustomNames.get(payload.deviceId);
57798
+ if (!names?.size || !payload.session)
57799
+ return payload;
57800
+ const liveWindowIds = new Set(payload.session.windows.map((w) => w.id));
57801
+ for (const windowId of names.keys()) {
57802
+ if (!liveWindowIds.has(windowId)) {
57803
+ names.delete(windowId);
57804
+ }
57805
+ }
57806
+ return {
57807
+ ...payload,
57808
+ session: {
57809
+ ...payload.session,
57810
+ windows: payload.session.windows.map((window2) => {
57811
+ const customName = names.get(window2.id);
57812
+ return customName ? { ...window2, customName } : window2;
57813
+ })
57814
+ }
57815
+ };
57816
+ }
57817
+ sendSnapshotToClients(entry, payload) {
57818
+ const payloadBytes = exports_ws_borsh.encodeStateSnapshot(this.applyWindowCustomNames(payload));
57819
+ for (const client of entry.clients) {
57820
+ this.sendChunked(client, exports_ws_borsh.KIND_STATE_SNAPSHOT, payloadBytes);
57821
+ }
57749
57822
  }
57750
57823
  async createDeviceConnectionEntry(deviceId, ws) {
57751
57824
  let runtime = null;
@@ -57864,10 +57937,7 @@ class WebSocketServer {
57864
57937
  if (!entry)
57865
57938
  return;
57866
57939
  entry.lastSnapshot = payload;
57867
- const payloadBytes = exports_ws_borsh.encodeStateSnapshot(payload);
57868
- for (const client of entry.clients) {
57869
- this.sendChunked(client, exports_ws_borsh.KIND_STATE_SNAPSHOT, payloadBytes);
57870
- }
57940
+ this.sendSnapshotToClients(entry, payload);
57871
57941
  }
57872
57942
  broadcastTerminalOutput(deviceId, paneId, data) {
57873
57943
  const entry = this.connections.get(deviceId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmex-cli",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "tmex": "./bin/tmex.js",