tmux-ide 2.9.25 → 2.9.27

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 (67) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +1577 -559
  3. package/package.json +3 -2
  4. package/packages/contracts/src/pane-stream.ts +28 -0
  5. package/packages/contracts/src/terminal-delivery.ts +122 -5
  6. package/packages/contracts/src/terminal-runtime-inventory.ts +61 -1
  7. package/packages/contracts/src/tmux-server-scope.ts +18 -0
  8. package/packages/core/src/index.ts +1 -0
  9. package/packages/core/src/terminal-delivery-binary.ts +8 -7
  10. package/packages/core/src/terminal-delivery.ts +174 -3
  11. package/packages/core/src/terminal-partial-history.ts +152 -0
  12. package/packages/core/src/terminal-replica.ts +70 -1
  13. package/packages/daemon/dist/command-center/owner-keep-alive.js +30 -0
  14. package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +42 -2
  15. package/packages/daemon/dist/command-center/server.js +3 -0
  16. package/packages/daemon/dist/command-center/tmux-server-attach.js +51 -0
  17. package/packages/daemon/dist/command-center/tmux-servers.js +95 -7
  18. package/packages/daemon/dist/doctor.js +4 -4
  19. package/packages/daemon/dist/lib/app-config.js +7 -0
  20. package/packages/daemon/dist/lib/node-requirement.js +20 -0
  21. package/packages/daemon/dist/lib/require-supported-node.js +8 -0
  22. package/packages/daemon/dist/lib/tmux-server-owner.js +4 -2
  23. package/packages/daemon/dist/lib/tmux-server-session-open.js +38 -12
  24. package/packages/daemon/dist/lib/workspace-promotion.js +4 -4
  25. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
  26. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
  27. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
  28. package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +2 -2
  29. package/packages/daemon/dist/server/pane-stream-upgrade.js +39 -1
  30. package/packages/daemon/dist/terminal/mirror/session-channel.js +6 -1
  31. package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +1 -0
  32. package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +112 -22
  33. package/packages/daemon/dist/terminal/protocol/browser-icon.js +1 -1
  34. package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +26 -3
  35. package/packages/daemon/dist/terminal/session-runtime/registry.js +2 -0
  36. package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +571 -33
  37. package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +2 -0
  38. package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +51 -4
  39. package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +76 -2
  40. package/packages/daemon/dist/tui/mirror/theme.js +8 -1
  41. package/packages/daemon/src/command-center/attach-window-rule.cases.json +84 -0
  42. package/packages/daemon/src/command-center/owner-keep-alive.ts +38 -0
  43. package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +48 -1
  44. package/packages/daemon/src/command-center/server.ts +3 -0
  45. package/packages/daemon/src/command-center/tmux-server-attach.ts +75 -0
  46. package/packages/daemon/src/command-center/tmux-servers.ts +103 -6
  47. package/packages/daemon/src/doctor.ts +4 -4
  48. package/packages/daemon/src/lib/app-config.ts +15 -0
  49. package/packages/daemon/src/lib/node-requirement.ts +22 -0
  50. package/packages/daemon/src/lib/require-supported-node.ts +9 -0
  51. package/packages/daemon/src/lib/tmux-server-owner.ts +6 -3
  52. package/packages/daemon/src/lib/tmux-server-session-open.ts +53 -15
  53. package/packages/daemon/src/lib/workspace-promotion.ts +4 -4
  54. package/packages/daemon/src/server/pane-stream-upgrade.ts +41 -1
  55. package/packages/daemon/src/terminal/mirror/events.ts +2 -0
  56. package/packages/daemon/src/terminal/mirror/session-channel.ts +8 -1
  57. package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +3 -0
  58. package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +136 -20
  59. package/packages/daemon/src/terminal/protocol/browser-icon.ts +1 -1
  60. package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +32 -2
  61. package/packages/daemon/src/terminal/session-runtime/registry.ts +2 -0
  62. package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +696 -30
  63. package/packages/daemon/src/terminal/session-runtime/terminal-interpreter-backend.ts +6 -0
  64. package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +2 -0
  65. package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +67 -3
  66. package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +82 -2
  67. package/packages/daemon/src/tui/mirror/theme.ts +13 -1
