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.
- package/README.md +1 -1
- package/bin/cli.js +1577 -559
- package/package.json +3 -2
- package/packages/contracts/src/pane-stream.ts +28 -0
- package/packages/contracts/src/terminal-delivery.ts +122 -5
- package/packages/contracts/src/terminal-runtime-inventory.ts +61 -1
- package/packages/contracts/src/tmux-server-scope.ts +18 -0
- package/packages/core/src/index.ts +1 -0
- package/packages/core/src/terminal-delivery-binary.ts +8 -7
- package/packages/core/src/terminal-delivery.ts +174 -3
- package/packages/core/src/terminal-partial-history.ts +152 -0
- package/packages/core/src/terminal-replica.ts +70 -1
- package/packages/daemon/dist/command-center/owner-keep-alive.js +30 -0
- package/packages/daemon/dist/command-center/resources/terminal-runtime-inventory.js +42 -2
- package/packages/daemon/dist/command-center/server.js +3 -0
- package/packages/daemon/dist/command-center/tmux-server-attach.js +51 -0
- package/packages/daemon/dist/command-center/tmux-servers.js +95 -7
- package/packages/daemon/dist/doctor.js +4 -4
- package/packages/daemon/dist/lib/app-config.js +7 -0
- package/packages/daemon/dist/lib/node-requirement.js +20 -0
- package/packages/daemon/dist/lib/require-supported-node.js +8 -0
- package/packages/daemon/dist/lib/tmux-server-owner.js +4 -2
- package/packages/daemon/dist/lib/tmux-server-session-open.js +38 -12
- package/packages/daemon/dist/lib/workspace-promotion.js +4 -4
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +2 -2
- package/packages/daemon/dist/server/pane-stream-upgrade.js +39 -1
- package/packages/daemon/dist/terminal/mirror/session-channel.js +6 -1
- package/packages/daemon/dist/terminal/pane-stream/lease-manager.js +1 -0
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +112 -22
- package/packages/daemon/dist/terminal/protocol/browser-icon.js +1 -1
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +26 -3
- package/packages/daemon/dist/terminal/session-runtime/registry.js +2 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-delivery-hub.js +571 -33
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +2 -0
- package/packages/daemon/dist/terminal/session-runtime/xterm-terminal-interpreter-backend.js +51 -4
- package/packages/daemon/dist/tui/mirror/open-tui-workspace-runtime-port.js +76 -2
- package/packages/daemon/dist/tui/mirror/theme.js +8 -1
- package/packages/daemon/src/command-center/attach-window-rule.cases.json +84 -0
- package/packages/daemon/src/command-center/owner-keep-alive.ts +38 -0
- package/packages/daemon/src/command-center/resources/terminal-runtime-inventory.ts +48 -1
- package/packages/daemon/src/command-center/server.ts +3 -0
- package/packages/daemon/src/command-center/tmux-server-attach.ts +75 -0
- package/packages/daemon/src/command-center/tmux-servers.ts +103 -6
- package/packages/daemon/src/doctor.ts +4 -4
- package/packages/daemon/src/lib/app-config.ts +15 -0
- package/packages/daemon/src/lib/node-requirement.ts +22 -0
- package/packages/daemon/src/lib/require-supported-node.ts +9 -0
- package/packages/daemon/src/lib/tmux-server-owner.ts +6 -3
- package/packages/daemon/src/lib/tmux-server-session-open.ts +53 -15
- package/packages/daemon/src/lib/workspace-promotion.ts +4 -4
- package/packages/daemon/src/server/pane-stream-upgrade.ts +41 -1
- package/packages/daemon/src/terminal/mirror/events.ts +2 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +8 -1
- package/packages/daemon/src/terminal/pane-stream/lease-manager.ts +3 -0
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +136 -20
- package/packages/daemon/src/terminal/protocol/browser-icon.ts +1 -1
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +32 -2
- package/packages/daemon/src/terminal/session-runtime/registry.ts +2 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-delivery-hub.ts +696 -30
- package/packages/daemon/src/terminal/session-runtime/terminal-interpreter-backend.ts +6 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +2 -0
- package/packages/daemon/src/terminal/session-runtime/xterm-terminal-interpreter-backend.ts +67 -3
- package/packages/daemon/src/tui/mirror/open-tui-workspace-runtime-port.ts +82 -2
- package/packages/daemon/src/tui/mirror/theme.ts +13 -1
|
@@ -2,7 +2,7 @@ import { TERMINAL_SURFACE_MAX_CONTROL_BYTES, TERMINAL_SURFACE_CAPABILITY_VERSION
|
|
|
2
2
|
import { NativeSurfaceViewer } from "../graphics/native-surface-viewer.js";
|
|
3
3
|
import { compressGraphicsChunk } from "../graphics/compress-chunk.js";
|
|
4
4
|
import { TERMINAL_GRAPHICS_COMPRESSED_CAPABILITY_VERSION, TERMINAL_GRAPHICS_COMPRESSED_LOCAL_CAPABILITY_VERSION, TERMINAL_PROJECTION_CAPABILITY_VERSION, TERMINAL_PROJECTION_LOCAL_CAPABILITY_VERSION, } from "@tmux-ide/contracts";
|
|
5
|
-
import { PANE_STREAM_INPUT_LIFETIME_CAPABILITY_VERSION, PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION, PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION, PANE_STREAM_READER_CAPABILITY_VERSION, PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION, PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION, } from "@tmux-ide/contracts";
|
|
5
|
+
import { PANE_STREAM_INPUT_LIFETIME_CAPABILITY_VERSION, PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION, PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION, PANE_STREAM_READER_CAPABILITY_VERSION, PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION, PANE_STREAM_READER_TOPOLOGY_BUNDLE_CAPABILITY_VERSION, PANE_STREAM_TOPOLOGY_IN_PLACE_CAPABILITY_VERSION, } from "@tmux-ide/contracts";
|
|
6
6
|
import { inflateSync } from "node:zlib";
|
|
7
7
|
import { PaneStreamLayoutSnapshotFrameSchemaZ } from "@tmux-ide/contracts";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -259,6 +259,16 @@ export class PaneStreamAdmissionCoordinator {
|
|
|
259
259
|
throw new PaneStreamAdmissionError("pane-not-found", `The pane ${pane} is not present in the workspace session.`);
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
+
// #806: a stream for one window is issued for exactly that window's
|
|
263
|
+
// panes, as the trusted inventory places them now.
|
|
264
|
+
if (request.semanticWindowId !== undefined) {
|
|
265
|
+
const windowPanes = new Set(described.panes
|
|
266
|
+
.filter((pane) => pane.semanticWindowId === request.semanticWindowId)
|
|
267
|
+
.map((pane) => pane.semanticPaneId));
|
|
268
|
+
if (windowPanes.size !== request.panes.length ||
|
|
269
|
+
request.panes.some((pane) => !windowPanes.has(pane)))
|
|
270
|
+
throw new PaneStreamAdmissionError("pane-not-found", "The panes are not exactly the panes of that window of the workspace session.");
|
|
271
|
+
}
|
|
262
272
|
const issued = await this.#leaseManager.issue(request, {
|
|
263
273
|
requestId,
|
|
264
274
|
projectIdentity,
|
|
@@ -585,6 +595,9 @@ class PreAuthAdmission {
|
|
|
585
595
|
cancelBeforeBind() {
|
|
586
596
|
this.close(1008, "upgrade-rejected");
|
|
587
597
|
}
|
|
598
|
+
redeemFromUpgrade(frame) {
|
|
599
|
+
this.#onMessage(frame, false);
|
|
600
|
+
}
|
|
588
601
|
promote() {
|
|
589
602
|
if (!this.#open)
|
|
590
603
|
return;
|
|
@@ -1063,7 +1076,7 @@ export class PaneStreamLiveConnection {
|
|
|
1063
1076
|
* stream with 1011, and nothing was tried twice. A refusal of authority is a
|
|
1064
1077
|
* decision, not a failure, and is never repeated. Each repeat is logged.
|
|
1065
1078
|
*/
|
|
1066
|
-
async #retryOpenStep(step, run) {
|
|
1079
|
+
async #retryOpenStep(step, run, final = () => false) {
|
|
1067
1080
|
for (let attempt = 0;; attempt += 1) {
|
|
1068
1081
|
try {
|
|
1069
1082
|
return await run();
|
|
@@ -1072,7 +1085,8 @@ export class PaneStreamLiveConnection {
|
|
|
1072
1085
|
const delayMs = this.#openRetryDelaysMs[attempt];
|
|
1073
1086
|
if (delayMs === undefined ||
|
|
1074
1087
|
this.#closed ||
|
|
1075
|
-
error instanceof SessionRuntimeControllerLeaseError
|
|
1088
|
+
error instanceof SessionRuntimeControllerLeaseError ||
|
|
1089
|
+
final(error))
|
|
1076
1090
|
throw error;
|
|
1077
1091
|
logger.info("pane-stream", "stream open step failed; trying again", {
|
|
1078
1092
|
session: this.#descriptor.sessionName,
|
|
@@ -1108,25 +1122,40 @@ export class PaneStreamLiveConnection {
|
|
|
1108
1122
|
let stagedAuthority = null;
|
|
1109
1123
|
let authorityMalformed = false;
|
|
1110
1124
|
let layoutActivated = false;
|
|
1125
|
+
let layoutAttempt = 0;
|
|
1111
1126
|
// Establish the single session layout observer first. MirrorService owns
|
|
1112
1127
|
// this lifecycle and may share native control state with delivery setup;
|
|
1113
1128
|
// only the independent pane delivery opens below are parallelized.
|
|
1114
1129
|
try {
|
|
1115
|
-
|
|
1130
|
+
const subscribeLayout = this.#mirror.subscribeLayout?.bind(this.#mirror);
|
|
1131
|
+
if (!subscribeLayout)
|
|
1116
1132
|
throw new Error("authoritative layout is unavailable");
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1133
|
+
// The session's trusted inventory can be unsettled for a moment after a
|
|
1134
|
+
// pane change ("lacks verified identity"): a stream re-issued at once
|
|
1135
|
+
// closed 1011 while the next, 100 ms later, opened. Try again, as the
|
|
1136
|
+
// other opening steps do (#585). A changed pane set is a decision, not
|
|
1137
|
+
// a failure, and still closes 1012 at once. A try that failed is
|
|
1138
|
+
// disowned: its authority callback is ignored.
|
|
1139
|
+
const subscription = await this.#retryOpenStep("semantic-layout-subscribe", () => {
|
|
1140
|
+
const attempt = ++layoutAttempt;
|
|
1141
|
+
stagedAuthority = null;
|
|
1142
|
+
authorityMalformed = false;
|
|
1143
|
+
return subscribeLayout(this.#descriptor.sessionName, () => undefined, {
|
|
1144
|
+
expectedSemanticPaneIds: expectedPaneIds,
|
|
1145
|
+
expectedRuntimeSessionId: this.#descriptor.runtimeSessionId,
|
|
1146
|
+
onAuthority: (snapshot) => {
|
|
1147
|
+
if (attempt !== layoutAttempt)
|
|
1148
|
+
return;
|
|
1149
|
+
this.#recordDiagnosticLifecycle("pane-stream-layout-staged");
|
|
1150
|
+
if (snapshot.layouts.length > PANE_STREAM_MAX_PANES)
|
|
1151
|
+
authorityMalformed = true;
|
|
1152
|
+
else if (!layoutActivated)
|
|
1153
|
+
stagedAuthority = snapshot;
|
|
1154
|
+
else
|
|
1155
|
+
this.#onLayoutAuthority(snapshot);
|
|
1156
|
+
},
|
|
1157
|
+
});
|
|
1158
|
+
}, (error) => error instanceof Error && error.name === "MirrorTopologyChangedError");
|
|
1130
1159
|
if (this.#closed) {
|
|
1131
1160
|
await subscription.close().catch(() => undefined);
|
|
1132
1161
|
return;
|
|
@@ -1920,13 +1949,17 @@ export class PaneStreamLiveConnection {
|
|
|
1920
1949
|
return;
|
|
1921
1950
|
}
|
|
1922
1951
|
const frames = this.#validateInitialLayout(snapshot.layouts, this.#semanticExpectedPaneIds);
|
|
1923
|
-
|
|
1952
|
+
// #806: a pane can also move between windows while the session keeps its
|
|
1953
|
+
// panes; for a stream of one window that changes its pane set.
|
|
1954
|
+
const windowChanged = frames !== null && this.#windowPaneSetChanged(snapshot);
|
|
1955
|
+
if ((!frames || windowChanged) && this.#topologyInPlace) {
|
|
1924
1956
|
// The layout does not fit the pane set this stream knows. With
|
|
1925
1957
|
// capability 119 that is a change to follow, not a reason to close.
|
|
1926
1958
|
void this.#reconcileTopology(snapshot);
|
|
1927
1959
|
return;
|
|
1928
1960
|
}
|
|
1929
1961
|
if (!frames ||
|
|
1962
|
+
windowChanged ||
|
|
1930
1963
|
!PaneStreamLayoutSnapshotFrameSchemaZ.safeParse({
|
|
1931
1964
|
type: "layout-snapshot",
|
|
1932
1965
|
topologyEpoch: snapshot.topologyEpoch,
|
|
@@ -1952,6 +1985,22 @@ export class PaneStreamLiveConnection {
|
|
|
1952
1985
|
windowLinks: snapshot.windowLinks,
|
|
1953
1986
|
});
|
|
1954
1987
|
}
|
|
1988
|
+
/** #806: the layout no longer shows this stream's window with exactly its panes. */
|
|
1989
|
+
#windowPaneSetChanged(snapshot) {
|
|
1990
|
+
const window = this.#descriptor.semanticWindowId;
|
|
1991
|
+
if (window === null)
|
|
1992
|
+
return false;
|
|
1993
|
+
const live = [...this.#panes.values()]
|
|
1994
|
+
.filter((channel) => !channel.closed)
|
|
1995
|
+
.map((channel) => channel.semanticPaneId);
|
|
1996
|
+
const shown = snapshot.layouts.find((event) => event.semanticWindowId === window);
|
|
1997
|
+
if (!shown)
|
|
1998
|
+
return true;
|
|
1999
|
+
const panes = shown.panes.map((pane) => pane.semanticPaneId ?? "");
|
|
2000
|
+
if (shown.zoomed)
|
|
2001
|
+
return panes.length !== 1 || !live.includes(panes[0]);
|
|
2002
|
+
return panes.length !== live.length || panes.some((pane) => !live.includes(pane));
|
|
2003
|
+
}
|
|
1955
2004
|
/** The same session and runtime, a newer epoch, a layout a stream can carry. */
|
|
1956
2005
|
#layoutAuthorityAdmissible(snapshot) {
|
|
1957
2006
|
return (snapshot.session === this.#descriptor.sessionName &&
|
|
@@ -2074,12 +2123,37 @@ export class PaneStreamLiveConnection {
|
|
|
2074
2123
|
windowLinks: snapshot.windowLinks,
|
|
2075
2124
|
}).success)
|
|
2076
2125
|
return this.#topologyFailed("layout snapshot invalid");
|
|
2126
|
+
// #806: a stream issued for one window follows that window's panes, as the
|
|
2127
|
+
// trusted inventory places them, and the same layout must show that window
|
|
2128
|
+
// with exactly those panes (a zoomed window shows one of them).
|
|
2129
|
+
const window = this.#descriptor.semanticWindowId;
|
|
2130
|
+
let windowPanes = null;
|
|
2131
|
+
if (window !== null) {
|
|
2132
|
+
windowPanes = [
|
|
2133
|
+
...new Set(described.panes
|
|
2134
|
+
.filter((pane) => pane.semanticWindowId === window)
|
|
2135
|
+
.map((pane) => pane.semanticPaneId)),
|
|
2136
|
+
].sort();
|
|
2137
|
+
if (windowPanes.length === 0)
|
|
2138
|
+
return this.#topologyFailed("the stream's window is gone");
|
|
2139
|
+
const shown = snapshot.layouts.find((event) => event.semanticWindowId === window);
|
|
2140
|
+
const shownPanes = (shown?.panes ?? []).map((pane) => pane.semanticPaneId ?? "");
|
|
2141
|
+
if (!shown ||
|
|
2142
|
+
(shown.zoomed
|
|
2143
|
+
? shownPanes.length !== 1 || !windowPanes.includes(shownPanes[0])
|
|
2144
|
+
: shownPanes.length !== windowPanes.length ||
|
|
2145
|
+
shownPanes.some((pane) => !windowPanes.includes(pane))))
|
|
2146
|
+
return "stale";
|
|
2147
|
+
}
|
|
2148
|
+
const followed = windowPanes ?? next;
|
|
2077
2149
|
const live = [...this.#panes.values()].filter((channel) => !channel.closed);
|
|
2078
|
-
const removed = live.filter((channel) => !
|
|
2079
|
-
// A stream issued for the whole session follows it
|
|
2080
|
-
// panes keeps exactly those.
|
|
2150
|
+
const removed = live.filter((channel) => !followed.includes(channel.semanticPaneId));
|
|
2151
|
+
// A stream issued for the whole session follows it, and one issued for a
|
|
2152
|
+
// window follows that window; one issued for some panes keeps exactly those.
|
|
2081
2153
|
const liveIds = new Set(live.map((channel) => channel.semanticPaneId));
|
|
2082
|
-
const added =
|
|
2154
|
+
const added = windowPanes !== null || this.#leasesWholeSession
|
|
2155
|
+
? followed.filter((pane) => !liveIds.has(pane))
|
|
2156
|
+
: [];
|
|
2083
2157
|
if (added.length > 0 && !inventoryIsThisSession)
|
|
2084
2158
|
return this.#topologyFailed("inventory cannot prove the runtime session");
|
|
2085
2159
|
const remaining = live.length - removed.length + added.length;
|
|
@@ -2245,6 +2319,9 @@ export class PaneStreamLiveConnection {
|
|
|
2245
2319
|
...(this.#offers(PANE_STREAM_READER_CAPABILITY_VERSION)
|
|
2246
2320
|
? { reader: pane.reader ? { name: pane.reader.name } : null }
|
|
2247
2321
|
: {}),
|
|
2322
|
+
...(this.#offers(PANE_STREAM_BROWSER_KIND_CAPABILITY_VERSION)
|
|
2323
|
+
? { browserKind: pane.browserKind ?? null }
|
|
2324
|
+
: {}),
|
|
2248
2325
|
left: pane.left,
|
|
2249
2326
|
top: pane.top,
|
|
2250
2327
|
width: pane.width,
|
|
@@ -2594,6 +2671,17 @@ export class PaneStreamLiveConnection {
|
|
|
2594
2671
|
channel.delivery.projectionReceipt(frame.receipt);
|
|
2595
2672
|
return;
|
|
2596
2673
|
}
|
|
2674
|
+
if (frame.type === "terminal-delivery-history-request") {
|
|
2675
|
+
const channel = this.#deliveryChannel(frame.request);
|
|
2676
|
+
if (!channel)
|
|
2677
|
+
return;
|
|
2678
|
+
if (!channel.delivery?.historyRequest ||
|
|
2679
|
+
!channel.delivery.negotiation.accepted ||
|
|
2680
|
+
channel.delivery.negotiation.negotiated.partialHistory !== "tail-v1")
|
|
2681
|
+
return this.#failProtocol("protocol-error");
|
|
2682
|
+
channel.delivery.historyRequest(frame.request);
|
|
2683
|
+
return;
|
|
2684
|
+
}
|
|
2597
2685
|
if (frame.type === "terminal-projection-materialize") {
|
|
2598
2686
|
const channel = this.#deliveryChannel(frame.request);
|
|
2599
2687
|
if (!channel)
|
|
@@ -3097,6 +3185,8 @@ export class PaneStreamLiveConnection {
|
|
|
3097
3185
|
channel.sub.sendKey(data);
|
|
3098
3186
|
else
|
|
3099
3187
|
throw new Error("Byte input requires semantic runtime");
|
|
3188
|
+
// Its echo goes ahead of the connection's other panes (remote links).
|
|
3189
|
+
channel.delivery?.prioritize?.();
|
|
3100
3190
|
let ackStartedAtMicros = null;
|
|
3101
3191
|
let ackStartedAtSharedMicros = null;
|
|
3102
3192
|
if (trace) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { browserIcon } from "./browser-icon.js";
|
|
1
|
+
import { browserIcon, processAlive } from "./browser-icon.js";
|
|
2
2
|
import { readerOption } from "./reader-option.js";
|
|
3
3
|
/**
|
|
4
4
|
* `qa` asks tmux to escape each value as a command argument. In particular,
|
|
@@ -33,6 +33,8 @@ export const SESSION_PANE_DESCRIPTOR_FORMAT = [
|
|
|
33
33
|
"#{qa:@tmux_ide_reader}",
|
|
34
34
|
// The reader option belongs to the pane only when its own process set it.
|
|
35
35
|
"#{pane_pid}",
|
|
36
|
+
// Set only by a terminal browser that has tmux-ide's native controls (#718).
|
|
37
|
+
"#{qa:@tmux_ide_browser_control}",
|
|
36
38
|
].join("\t");
|
|
37
39
|
/**
|
|
38
40
|
* Descriptor fields the program in a pane changes whenever it likes: its
|
|
@@ -129,9 +131,9 @@ export function parseSessionPaneDescriptorReply(lines) {
|
|
|
129
131
|
continue;
|
|
130
132
|
}
|
|
131
133
|
const encoded = utf8Line.split("\t");
|
|
132
|
-
if (encoded.length < 21 || encoded.length >
|
|
134
|
+
if (encoded.length < 21 || encoded.length > 26)
|
|
133
135
|
continue;
|
|
134
|
-
const [runtimePaneId = "", semanticPaneId = "", role = "", type = "", currentCommand = "", cwd = "", windowIndexRaw = "", windowName = "", windowId = "", title = "", runtimeSessionId = "", paneIndexRaw = "", name = "", missionStamp = "", paneActiveRaw = "", windowActiveRaw = "", semanticWindowId = "", sessionName = "", windowPaneCountRaw = "", sessionWindowCountRaw = "", nativePaneBirthId = "", nameSource = "", browserIconRaw = "", readerRaw = "", panePidRaw = "",] = encoded.map(decodeTmuxArgument);
|
|
136
|
+
const [runtimePaneId = "", semanticPaneId = "", role = "", type = "", currentCommand = "", cwd = "", windowIndexRaw = "", windowName = "", windowId = "", title = "", runtimeSessionId = "", paneIndexRaw = "", name = "", missionStamp = "", paneActiveRaw = "", windowActiveRaw = "", semanticWindowId = "", sessionName = "", windowPaneCountRaw = "", sessionWindowCountRaw = "", nativePaneBirthId = "", nameSource = "", browserIconRaw = "", readerRaw = "", panePidRaw = "", browserControl = "",] = encoded.map(decodeTmuxArgument);
|
|
135
137
|
if (!/^%(?:0|[1-9][0-9]*)$/u.test(runtimePaneId) || runtimePaneId.length > 32)
|
|
136
138
|
continue;
|
|
137
139
|
if (!/^\$(?:0|[1-9][0-9]*)$/u.test(runtimeSessionId) || runtimeSessionId.length > 32)
|
|
@@ -169,6 +171,7 @@ export function parseSessionPaneDescriptorReply(lines) {
|
|
|
169
171
|
}
|
|
170
172
|
descriptors.push({
|
|
171
173
|
browserIcon: browserIcon(browserIconRaw),
|
|
174
|
+
browserKind: terminalBrowserKind(browserControl, currentCommand),
|
|
172
175
|
reader: readerOption(readerRaw, panePidRaw),
|
|
173
176
|
sessionName,
|
|
174
177
|
runtimePaneId,
|
|
@@ -325,3 +328,23 @@ export function decodeControlReplyUtf8(value) {
|
|
|
325
328
|
function positiveInteger(value, fallback) {
|
|
326
329
|
return Number.isSafeInteger(value) && value > 0 ? value : fallback;
|
|
327
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* #718: a pane runs a terminal browser with tmux-ide's native controls while
|
|
333
|
+
* the browser that published @tmux_ide_browser_control is alive: the browser
|
|
334
|
+
* never clears the option, so a pane that outlives it (remain-on-exit,
|
|
335
|
+
* respawn-pane) is judged by what runs there now. A plain terminal browser
|
|
336
|
+
* is known by its process name (tmux cuts it to 15 characters on macOS).
|
|
337
|
+
*/
|
|
338
|
+
export function terminalBrowserKind(control, currentCommand, alive = processAlive) {
|
|
339
|
+
if (control.length > 0 && control.length <= 4096) {
|
|
340
|
+
try {
|
|
341
|
+
const pid = JSON.parse(control)?.pid;
|
|
342
|
+
if (typeof pid === "number" && Number.isSafeInteger(pid) && pid > 0 && alive(pid))
|
|
343
|
+
return "native";
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
// Not an endpoint: judged by the process name below.
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return /^terminal-browser?$/u.test(currentCommand) ? "plain" : null;
|
|
350
|
+
}
|
|
@@ -1694,6 +1694,8 @@ class SessionRuntimeConsumerImpl {
|
|
|
1694
1694
|
ack: (ack) => upstream.ack(ack),
|
|
1695
1695
|
...(upstream.projectionReceipt ? { projectionReceipt: upstream.projectionReceipt } : {}),
|
|
1696
1696
|
...(upstream.materialize ? { materialize: upstream.materialize } : {}),
|
|
1697
|
+
...(upstream.historyRequest ? { historyRequest: upstream.historyRequest } : {}),
|
|
1698
|
+
...(upstream.prioritize ? { prioritize: upstream.prioritize } : {}),
|
|
1697
1699
|
nack: (nack) => upstream.nack(nack),
|
|
1698
1700
|
setVisibility: (visibility) => upstream.setVisibility(visibility),
|
|
1699
1701
|
close: async () => {
|