tmux-ide 2.9.23 → 2.9.25
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/bin/cli.js +1636 -385
- package/package.json +4 -2
- package/packages/contracts/src/pane-stream.ts +53 -0
- package/packages/daemon/dist/command-center/discovery.js +24 -5
- package/packages/daemon/dist/command-center/server.js +81 -75
- package/packages/daemon/dist/command-center/tmux-servers.js +11 -0
- package/packages/daemon/dist/doctor.js +46 -10
- package/packages/daemon/dist/lib/canonical-daemon-bootstrap.js +20 -2
- package/packages/daemon/dist/lib/daemon-crash-snapshot.js +118 -0
- package/packages/daemon/dist/lib/daemon-embed.js +22 -8
- package/packages/daemon/dist/lib/headless-daemon.js +63 -6
- package/packages/daemon/dist/lib/home-agent-observer.js +50 -0
- package/packages/daemon/dist/lib/invocation-directory.js +20 -0
- package/packages/daemon/dist/lib/machine-agents.js +18 -1
- package/packages/daemon/dist/lib/orphaned-control-clients.js +162 -0
- package/packages/daemon/dist/lib/runtime-namespace.js +22 -6
- package/packages/daemon/dist/lib/tmux-client-execution.js +12 -3
- package/packages/daemon/dist/lib/tmux-external-interaction-observer.js +32 -9
- package/packages/daemon/dist/lib/tmux-server-owner.js +26 -4
- package/packages/daemon/dist/lib/update-check.js +18 -0
- package/packages/daemon/dist/lib/update-daemon-outcome.js +31 -0
- package/packages/daemon/dist/lib/update.js +39 -14
- package/packages/daemon/dist/lib/workspace-promotion.js +24 -3
- 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/terminal/attachments/native-runtime.js +17 -2
- package/packages/daemon/dist/terminal/graphics/kitty-graphics.js +16 -4
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +26 -0
- package/packages/daemon/dist/terminal/mirror/session-channel.js +27 -2
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +749 -208
- package/packages/daemon/dist/terminal/session-runtime/registry.js +24 -2
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +77 -2
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +24 -2
- package/packages/daemon/dist/terminal/session-runtime/transport-binding.js +38 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +36 -1
- package/packages/daemon/dist/tui/chrome/statusline.js +8 -5
- package/packages/daemon/dist/tui/chrome/updater.js +2 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-navigation.js +57 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agents-owner.js +18 -7
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agent-navigation.js +17 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-navigation.js +4 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +55 -14
- package/packages/daemon/src/command-center/discovery.ts +24 -4
- package/packages/daemon/src/command-center/server.ts +67 -67
- package/packages/daemon/src/command-center/tmux-servers.ts +11 -0
- package/packages/daemon/src/doctor.ts +50 -9
- package/packages/daemon/src/lib/canonical-daemon-bootstrap.ts +31 -5
- package/packages/daemon/src/lib/daemon-crash-snapshot.ts +175 -0
- package/packages/daemon/src/lib/daemon-embed.ts +74 -7
- package/packages/daemon/src/lib/headless-daemon.ts +88 -7
- package/packages/daemon/src/lib/home-agent-observer.ts +53 -0
- package/packages/daemon/src/lib/invocation-directory.ts +21 -0
- package/packages/daemon/src/lib/machine-agents.ts +25 -1
- package/packages/daemon/src/lib/orphaned-control-clients.ts +215 -0
- package/packages/daemon/src/lib/runtime-namespace.ts +25 -7
- package/packages/daemon/src/lib/tmux-client-execution.ts +14 -5
- package/packages/daemon/src/lib/tmux-external-interaction-observer.ts +32 -8
- package/packages/daemon/src/lib/tmux-server-owner.ts +28 -3
- package/packages/daemon/src/lib/update-check.ts +34 -0
- package/packages/daemon/src/lib/update-daemon-outcome.ts +42 -0
- package/packages/daemon/src/lib/update.ts +58 -16
- package/packages/daemon/src/lib/workspace-promotion.ts +26 -3
- package/packages/daemon/src/terminal/attachments/native-runtime.ts +21 -2
- package/packages/daemon/src/terminal/graphics/kitty-graphics.ts +22 -6
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +27 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +32 -2
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +819 -223
- package/packages/daemon/src/terminal/session-runtime/registry.ts +35 -2
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +74 -2
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +21 -1
- package/packages/daemon/src/terminal/session-runtime/transport-binding.ts +42 -2
- package/packages/daemon/src/tui/chrome/snapshot.ts +47 -1
- package/packages/daemon/src/tui/chrome/statusline.ts +7 -4
- package/packages/daemon/src/tui/chrome/updater.ts +3 -0
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-navigation.ts +69 -4
- package/packages/daemon/src/tui/mirror/runtime/application-home-agents-owner.ts +30 -13
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agent-navigation.ts +38 -1
- package/packages/daemon/src/tui/mirror/runtime/application-machine-navigation.ts +7 -2
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +4 -4
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +71 -17
- package/packages/daemon-client/src/pane-stream-client.ts +47 -5
|
@@ -11,11 +11,15 @@ import { dirname, join } from "node:path";
|
|
|
11
11
|
import { execFileSync } from "node:child_process";
|
|
12
12
|
import {
|
|
13
13
|
getCurrentVersion,
|
|
14
|
-
|
|
14
|
+
refreshUpdateStatus,
|
|
15
15
|
deriveStatus,
|
|
16
16
|
updateChannel,
|
|
17
|
+
type fetchLatestVersion,
|
|
17
18
|
type UpdateChannel,
|
|
19
|
+
type UpdateStatus,
|
|
20
|
+
type UpdateStatusSource,
|
|
18
21
|
} from "./update-check.ts";
|
|
22
|
+
import { IdeError } from "./errors.ts";
|
|
19
23
|
import {
|
|
20
24
|
installOrigin,
|
|
21
25
|
detectPackageManager,
|
|
@@ -99,14 +103,22 @@ export function planUpdate(input: {
|
|
|
99
103
|
}
|
|
100
104
|
export function renderPlan(
|
|
101
105
|
plan: UpdatePlan,
|
|
102
|
-
{
|
|
106
|
+
{
|
|
107
|
+
current,
|
|
108
|
+
latest,
|
|
109
|
+
dryRun,
|
|
110
|
+
source = "registry",
|
|
111
|
+
}: { current: string; latest: string | null; dryRun: boolean; source?: UpdateStatusSource },
|
|
103
112
|
): string {
|
|
113
|
+
// "Up to date" is the registry's word only; a cached answer can be weeks old.
|
|
104
114
|
const status =
|
|
105
115
|
latest && deriveStatus(latest, current).updateAvailable
|
|
106
116
|
? `tmux-ide v${current} → v${latest} available`
|
|
107
|
-
:
|
|
108
|
-
? `tmux-ide v${current}
|
|
109
|
-
:
|
|
117
|
+
: source === "cache"
|
|
118
|
+
? `tmux-ide v${current}: could not reach the npm registry (last known release: ${latest ? `v${latest}` : "unknown"})`
|
|
119
|
+
: latest
|
|
120
|
+
? `tmux-ide v${current} is up to date (registry: v${latest})`
|
|
121
|
+
: `tmux-ide v${current} (latest version unknown)`;
|
|
110
122
|
return [
|
|
111
123
|
status,
|
|
112
124
|
"",
|
|
@@ -118,21 +130,43 @@ export function renderPlan(
|
|
|
118
130
|
"After updating, relaunch the app. Use tmux-ide update --daemon to replace a running daemon with installed code.",
|
|
119
131
|
].join("\n");
|
|
120
132
|
}
|
|
133
|
+
/** The update command prints its own failure; ours is one line, never a stack trace. */
|
|
134
|
+
function updateFailure(what: string, error: unknown): IdeError {
|
|
135
|
+
const { status, signal, message } = error as { status?: unknown; signal?: unknown } & Error;
|
|
136
|
+
const how =
|
|
137
|
+
typeof status === "number"
|
|
138
|
+
? `exited with status ${status}`
|
|
139
|
+
: typeof signal === "string"
|
|
140
|
+
? `was stopped by ${signal}`
|
|
141
|
+
: `could not run (${String(message).split("\n")[0]})`;
|
|
142
|
+
return new IdeError(
|
|
143
|
+
`The update did not finish: ${what} ${how}. Its own message is above. Retry with: tmux-ide update`,
|
|
144
|
+
{ code: "UPDATE_FAILED", cause: error instanceof Error ? error : undefined },
|
|
145
|
+
);
|
|
146
|
+
}
|
|
121
147
|
/** Does not refresh skills: the installed package's postinstall owns that step. */
|
|
122
|
-
export function runUpdate(
|
|
148
|
+
export async function runUpdate(
|
|
123
149
|
{ cliDir, dryRun, json = false }: { cliDir: string; dryRun: boolean; json?: boolean },
|
|
124
150
|
dependencies: {
|
|
125
151
|
execute?: typeof execFileSync;
|
|
126
152
|
query?: (executable: string, args: string[]) => string;
|
|
127
153
|
currentVersion?: () => string;
|
|
128
|
-
status?:
|
|
154
|
+
status?: (scope: {
|
|
155
|
+
currentVersion: string;
|
|
156
|
+
}) =>
|
|
157
|
+
| (UpdateStatus & { source?: UpdateStatusSource })
|
|
158
|
+
| Promise<UpdateStatus & { source?: UpdateStatusSource }>;
|
|
159
|
+
fetchLatest?: typeof fetchLatestVersion;
|
|
129
160
|
output?: (line: string) => void;
|
|
130
161
|
} = {},
|
|
131
|
-
): UpdatePlan {
|
|
162
|
+
): Promise<UpdatePlan> {
|
|
132
163
|
if (resolveRuntimeNamespace().development)
|
|
133
164
|
throw new Error("Development instances rebuild exact artifacts; package updates are disabled");
|
|
134
165
|
const current = (dependencies.currentVersion ?? getCurrentVersion)();
|
|
135
|
-
const { latest
|
|
166
|
+
const { latest, source: latestSource = "registry" } = await (
|
|
167
|
+
dependencies.status ??
|
|
168
|
+
((scope) => refreshUpdateStatus({ ...scope, fetchLatest: dependencies.fetchLatest }))
|
|
169
|
+
)({ currentVersion: current });
|
|
136
170
|
const source = installOrigin(cliDir);
|
|
137
171
|
let plan: UpdatePlan =
|
|
138
172
|
source.origin === "unknown"
|
|
@@ -178,19 +212,27 @@ export function runUpdate(
|
|
|
178
212
|
}
|
|
179
213
|
}
|
|
180
214
|
const output = dependencies.output ?? console.log;
|
|
181
|
-
if (!json) output(renderPlan(plan, { current, latest, dryRun }));
|
|
215
|
+
if (!json) output(renderPlan(plan, { current, latest, dryRun, source: latestSource }));
|
|
182
216
|
let executed = false;
|
|
183
217
|
if (!dryRun && plan.executable && plan.args) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
218
|
+
try {
|
|
219
|
+
// argv only: paths and version metadata never become shell source.
|
|
220
|
+
(dependencies.execute ?? execFileSync)(plan.executable, plan.args, {
|
|
221
|
+
stdio: json ? ["ignore", 2, 2] : "inherit",
|
|
222
|
+
});
|
|
223
|
+
} catch (error) {
|
|
224
|
+
throw updateFailure([plan.executable, ...plan.args].join(" "), error);
|
|
225
|
+
}
|
|
188
226
|
executed = true;
|
|
189
227
|
}
|
|
190
228
|
if (!dryRun && plan.installerPrefix && plan.channel) {
|
|
191
|
-
|
|
229
|
+
try {
|
|
230
|
+
runManagedInstallerUpdate(plan.installerPrefix, plan.channel, json, dependencies.execute);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
throw updateFailure("the installer", error);
|
|
233
|
+
}
|
|
192
234
|
executed = true;
|
|
193
235
|
}
|
|
194
|
-
if (json) output(JSON.stringify({ ...plan, current, latest, dryRun, executed }));
|
|
236
|
+
if (json) output(JSON.stringify({ ...plan, current, latest, latestSource, dryRun, executed }));
|
|
195
237
|
return plan;
|
|
196
238
|
}
|
|
@@ -149,6 +149,12 @@ const ERROR_MESSAGES: Readonly<Record<WorkspacePromotionErrorCode, string>> = {
|
|
|
149
149
|
operation_capacity: "The daemon has reached its bounded workspace-promote operation capacity.",
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
+
/**
|
|
153
|
+
* How often a promotion stamps and proves a session whose pane inventory
|
|
154
|
+
* changed between the proof's two reads, before it refuses.
|
|
155
|
+
*/
|
|
156
|
+
export const PROMOTION_PROOF_ATTEMPTS = 3;
|
|
157
|
+
|
|
152
158
|
export class WorkspacePromotionError extends Error {
|
|
153
159
|
readonly code: WorkspacePromotionErrorCode;
|
|
154
160
|
readonly context: Readonly<Record<string, string>>;
|
|
@@ -594,9 +600,26 @@ export class WorkspacePromotionAuthority {
|
|
|
594
600
|
: derivePromotionIdentity(session.sessionName);
|
|
595
601
|
this.#assertConflictFreeIdentity(identity);
|
|
596
602
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
603
|
+
// Another tmux client may split or close a pane while the session is
|
|
604
|
+
// being proved (an agent does it all day). The proof then cannot hold:
|
|
605
|
+
// stamp what is there now and prove again, a bounded number of times.
|
|
606
|
+
let canonicalRoot!: string;
|
|
607
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
608
|
+
canonicalRoot = await this.#stampSession(request, session, identity);
|
|
609
|
+
this.#assertActive(request.operationId);
|
|
610
|
+
try {
|
|
611
|
+
await this.#verifyPromotedInventory(session.sessionId, identity);
|
|
612
|
+
break;
|
|
613
|
+
} catch (error) {
|
|
614
|
+
if (
|
|
615
|
+
attempt >= PROMOTION_PROOF_ATTEMPTS ||
|
|
616
|
+
!(error instanceof WorkspacePromotionError) ||
|
|
617
|
+
error.context.reason !== "inventory_changed_during_proof"
|
|
618
|
+
)
|
|
619
|
+
throw error;
|
|
620
|
+
this.#assertActive(request.operationId);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
600
623
|
await this.#publishFleetEnrollment(request, session, identity);
|
|
601
624
|
|
|
602
625
|
// Catalog discovery can admit this session while the native stamping
|
|
@@ -1628,6 +1628,25 @@ export class WorkspaceTerminalInventoryRuntime {
|
|
|
1628
1628
|
if (this.#disposed) throw new NativeTerminalAttachmentRuntimeError("runtime-disposed");
|
|
1629
1629
|
const epoch = this.#inventoryEpoch;
|
|
1630
1630
|
const nativeEpoch = this.#nativeServerEpoch?.() ?? null;
|
|
1631
|
+
// An invalidation can also land while the snapshot is being adopted. That
|
|
1632
|
+
// publication is refused, as before, and the inventory is read again: it
|
|
1633
|
+
// used to fail the caller, and at startup the caller is the daemon.
|
|
1634
|
+
const publish = async (
|
|
1635
|
+
value: NativeTerminalInventorySnapshot,
|
|
1636
|
+
publicationSignal: AbortSignal,
|
|
1637
|
+
): Promise<NativeTerminalInventorySnapshot> => {
|
|
1638
|
+
try {
|
|
1639
|
+
return await this.#publishInventory(value, nativeEpoch, publicationSignal, epoch);
|
|
1640
|
+
} catch (error) {
|
|
1641
|
+
if (this.#disposed || signal?.aborted || this.#inventoryEpoch === epoch) throw error;
|
|
1642
|
+
if (staleRetry < INVENTORY_STALE_RETRIES)
|
|
1643
|
+
return this.#readInventory(signal, staleRetry + 1);
|
|
1644
|
+
throw new NativeTerminalAttachmentRuntimeError(
|
|
1645
|
+
"discovery-failed",
|
|
1646
|
+
"overtaken-by-invalidations",
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1631
1650
|
if (signal) {
|
|
1632
1651
|
if (signal.aborted) throw new NativeTerminalAttachmentRuntimeError("runtime-disposed");
|
|
1633
1652
|
let snapshot: NativeTerminalInventorySnapshot;
|
|
@@ -1653,7 +1672,7 @@ export class WorkspaceTerminalInventoryRuntime {
|
|
|
1653
1672
|
"overtaken-by-invalidations",
|
|
1654
1673
|
);
|
|
1655
1674
|
}
|
|
1656
|
-
return
|
|
1675
|
+
return publish(snapshot, signal);
|
|
1657
1676
|
}
|
|
1658
1677
|
if (this.#inventoryRead?.epoch === epoch) return this.#inventoryRead.promise;
|
|
1659
1678
|
const abort = new AbortController();
|
|
@@ -1680,7 +1699,7 @@ export class WorkspaceTerminalInventoryRuntime {
|
|
|
1680
1699
|
"overtaken-by-invalidations",
|
|
1681
1700
|
);
|
|
1682
1701
|
}
|
|
1683
|
-
return
|
|
1702
|
+
return publish(value, abort.signal);
|
|
1684
1703
|
})().finally(() => {
|
|
1685
1704
|
if (this.#inventoryRead?.promise === promise) this.#inventoryRead = null;
|
|
1686
1705
|
});
|
|
@@ -367,18 +367,30 @@ export class KittyImageStore {
|
|
|
367
367
|
null;
|
|
368
368
|
#nextAnonymous = 0x7f000000;
|
|
369
369
|
#bytes = 0;
|
|
370
|
-
|
|
371
|
-
|
|
370
|
+
/** Cell size in thousandths of a device pixel. */
|
|
371
|
+
#cellWidth: number;
|
|
372
|
+
#cellHeight: number;
|
|
372
373
|
readonly #budget: KittyImageBudget;
|
|
373
374
|
#revision = 0;
|
|
374
375
|
|
|
375
376
|
constructor(options: KittyImageStoreOptions = {}) {
|
|
376
|
-
this.#cellWidth = options.cellWidthPx ?? 10;
|
|
377
|
-
this.#cellHeight = options.cellHeightPx ?? 20;
|
|
377
|
+
this.#cellWidth = (options.cellWidthPx ?? 10) * 1000;
|
|
378
|
+
this.#cellHeight = (options.cellHeightPx ?? 20) * 1000;
|
|
378
379
|
this.#budget = options.budget ?? DEFAULT_KITTY_IMAGE_BUDGET;
|
|
379
380
|
this.#budget.register(this);
|
|
380
381
|
}
|
|
381
382
|
|
|
383
|
+
/**
|
|
384
|
+
* The renderer's cell size in device pixels, with thousandths when it reports
|
|
385
|
+
* them (capability 103/104). Placements made from now on that give no `c`/`r`
|
|
386
|
+
* cover the image at this size; earlier ones keep their grid.
|
|
387
|
+
*/
|
|
388
|
+
setCellPixels(width: number, height: number, precise?: { width: number; height: number }): void {
|
|
389
|
+
if (!(width > 0 && height > 0)) return;
|
|
390
|
+
this.#cellWidth = precise && precise.width > 0 ? precise.width : width * 1000;
|
|
391
|
+
this.#cellHeight = precise && precise.height > 0 ? precise.height : height * 1000;
|
|
392
|
+
}
|
|
393
|
+
|
|
382
394
|
/** Bumps whenever images or placements change. */
|
|
383
395
|
get revision(): number {
|
|
384
396
|
return this.#revision;
|
|
@@ -511,8 +523,12 @@ export class KittyImageStore {
|
|
|
511
523
|
const image = this.#images.get(imageId);
|
|
512
524
|
if (!image) return;
|
|
513
525
|
this.#used.set(imageId, this.#budget.nextTick());
|
|
514
|
-
const columns = clampCells(
|
|
515
|
-
|
|
526
|
+
const columns = clampCells(
|
|
527
|
+
int(control, "c") || Math.ceil((image.width * 1000) / this.#cellWidth),
|
|
528
|
+
);
|
|
529
|
+
const rows = clampCells(
|
|
530
|
+
int(control, "r") || Math.ceil((image.height * 1000) / this.#cellHeight),
|
|
531
|
+
);
|
|
516
532
|
const placementId = int(control, "p");
|
|
517
533
|
if (control.get("U") === "1") {
|
|
518
534
|
const placements = this.#virtual.get(imageId) ?? new Map();
|
|
@@ -214,6 +214,28 @@ export class MirrorService {
|
|
|
214
214
|
wasPending: this.registeredWindows?.pending() ?? null,
|
|
215
215
|
});
|
|
216
216
|
this.registeredWindows?.invalidate();
|
|
217
|
+
this.scheduleOwnershipVerify();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Until a read proves ownership again, every retained session refuses input
|
|
222
|
+
* and geometry. A workspace added or removed (another session created or
|
|
223
|
+
* killed) invalidates without any channel resyncing, and nothing else read
|
|
224
|
+
* again until the next stream was issued: the next keystroke closed the
|
|
225
|
+
* stream. Read again at once (coalesced) while a channel is retained; a
|
|
226
|
+
* failed read takes the #764 retry path.
|
|
227
|
+
*/
|
|
228
|
+
private ownershipVerifyScheduled = false;
|
|
229
|
+
private scheduleOwnershipVerify(): void {
|
|
230
|
+
if (this.ownershipVerifyScheduled || this.disposed) return;
|
|
231
|
+
this.ownershipVerifyScheduled = true;
|
|
232
|
+
const timer = setTimeout(() => {
|
|
233
|
+
this.ownershipVerifyScheduled = false;
|
|
234
|
+
if (this.disposed || this.channelSessions.size === 0 || !this.registeredWindows?.pending())
|
|
235
|
+
return;
|
|
236
|
+
void this.verifyRegisteredWindows().catch(() => {});
|
|
237
|
+
}, 0);
|
|
238
|
+
timer.unref?.();
|
|
217
239
|
}
|
|
218
240
|
|
|
219
241
|
/**
|
|
@@ -633,6 +655,11 @@ export class MirrorService {
|
|
|
633
655
|
if (message) throw new Error(message);
|
|
634
656
|
}
|
|
635
657
|
|
|
658
|
+
/** Registered-window ownership is being read again; input waits for it. */
|
|
659
|
+
windowOwnershipPending(): boolean {
|
|
660
|
+
return this.registeredWindows?.pending() ?? false;
|
|
661
|
+
}
|
|
662
|
+
|
|
636
663
|
windowOwnershipMessage(session: string): string | null {
|
|
637
664
|
if (this.registeredWindows?.pending())
|
|
638
665
|
return "Window ownership is being verified. Retry after session discovery completes.";
|
|
@@ -1352,11 +1352,40 @@ export class SessionChannel {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
this.input.flush();
|
|
1354
1354
|
this.clearWindowViewports();
|
|
1355
|
-
this.
|
|
1355
|
+
const target = this.attachedIdentity?.runtimeSessionId ?? `=${this.opts.session}`;
|
|
1356
|
+
this.restoreWindowSizing(target);
|
|
1356
1357
|
this.io.send(`refresh-client -C ${cols}x${rows}${this.cellPixelSuffix()}`);
|
|
1358
|
+
this.reclaimWindowSize(target);
|
|
1357
1359
|
this.clientViewport = { cols, rows };
|
|
1358
1360
|
}
|
|
1359
1361
|
|
|
1362
|
+
/**
|
|
1363
|
+
* Under `window-size latest` a second tmux client on the session (a terminal
|
|
1364
|
+
* the user also attached) takes the window, and nothing this control client
|
|
1365
|
+
* sends makes it tmux's latest client again: input and refresh-client are not
|
|
1366
|
+
* client activity. Output then prints at the other client's width and tmux
|
|
1367
|
+
* re-wraps it mid-word when that width goes away (#695). A fit is the app
|
|
1368
|
+
* being used (it fits on focus and on a change of its canvas), so after one,
|
|
1369
|
+
* when the window is not this client's size, switch to the same session:
|
|
1370
|
+
* that makes this client the latest one. Only here, never on a timer or a
|
|
1371
|
+
* notification, so two clients never fight; whichever the user used last
|
|
1372
|
+
* wins, as between two terminals. Other window-size policies are the user's.
|
|
1373
|
+
*/
|
|
1374
|
+
private reclaimWindowSize(target: string): void {
|
|
1375
|
+
if (!this.geometryParticipating) return;
|
|
1376
|
+
const quoted = tmuxSingleQuote(target);
|
|
1377
|
+
// Two FIFO slots whichever branch runs, as in restoreWindowSizing.
|
|
1378
|
+
this.io.commandListInline(
|
|
1379
|
+
`if-shell -F -t ${quoted} '#{&&:#{==:#{window-size},latest},#{||:#{!=:#{window_width},#{client_width}},#{!=:#{window_height},#{client_height}}}}' ` +
|
|
1380
|
+
tmuxSingleQuote(`switch-client -t ${quoted}`) +
|
|
1381
|
+
" " +
|
|
1382
|
+
tmuxSingleQuote(`display-message -p -t ${quoted} ''`),
|
|
1383
|
+
2,
|
|
1384
|
+
1,
|
|
1385
|
+
() => {},
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1360
1389
|
private clientViewport: { cols: number; rows: number } | null = null;
|
|
1361
1390
|
private cellPixels: {
|
|
1362
1391
|
width: number;
|
|
@@ -3825,7 +3854,8 @@ export class SessionChannel {
|
|
|
3825
3854
|
!leftLayout ||
|
|
3826
3855
|
!rightLayout ||
|
|
3827
3856
|
leftWindow.semanticId !== rightWindow.semanticId ||
|
|
3828
|
-
|
|
3857
|
+
// Not the name: tmux derives it from the running command, and the
|
|
3858
|
+
// pane rows' own check ignores it too (sameSessionPaneInventory, #730).
|
|
3829
3859
|
leftWindow.paneBorderStatus !== rightWindow.paneBorderStatus ||
|
|
3830
3860
|
leftWindow.modeKeys !== rightWindow.modeKeys ||
|
|
3831
3861
|
!layoutIdentitiesEqual(leftLayout, rightLayout)
|