@@ -17,6 +17,7 @@ import {
17
17
  TERMINAL_PROJECTION_LOCAL_CAPABILITY_VERSION,
18
18
  type TerminalProjectionReceipt,
19
19
  type TerminalProjectionMaterialize,
20
+ type TerminalDeliveryHistoryRequest,
20
21
  } from "@tmux-ide/contracts";
21
22
  import type { LocalImageOwner } from "../graphics/local-image-owner.ts";
22
23
  import {
@@ -24,6 +25,7 @@ import {
24
25
  PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION,
25
26
  PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION,
26
27
  PANE_STREAM_READER_CAPABILITY_VERSION,
28
+ PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION,
27
29
  PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION,
28
30
  PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION,
29
31
  type PaneStreamInputLifetime,
@@ -313,6 +315,12 @@ export type PaneStreamUpgradeDecision =
313
315
  export interface PaneStreamPreAuthAdmission {
314
316
  bind(socket: DirectTerminalSocket): void;
315
317
  cancelBeforeBind(): void;
318
+ /**
319
+ * Redeem with the frame the upgrade request carried (attach-rtt), exactly
320
+ * as if it were the socket's first message. A frame sent afterwards is a
321
+ * second redemption and closes the socket.
322
+ */
323
+ redeemFromUpgrade(frame: Buffer): void;
316
324
  }
317
325
 
318
326
  export interface PaneStreamAdmissionSnapshot {
@@ -421,8 +429,12 @@ export interface SessionRuntimeTerminalDeliveryConnection {
421
429
  ack(ack: TerminalDeliveryAck): void;
422
430
  projectionReceipt?(receipt: TerminalProjectionReceipt): void;
423
431
  materialize?(request: TerminalProjectionMaterialize): void;
432
+ /** Capability 122: older history rows for a client holding a partial history. */
433
+ historyRequest?(request: TerminalDeliveryHistoryRequest): void;
424
434
  nack(nack: TerminalDeliveryNack): void;
425
435
  setVisibility(visibility: TerminalDeliveryVisibility): void;
436
+ /** The client typed into this pane: send its deliveries first. */
437
+ prioritize?(): void;
426
438
  close(): Promise<void>;
427
439
  readonly graphics?: TerminalDeliveryGraphics;
428
440
  }
@@ -636,6 +648,23 @@ export class PaneStreamAdmissionCoordinator {
636
648
  );
637
649
  }
638
650
  }
651
+ // #806: a stream for one window is issued for exactly that window's
652
+ // panes, as the trusted inventory places them now.
653
+ if (request.semanticWindowId !== undefined) {
654
+ const windowPanes = new Set(
655
+ described.panes
656
+ .filter((pane) => pane.semanticWindowId === request.semanticWindowId)
657
+ .map((pane) => pane.semanticPaneId),
658
+ );
659
+ if (
660
+ windowPanes.size !== request.panes.length ||
661
+ request.panes.some((pane) => !windowPanes.has(pane))
662
+ )
663
+ throw new PaneStreamAdmissionError(
664
+ "pane-not-found",
665
+ "The panes are not exactly the panes of that window of the workspace session.",
666
+ );
667
+ }
639
668
 
640
669
  const issued = await this.#leaseManager.issue(request, {
641
670
  requestId,
@@ -1059,6 +1088,10 @@ class PreAuthAdmission implements PaneStreamPreAuthAdmission {
1059
1088
  this.close(1008, "upgrade-rejected");
1060
1089
  }
1061
1090
 
1091
+ redeemFromUpgrade(frame: Buffer): void {
1092
+ this.#onMessage(frame, false);
1093
+ }
1094
+
1062
1095
  promote(): void {
1063
1096
  if (!this.#open) return;
1064
1097
  this.#promoted = true;
@@ -1680,7 +1713,11 @@ export class PaneStreamLiveConnection {
1680
1713
  * stream with 1011, and nothing was tried twice. A refusal of authority is a
1681
1714
  * decision, not a failure, and is never repeated. Each repeat is logged.
1682
1715
  */
1683
- async #retryOpenStep<T>(step: string, run: () => Promise<T>): Promise<T> {
1716
+ async #retryOpenStep<T>(
1717
+ step: string,
1718
+ run: () => Promise<T>,
1719
+ final: (error: unknown) => boolean = () => false,
1720
+ ): Promise<T> {
1684
1721
  for (let attempt = 0; ; attempt += 1) {
1685
1722
  try {
1686
1723
  return await run();
@@ -1689,7 +1726,8 @@ export class PaneStreamLiveConnection {
1689
1726
  if (
1690
1727
  delayMs === undefined ||
1691
1728
  this.#closed ||
1692
- error instanceof SessionRuntimeControllerLeaseError
1729
+ error instanceof SessionRuntimeControllerLeaseError ||
1730
+ final(error)
1693
1731
  )
1694
1732
  throw error;
1695
1733
  logger.info("pane-stream", "stream open step failed; trying again", {
@@ -1725,24 +1763,38 @@ export class PaneStreamLiveConnection {
1725
1763
  let stagedAuthority: MirrorLayoutAuthoritySnapshot | null = null;
1726
1764
  let authorityMalformed = false;
1727
1765
  let layoutActivated = false;
1766
+ let layoutAttempt = 0;
1728
1767
  // Establish the single session layout observer first. MirrorService owns
1729
1768
  // this lifecycle and may share native control state with delivery setup;
1730
1769
  // only the independent pane delivery opens below are parallelized.
1731
1770
  try {
1732
- if (!this.#mirror.subscribeLayout) throw new Error("authoritative layout is unavailable");
1733
- const subscription = await this.#mirror.subscribeLayout(
1734
- this.#descriptor.sessionName,
1735
- () => undefined,
1736
- {
1737
- expectedSemanticPaneIds: expectedPaneIds,
1738
- expectedRuntimeSessionId: this.#descriptor.runtimeSessionId!,
1739
- onAuthority: (snapshot) => {
1740
- this.#recordDiagnosticLifecycle("pane-stream-layout-staged");
1741
- if (snapshot.layouts.length > PANE_STREAM_MAX_PANES) authorityMalformed = true;
1742
- else if (!layoutActivated) stagedAuthority = snapshot;
1743
- else this.#onLayoutAuthority(snapshot);
1744
- },
1771
+ const subscribeLayout = this.#mirror.subscribeLayout?.bind(this.#mirror);
1772
+ if (!subscribeLayout) throw new Error("authoritative layout is unavailable");
1773
+ // The session's trusted inventory can be unsettled for a moment after a
1774
+ // pane change ("lacks verified identity"): a stream re-issued at once
1775
+ // closed 1011 while the next, 100 ms later, opened. Try again, as the
1776
+ // other opening steps do (#585). A changed pane set is a decision, not
1777
+ // a failure, and still closes 1012 at once. A try that failed is
1778
+ // disowned: its authority callback is ignored.
1779
+ const subscription = await this.#retryOpenStep(
1780
+ "semantic-layout-subscribe",
1781
+ () => {
1782
+ const attempt = ++layoutAttempt;
1783
+ stagedAuthority = null;
1784
+ authorityMalformed = false;
1785
+ return subscribeLayout(this.#descriptor.sessionName, () => undefined, {
1786
+ expectedSemanticPaneIds: expectedPaneIds,
1787
+ expectedRuntimeSessionId: this.#descriptor.runtimeSessionId!,
1788
+ onAuthority: (snapshot) => {
1789
+ if (attempt !== layoutAttempt) return;
1790
+ this.#recordDiagnosticLifecycle("pane-stream-layout-staged");
1791
+ if (snapshot.layouts.length > PANE_STREAM_MAX_PANES) authorityMalformed = true;
1792
+ else if (!layoutActivated) stagedAuthority = snapshot;
1793
+ else this.#onLayoutAuthority(snapshot);
1794
+ },
1795
+ });
1745
1796
  },
1797
+ (error) => error instanceof Error && error.name === "MirrorTopologyChangedError",
1746
1798
  );
1747
1799
  if (this.#closed) {
1748
1800
  await subscription.close().catch(() => undefined);
@@ -2603,7 +2655,10 @@ export class PaneStreamLiveConnection {
2603
2655
  return;
2604
2656
  }
2605
2657
  const frames = this.#validateInitialLayout(snapshot.layouts, this.#semanticExpectedPaneIds);
2606
- if (!frames && this.#topologyInPlace) {
2658
+ // #806: a pane can also move between windows while the session keeps its
2659
+ // panes; for a stream of one window that changes its pane set.
2660
+ const windowChanged = frames !== null && this.#windowPaneSetChanged(snapshot);
2661
+ if ((!frames || windowChanged) && this.#topologyInPlace) {
2607
2662
  // The layout does not fit the pane set this stream knows. With
2608
2663
  // capability 119 that is a change to follow, not a reason to close.
2609
2664
  void this.#reconcileTopology(snapshot);
@@ -2611,6 +2666,7 @@ export class PaneStreamLiveConnection {
2611
2666
  }
2612
2667
  if (
2613
2668
  !frames ||
2669
+ windowChanged ||
2614
2670
  !PaneStreamLayoutSnapshotFrameSchemaZ.safeParse({
2615
2671
  type: "layout-snapshot",
2616
2672
  topologyEpoch: snapshot.topologyEpoch,
@@ -2638,6 +2694,20 @@ export class PaneStreamLiveConnection {
2638
2694
  });
2639
2695
  }
2640
2696
 
2697
+ /** #806: the layout no longer shows this stream's window with exactly its panes. */
2698
+ #windowPaneSetChanged(snapshot: MirrorLayoutAuthoritySnapshot): boolean {
2699
+ const window = this.#descriptor.semanticWindowId;
2700
+ if (window === null) return false;
2701
+ const live = [...this.#panes.values()]
2702
+ .filter((channel) => !channel.closed)
2703
+ .map((channel) => channel.semanticPaneId);
2704
+ const shown = snapshot.layouts.find((event) => event.semanticWindowId === window);
2705
+ if (!shown) return true;
2706
+ const panes = shown.panes.map((pane) => pane.semanticPaneId ?? "");
2707
+ if (shown.zoomed) return panes.length !== 1 || !live.includes(panes[0]!);
2708
+ return panes.length !== live.length || panes.some((pane) => !live.includes(pane));
2709
+ }
2710
+
2641
2711
  /** The same session and runtime, a newer epoch, a layout a stream can carry. */
2642
2712
  #layoutAuthorityAdmissible(snapshot: MirrorLayoutAuthoritySnapshot): boolean {
2643
2713
  return (
@@ -2763,12 +2833,41 @@ export class PaneStreamLiveConnection {
2763
2833
  }).success
2764
2834
  )
2765
2835
  return this.#topologyFailed("layout snapshot invalid");
2836
+ // #806: a stream issued for one window follows that window's panes, as the
2837
+ // trusted inventory places them, and the same layout must show that window
2838
+ // with exactly those panes (a zoomed window shows one of them).
2839
+ const window = this.#descriptor.semanticWindowId;
2840
+ let windowPanes: string[] | null = null;
2841
+ if (window !== null) {
2842
+ windowPanes = [
2843
+ ...new Set(
2844
+ described.panes
2845
+ .filter((pane) => pane.semanticWindowId === window)
2846
+ .map((pane) => pane.semanticPaneId),
2847
+ ),
2848
+ ].sort();
2849
+ if (windowPanes.length === 0) return this.#topologyFailed("the stream's window is gone");
2850
+ const shown = snapshot.layouts.find((event) => event.semanticWindowId === window);
2851
+ const shownPanes = (shown?.panes ?? []).map((pane) => pane.semanticPaneId ?? "");
2852
+ if (
2853
+ !shown ||
2854
+ (shown.zoomed
2855
+ ? shownPanes.length !== 1 || !windowPanes.includes(shownPanes[0]!)
2856
+ : shownPanes.length !== windowPanes.length ||
2857
+ shownPanes.some((pane) => !windowPanes!.includes(pane)))
2858
+ )
2859
+ return "stale";
2860
+ }
2861
+ const followed = windowPanes ?? next;
2766
2862
  const live = [...this.#panes.values()].filter((channel) => !channel.closed);
2767
- const removed = live.filter((channel) => !next.includes(channel.semanticPaneId));
2768
- // A stream issued for the whole session follows it; one issued for some
2769
- // panes keeps exactly those.
2863
+ const removed = live.filter((channel) => !followed.includes(channel.semanticPaneId));
2864
+ // A stream issued for the whole session follows it, and one issued for a
2865
+ // window follows that window; one issued for some panes keeps exactly those.
2770
2866
  const liveIds = new Set(live.map((channel) => channel.semanticPaneId));
2771
- const added = this.#leasesWholeSession ? next.filter((pane) => !liveIds.has(pane)) : [];
2867
+ const added =
2868
+ windowPanes !== null || this.#leasesWholeSession
2869
+ ? followed.filter((pane) => !liveIds.has(pane))
2870
+ : [];
2772
2871
  if (added.length > 0 && !inventoryIsThisSession)
2773
2872
  return this.#topologyFailed("inventory cannot prove the runtime session");
2774
2873
  const remaining = live.length - removed.length + added.length;
@@ -2943,6 +3042,9 @@ export class PaneStreamLiveConnection {
2943
3042
  ...(this.#offers(PANE_STREAM_READER_CAPABILITY_VERSION)
2944
3043
  ? { reader: pane.reader ? { name: pane.reader.name } : null }
2945
3044
  : {}),
3045
+ ...(this.#offers(PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION)
3046
+ ? { browserKind: pane.browserKind ?? null }
3047
+ : {}),
2946
3048
  left: pane.left,
2947
3049
  top: pane.top,
2948
3050
  width: pane.width,
@@ -3281,6 +3383,18 @@ export class PaneStreamLiveConnection {
3281
3383
  channel.delivery.projectionReceipt(frame.receipt);
3282
3384
  return;
3283
3385
  }
3386
+ if (frame.type === "terminal-delivery-history-request") {
3387
+ const channel = this.#deliveryChannel(frame.request);
3388
+ if (!channel) return;
3389
+ if (
3390
+ !channel.delivery?.historyRequest ||
3391
+ !channel.delivery.negotiation.accepted ||
3392
+ channel.delivery.negotiation.negotiated.partialHistory !== "tail-v1"
3393
+ )
3394
+ return this.#failProtocol("protocol-error");
3395
+ channel.delivery.historyRequest(frame.request);
3396
+ return;
3397
+ }
3284
3398
  if (frame.type === "terminal-projection-materialize") {
3285
3399
  const channel = this.#deliveryChannel(frame.request);
3286
3400
  if (!channel) return;
@@ -3878,6 +3992,8 @@ export class PaneStreamLiveConnection {
3878
3992
  else if (kind === "text") channel.sub!.sendText(data);
3879
3993
  else if (kind === "key") channel.sub!.sendKey(data);
3880
3994
  else throw new Error("Byte input requires semantic runtime");
3995
+ // Its echo goes ahead of the connection's other panes (remote links).
3996
+ channel.delivery?.prioritize?.();
3881
3997
  let ackStartedAtMicros: number | null = null;
3882
3998
  let ackStartedAtSharedMicros: number | null = null;
3883
3999
  if (trace) {
@@ -4,7 +4,7 @@ export function browserIcon(value: string, alive = processAlive): string | null
4
4
  if (!match || !alive(Number(match[1]))) return null;
5
5
  return match[2]!;
6
6
  }
7
- function processAlive(pid: number): boolean {
7
+ export function processAlive(pid: number): boolean {
8
8
  try {
9
9
  process.kill(pid, 0);
10
10
  return true;
@@ -1,8 +1,10 @@
1
- import { browserIcon } from "./browser-icon.ts";
1
+ import { browserIcon, processAlive } from "./browser-icon.ts";
2
2
  import { readerOption, type ReaderOption } from "./reader-option.ts";
3
3
 
4
4
  export interface SessionPaneDescriptor {
5
5
  browserIcon?: string | null;
6
+ /** #718: a terminal browser with native controls, a plain one, or null. */
7
+ browserKind?: "native" | "plain" | null;
6
8
  /** A live `tmux-ide open file.md` reader; the path stays daemon-side. */
7
9
  reader?: ReaderOption | null;
8
10
  nativePaneBirthId?: string | null;
@@ -62,6 +64,8 @@ export const SESSION_PANE_DESCRIPTOR_FORMAT = [
62
64
  "#{qa:@tmux_ide_reader}",
63
65
  // The reader option belongs to the pane only when its own process set it.
64
66
  "#{pane_pid}",
67
+ // Set only by a terminal browser that has tmux-ide's native controls (#718).
68
+ "#{qa:@tmux_ide_browser_control}",
65
69
  ].join("\t");
66
70
 
67
71
  /**
@@ -172,7 +176,7 @@ export function parseSessionPaneDescriptorReply(
172
176
  continue;
173
177
  }
174
178
  const encoded = utf8Line.split("\t");
175
- if (encoded.length < 21 || encoded.length > 25) continue;
179
+ if (encoded.length < 21 || encoded.length > 26) continue;
176
180
  const [
177
181
  runtimePaneId = "",
178
182
  semanticPaneId = "",
@@ -199,6 +203,7 @@ export function parseSessionPaneDescriptorReply(
199
203
  browserIconRaw = "",
200
204
  readerRaw = "",
201
205
  panePidRaw = "",
206
+ browserControl = "",
202
207
  ] = encoded.map(decodeTmuxArgument);
203
208
  if (!/^%(?:0|[1-9][0-9]*)$/u.test(runtimePaneId) || runtimePaneId.length > 32) continue;
204
209
  if (!/^\$(?:0|[1-9][0-9]*)$/u.test(runtimeSessionId) || runtimeSessionId.length > 32) continue;
@@ -239,6 +244,7 @@ export function parseSessionPaneDescriptorReply(
239
244
  }
240
245
  descriptors.push({
241
246
  browserIcon: browserIcon(browserIconRaw),
247
+ browserKind: terminalBrowserKind(browserControl, currentCommand),
242
248
  reader: readerOption(readerRaw, panePidRaw),
243
249
  sessionName,
244
250
  runtimePaneId,
@@ -431,3 +437,27 @@ export function decodeControlReplyUtf8(value: string): string | null {
431
437
  function positiveInteger(value: number | undefined, fallback: number): number {
432
438
  return Number.isSafeInteger(value) && value! > 0 ? value! : fallback;
433
439
  }
440
+
441
+ /**
442
+ * #718: a pane runs a terminal browser with tmux-ide's native controls while
443
+ * the browser that published @tmux_ide_browser_control is alive: the browser
444
+ * never clears the option, so a pane that outlives it (remain-on-exit,
445
+ * respawn-pane) is judged by what runs there now. A plain terminal browser
446
+ * is known by its process name (tmux cuts it to 15 characters on macOS).
447
+ */
448
+ export function terminalBrowserKind(
449
+ control: string,
450
+ currentCommand: string,
451
+ alive: (pid: number) => boolean = processAlive,
452
+ ): "native" | "plain" | null {
453
+ if (control.length > 0 && control.length <= 4096) {
454
+ try {
455
+ const pid = (JSON.parse(control) as { pid?: unknown } | null)?.pid;
456
+ if (typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 && alive(pid))
457
+ return "native";
458
+ } catch {
459
+ // Not an endpoint: judged by the process name below.
460
+ }
461
+ }
462
+ return /^terminal-browser?$/u.test(currentCommand) ? "plain" : null;
463
+ }
@@ -2530,6 +2530,8 @@ class SessionRuntimeConsumerImpl implements SessionRuntimeConsumer {
2530
2530
  ack: (ack: TerminalDeliveryAck) => upstream.ack(ack),
2531
2531
  ...(upstream.projectionReceipt ? { projectionReceipt: upstream.projectionReceipt } : {}),
2532
2532
  ...(upstream.materialize ? { materialize: upstream.materialize } : {}),
2533
+ ...(upstream.historyRequest ? { historyRequest: upstream.historyRequest } : {}),
2534
+ ...(upstream.prioritize ? { prioritize: upstream.prioritize } : {}),
2533
2535
  nack: (nack: TerminalDeliveryNack) => upstream.nack(nack),
2534
2536
  setVisibility: (visibility: TerminalDeliveryVisibility) => upstream.setVisibility(visibility),
2535
2537
  close: async () => {