tmux-ide 2.9.22 → 2.9.24
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 +3718 -7603
- package/package.json +3 -3
- package/packages/contracts/src/index.ts +1 -0
- package/packages/contracts/src/websocket-heartbeat.ts +41 -0
- package/packages/daemon/dist/command-center/automation.js +1 -1
- package/packages/daemon/dist/command-center/daemon-fleet-facts-observer.js +37 -5
- package/packages/daemon/dist/command-center/discovery.js +28 -2
- package/packages/daemon/dist/command-center/server.js +8 -2
- package/packages/daemon/dist/command-center/tmux-servers.js +12 -1
- package/packages/daemon/dist/doctor.js +41 -0
- package/packages/daemon/dist/lib/bounded-tmux-read.js +34 -12
- package/packages/daemon/dist/lib/daemon-embed.js +127 -63
- package/packages/daemon/dist/lib/daemon-stop-progress.js +58 -0
- package/packages/daemon/dist/lib/embedded-daemon-lifecycle.js +11 -0
- package/packages/daemon/dist/lib/embedded-tmux-server-owners.js +88 -12
- package/packages/daemon/dist/lib/headless-daemon.js +177 -10
- package/packages/daemon/dist/lib/home-agent-observer.js +50 -0
- package/packages/daemon/dist/lib/log.js +18 -1
- 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/tmux-external-interaction-observer.js +172 -28
- package/packages/daemon/dist/lib/tmux-native-browser.js +4 -2
- package/packages/daemon/dist/lib/tmux-pane-reader.js +4 -2
- package/packages/daemon/dist/lib/tmux-server-agent-admission.js +6 -1
- package/packages/daemon/dist/lib/tmux-server-owner-teardown.js +33 -0
- package/packages/daemon/dist/lib/tmux-server-owner.js +55 -41
- package/packages/daemon/dist/lib/tmux-server-owners.js +310 -20
- package/packages/daemon/dist/lib/tmux-server-registration.js +128 -9
- package/packages/daemon/dist/lib/unix-socket-authority.js +58 -3
- package/packages/daemon/dist/lib/workspace-pane-creation.js +10 -1
- 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/plugins/cli.js +1 -2
- package/packages/daemon/dist/server/pane-stream-upgrade.js +5 -1
- package/packages/daemon/dist/server/websocket-heartbeat.js +103 -0
- package/packages/daemon/dist/terminal/attachments/native-runtime.js +49 -16
- package/packages/daemon/dist/terminal/mirror/layout-content-rows.js +11 -0
- package/packages/daemon/dist/terminal/mirror/mirror-service.js +61 -3
- package/packages/daemon/dist/terminal/mirror/session-channel.js +11 -12
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +119 -22
- package/packages/daemon/dist/terminal/pane-stream/runtime.js +3 -2
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +23 -0
- package/packages/daemon/dist/terminal/protocol/stock-split-resize.js +4 -1
- package/packages/daemon/dist/terminal/session-runtime/registry.js +17 -0
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-interpreter.js +81 -3
- package/packages/daemon/dist/terminal/session-runtime/terminal-replica-owner.js +60 -3
- 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/automation.ts +1 -1
- package/packages/daemon/src/command-center/daemon-fleet-facts-observer.ts +49 -8
- package/packages/daemon/src/command-center/discovery.ts +35 -2
- package/packages/daemon/src/command-center/server.ts +22 -8
- package/packages/daemon/src/command-center/tmux-servers.ts +12 -1
- package/packages/daemon/src/doctor.ts +46 -0
- package/packages/daemon/src/lib/bounded-tmux-read.ts +29 -9
- package/packages/daemon/src/lib/daemon-embed.ts +211 -71
- package/packages/daemon/src/lib/daemon-stop-progress.ts +78 -0
- package/packages/daemon/src/lib/embedded-daemon-lifecycle.ts +12 -0
- package/packages/daemon/src/lib/embedded-tmux-server-owners.ts +115 -11
- package/packages/daemon/src/lib/headless-daemon.ts +205 -12
- package/packages/daemon/src/lib/home-agent-observer.ts +53 -0
- package/packages/daemon/src/lib/log.ts +18 -1
- 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/tmux-external-interaction-observer.ts +195 -33
- package/packages/daemon/src/lib/tmux-native-browser.ts +4 -3
- package/packages/daemon/src/lib/tmux-pane-reader.ts +4 -3
- package/packages/daemon/src/lib/tmux-server-agent-admission.ts +6 -1
- package/packages/daemon/src/lib/tmux-server-owner-teardown.ts +54 -0
- package/packages/daemon/src/lib/tmux-server-owner.ts +60 -38
- package/packages/daemon/src/lib/tmux-server-owners.ts +427 -22
- package/packages/daemon/src/lib/tmux-server-registration.ts +155 -7
- package/packages/daemon/src/lib/unix-socket-authority.ts +72 -3
- package/packages/daemon/src/lib/workspace-pane-creation.ts +11 -1
- package/packages/daemon/src/lib/workspace-promotion.ts +26 -3
- package/packages/daemon/src/plugins/cli.ts +1 -2
- package/packages/daemon/src/server/pane-stream-upgrade.ts +6 -0
- package/packages/daemon/src/server/websocket-heartbeat.ts +135 -0
- package/packages/daemon/src/terminal/attachments/native-runtime.ts +79 -16
- package/packages/daemon/src/terminal/mirror/layout-content-rows.ts +11 -0
- package/packages/daemon/src/terminal/mirror/mirror-service.ts +61 -2
- package/packages/daemon/src/terminal/mirror/session-channel.ts +11 -14
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +133 -21
- package/packages/daemon/src/terminal/pane-stream/runtime.ts +4 -2
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +31 -0
- package/packages/daemon/src/terminal/protocol/stock-split-resize.ts +6 -1
- package/packages/daemon/src/terminal/session-runtime/registry.ts +23 -0
- package/packages/daemon/src/terminal/session-runtime/runtime-observability.ts +2 -0
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-interpreter.ts +100 -3
- package/packages/daemon/src/terminal/session-runtime/terminal-replica-owner.ts +60 -3
- 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/direct-application-shell-transport.ts +21 -3
- package/packages/daemon-client/src/workspace-event-supervisor.ts +63 -2
|
@@ -42,6 +42,12 @@ export interface TerminalReplicaSubscription {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export type TerminalReplicaSourceSubscription = TerminalReplicaSubscription;
|
|
45
|
+
/**
|
|
46
|
+
* How long a pane may have no listener before it is parked (perf F2). Long
|
|
47
|
+
* enough that switching away and back stays warm.
|
|
48
|
+
*/
|
|
49
|
+
export const PARK_AFTER_MS = 10_000;
|
|
50
|
+
|
|
45
51
|
export interface TerminalReplicaCommittedRaw {
|
|
46
52
|
readonly baseRevision: number;
|
|
47
53
|
readonly revision: number;
|
|
@@ -103,6 +109,11 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
103
109
|
readonly #start: Promise<void>;
|
|
104
110
|
#upstream: MirrorSubscription | null = null;
|
|
105
111
|
#disposed = false;
|
|
112
|
+
#parkTimer: SessionRuntimeTimer | null = null;
|
|
113
|
+
#parked = false;
|
|
114
|
+
// From the park until the next reseed lands, the replica is older than tmux.
|
|
115
|
+
// Native backing and history anchors must not pair it with current tmux state.
|
|
116
|
+
#stale = false;
|
|
106
117
|
readonly #historyAnchors = new HistoryAnchorOwner();
|
|
107
118
|
#cols = 80;
|
|
108
119
|
#rows = 24;
|
|
@@ -243,13 +254,13 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
243
254
|
}
|
|
244
255
|
|
|
245
256
|
captureHistoryAnchor(proof: HistoryAnchorProof, historyIndex: number) {
|
|
246
|
-
if (this.#disposed || this.#reseed || this.#waitingForGeometryCapture)
|
|
257
|
+
if (this.#disposed || this.#stale || this.#reseed || this.#waitingForGeometryCapture)
|
|
247
258
|
return { status: "unavailable" as const };
|
|
248
259
|
return this.#historyAnchors.capture(proof, historyIndex);
|
|
249
260
|
}
|
|
250
261
|
|
|
251
262
|
resolveHistoryAnchor(proof: HistoryAnchorIdentity, token: string) {
|
|
252
|
-
if (this.#disposed || this.#reseed || this.#waitingForGeometryCapture)
|
|
263
|
+
if (this.#disposed || this.#stale || this.#reseed || this.#waitingForGeometryCapture)
|
|
253
264
|
return { status: "unavailable" as const };
|
|
254
265
|
return this.#historyAnchors.resolve(proof, token);
|
|
255
266
|
}
|
|
@@ -287,7 +298,8 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
287
298
|
const upstream = this.#upstream;
|
|
288
299
|
if (!upstream?.captureNativeBacking) return { status: "unsupported" };
|
|
289
300
|
const initial = this.#interpreter.currentSeed();
|
|
290
|
-
if (!initial || this.#reseed || this.#waitingForGeometryCapture)
|
|
301
|
+
if (!initial || this.#stale || this.#reseed || this.#waitingForGeometryCapture)
|
|
302
|
+
return { status: "changed" };
|
|
291
303
|
const epoch = this.#subscriptionEpoch;
|
|
292
304
|
const captured = await upstream.captureNativeBacking();
|
|
293
305
|
if (captured.status !== "captured") return captured;
|
|
@@ -298,6 +310,7 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
298
310
|
!this.#disposed &&
|
|
299
311
|
this.#upstream === upstream &&
|
|
300
312
|
this.#subscriptionEpoch === epoch &&
|
|
313
|
+
!this.#stale &&
|
|
301
314
|
!this.#reseed &&
|
|
302
315
|
!this.#waitingForGeometryCapture &&
|
|
303
316
|
captured.isCurrent() &&
|
|
@@ -362,6 +375,8 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
362
375
|
} catch {
|
|
363
376
|
// Bootstrap delivery has the same client-isolation rule as live frames.
|
|
364
377
|
}
|
|
378
|
+
// The last frame is out; now ask for the reseed that makes it current.
|
|
379
|
+
this.#unpark();
|
|
365
380
|
} catch (error) {
|
|
366
381
|
this.#listeners.delete(listener);
|
|
367
382
|
throw error;
|
|
@@ -374,10 +389,47 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
374
389
|
if (closed) return;
|
|
375
390
|
closed = true;
|
|
376
391
|
this.#listeners.delete(listener);
|
|
392
|
+
if (this.#listeners.size === 0) this.#schedulePark();
|
|
377
393
|
},
|
|
378
394
|
};
|
|
379
395
|
}
|
|
380
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Park this pane PARK_AFTER_MS after its last listener leaves (perf F2).
|
|
399
|
+
* The owner is the pane's only channel subscriber, so freezing it pauses the
|
|
400
|
+
* pane's output to the daemon's control client (the channel's all-frozen
|
|
401
|
+
* path). tmux keeps running the pane; nothing here is parsed or hashed. The
|
|
402
|
+
* last committed seed stays, so the next listener sees it at once, and
|
|
403
|
+
* thawing runs the channel's requested-pause recovery, which reseeds.
|
|
404
|
+
* Until that reseed lands the replica is stale: history anchors and native
|
|
405
|
+
* backing answer as they do during any reseed, and the reseed's reset then
|
|
406
|
+
* drops every anchor taken before the park.
|
|
407
|
+
*/
|
|
408
|
+
#schedulePark(): void {
|
|
409
|
+
if (this.#disposed || this.#parked) return;
|
|
410
|
+
this.#parkTimer?.cancel();
|
|
411
|
+
this.#parkTimer = this.#scheduler.timer(() => {
|
|
412
|
+
this.#parkTimer = null;
|
|
413
|
+
if (this.#disposed || this.#parked || this.#listeners.size > 0 || !this.#upstream) return;
|
|
414
|
+
this.#parked = true;
|
|
415
|
+
this.#stale = true;
|
|
416
|
+
this.#upstream.freeze();
|
|
417
|
+
}, PARK_AFTER_MS);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
#unpark(): void {
|
|
421
|
+
this.#parkTimer?.cancel();
|
|
422
|
+
this.#parkTimer = null;
|
|
423
|
+
if (!this.#parked) return;
|
|
424
|
+
this.#parked = false;
|
|
425
|
+
this.#upstream?.thaw();
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** True while the pane is parked (tests and qualification). */
|
|
429
|
+
get parked(): boolean {
|
|
430
|
+
return this.#parked;
|
|
431
|
+
}
|
|
432
|
+
|
|
381
433
|
/** Kitty graphics side channel: current state now (if any), then every change. */
|
|
382
434
|
subscribeGraphics(listener: (state: TerminalGraphicsState) => void): () => void {
|
|
383
435
|
const current = this.#interpreter.currentGraphics();
|
|
@@ -420,6 +472,8 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
420
472
|
this.#historyAnchors.invalidate();
|
|
421
473
|
this.#historyTimer?.cancel();
|
|
422
474
|
this.#historyTimer = null;
|
|
475
|
+
this.#parkTimer?.cancel();
|
|
476
|
+
this.#parkTimer = null;
|
|
423
477
|
this.#subscriptionEpoch += 1;
|
|
424
478
|
await this.#interpreter.enqueue({ type: "close", reason });
|
|
425
479
|
await this.#start.catch(() => undefined);
|
|
@@ -454,6 +508,7 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
454
508
|
// Output received during the probe makes its count incomparable with
|
|
455
509
|
// the newer parser state. The dirty flag schedules another check.
|
|
456
510
|
this.#historyDirty ||
|
|
511
|
+
this.#stale ||
|
|
457
512
|
this.#reseed ||
|
|
458
513
|
this.#waitingForGeometryCapture ||
|
|
459
514
|
size === null
|
|
@@ -511,6 +566,8 @@ export class SessionRuntimeTerminalReplicaOwner {
|
|
|
511
566
|
this.#waitingForGeometryCapture = false;
|
|
512
567
|
const reseed = this.#reseed;
|
|
513
568
|
this.#reseed = null;
|
|
569
|
+
// A completed capture after the park makes the replica current again.
|
|
570
|
+
if (reseed && !this.#parked) this.#stale = false;
|
|
514
571
|
const lease = reseed ? this.#qualifyReseed(reseed, event.x, event.y) : null;
|
|
515
572
|
this.#supervise(
|
|
516
573
|
reseed && lease
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HomeAgentRow } from "./application-home-agents.ts";
|
|
2
2
|
import type { ApplicationGenerationStartResult } from "./application-generation-starter.ts";
|
|
3
|
+
import type { AdmittedPaneSelectionOutcome } from "./application-terminal-interaction-controller.ts";
|
|
3
4
|
|
|
4
5
|
export type HomeAgentNavigationSource = "keyboard" | "mouse";
|
|
5
6
|
export type HomeAgentNavigationTarget = Pick<
|
|
@@ -22,6 +23,7 @@ export type HomeAgentNavigationFailure =
|
|
|
22
23
|
| "attach-failed"
|
|
23
24
|
| "generation-changed"
|
|
24
25
|
| "pane-removed"
|
|
26
|
+
| "selection-failed"
|
|
25
27
|
| "superseded";
|
|
26
28
|
|
|
27
29
|
export interface HomeAgentNavigationResult {
|
|
@@ -53,7 +55,7 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
53
55
|
paneId: string,
|
|
54
56
|
source: HomeAgentNavigationSource,
|
|
55
57
|
admission?: Promise<boolean>,
|
|
56
|
-
) => void;
|
|
58
|
+
) => void | Promise<AdmittedPaneSelectionOutcome> | undefined;
|
|
57
59
|
/**
|
|
58
60
|
* Home's roster can list an agent a moment before the attached session does.
|
|
59
61
|
* Resolves true once `listed()` holds, false on the bound, abort or a
|
|
@@ -64,6 +66,16 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
64
66
|
listed: () => boolean,
|
|
65
67
|
signal: AbortSignal,
|
|
66
68
|
) => Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* "Is it current" answers no while the roster re-reads a session, which it
|
|
71
|
+
* does whenever an agent appears or changes: exactly when a row gets clicked.
|
|
72
|
+
* Resolves once the roster has settled for this target (true: current again)
|
|
73
|
+
* or a bound passed. Without it a click during a re-read is refused at once.
|
|
74
|
+
*/
|
|
75
|
+
readonly waitForCurrentTarget?: (
|
|
76
|
+
target: HomeAgentNavigationTarget,
|
|
77
|
+
signal: AbortSignal,
|
|
78
|
+
) => Promise<boolean>;
|
|
67
79
|
readonly showTerminals: (source: HomeAgentNavigationSource) => void;
|
|
68
80
|
readonly setNote: (note: string | null) => void;
|
|
69
81
|
}) {
|
|
@@ -90,6 +102,23 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
90
102
|
!!current?.agents.some(
|
|
91
103
|
(agent) => agent.id === target.agentId && agent.paneId === target.paneId,
|
|
92
104
|
);
|
|
105
|
+
/** Before a check that would refuse a stale target: let a re-reading roster finish. */
|
|
106
|
+
const settleTarget = async (
|
|
107
|
+
token: number,
|
|
108
|
+
target: HomeAgentNavigationTarget,
|
|
109
|
+
signal: AbortSignal,
|
|
110
|
+
): Promise<void> => {
|
|
111
|
+
if (!options.waitForCurrentTarget || !active(token) || options.isCurrentTarget(target)) return;
|
|
112
|
+
if (waitingNote !== token) {
|
|
113
|
+
options.setNote(`Waiting for agent in ${target.sessionName}…`);
|
|
114
|
+
waitingNote = token;
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
await options.waitForCurrentTarget(target, signal);
|
|
118
|
+
} catch {
|
|
119
|
+
// A failed wait decides nothing; the check that follows does.
|
|
120
|
+
}
|
|
121
|
+
};
|
|
93
122
|
/** Every admission check; null admits. Notes are set only for a refusal. */
|
|
94
123
|
const refusal = (
|
|
95
124
|
token: number,
|
|
@@ -160,7 +189,7 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
160
189
|
const admission = new Promise<boolean>((resolve) => {
|
|
161
190
|
settle = resolve;
|
|
162
191
|
});
|
|
163
|
-
options.selectPane(target.paneId!, source, admission);
|
|
192
|
+
const selection = options.selectPane(target.paneId!, source, admission);
|
|
164
193
|
// The cold path's "Opening agent in …" note, for the warm wait.
|
|
165
194
|
options.setNote(`Waiting for agent in ${target.sessionName}…`);
|
|
166
195
|
waitingNote = token;
|
|
@@ -169,11 +198,36 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
169
198
|
} catch {
|
|
170
199
|
// A failed wait is a refusal below, never an admission.
|
|
171
200
|
}
|
|
172
|
-
if (
|
|
201
|
+
if (options.waitForCurrentTarget && !options.isCurrentTarget(target))
|
|
202
|
+
await settleTarget(token, target, signal);
|
|
173
203
|
// A refusal replaces the note; an admission clears it below.
|
|
174
204
|
const refused = refusal(token, target, generationKey);
|
|
175
205
|
settle(refused === null);
|
|
176
|
-
if (refused)
|
|
206
|
+
if (refused) {
|
|
207
|
+
if (waitingNote === token) waitingNote = null;
|
|
208
|
+
return refused;
|
|
209
|
+
}
|
|
210
|
+
// Admitted is not selected: the runtime may still refuse the pane, or take
|
|
211
|
+
// a moment for a pane that was just created. The wait note stays until it
|
|
212
|
+
// answers, and the terminals are shown only for a pane that was selected.
|
|
213
|
+
let selected: AdmittedPaneSelectionOutcome;
|
|
214
|
+
try {
|
|
215
|
+
selected = (await selection) ?? "selected";
|
|
216
|
+
} catch {
|
|
217
|
+
selected = "failed";
|
|
218
|
+
}
|
|
219
|
+
if (waitingNote === token) waitingNote = null;
|
|
220
|
+
if (!active(token)) return { opened: false, failure: "superseded" };
|
|
221
|
+
if (selected === "superseded" || selected === "not-admitted") {
|
|
222
|
+
options.setNote(null);
|
|
223
|
+
return { opened: false, failure: "superseded" };
|
|
224
|
+
}
|
|
225
|
+
if (selected === "failed")
|
|
226
|
+
return failure(
|
|
227
|
+
token,
|
|
228
|
+
"selection-failed",
|
|
229
|
+
"That agent's terminal could not be selected yet. Select the agent again.",
|
|
230
|
+
);
|
|
177
231
|
options.showTerminals(source);
|
|
178
232
|
options.setNote(null);
|
|
179
233
|
return { opened: true };
|
|
@@ -193,6 +247,12 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
193
247
|
try {
|
|
194
248
|
if (!target.paneId)
|
|
195
249
|
return failure(token, "unavailable", "This agent has no available terminal to open.");
|
|
250
|
+
// Only when it is needed: a warm open of a current target stays synchronous.
|
|
251
|
+
if (options.waitForCurrentTarget && !options.isCurrentTarget(target)) {
|
|
252
|
+
await settleTarget(token, target, controller.signal);
|
|
253
|
+
if (!active(token)) return { opened: false, failure: "superseded" };
|
|
254
|
+
if (waitingNote === token) waitingNote = null;
|
|
255
|
+
}
|
|
196
256
|
if (!options.isCurrentTarget(target))
|
|
197
257
|
return failure(
|
|
198
258
|
token,
|
|
@@ -247,6 +307,11 @@ export function createApplicationHomeAgentNavigator(options: {
|
|
|
247
307
|
"The session opened, but agent details are not ready. Return Home and retry.",
|
|
248
308
|
);
|
|
249
309
|
}
|
|
310
|
+
if (options.waitForCurrentTarget && !options.isCurrentTarget(target)) {
|
|
311
|
+
await settleTarget(token, target, controller.signal);
|
|
312
|
+
if (!active(token)) return { opened: false, failure: "superseded" };
|
|
313
|
+
if (waitingNote === token) waitingNote = null;
|
|
314
|
+
}
|
|
250
315
|
return admit(token, target, source, opened.generationKey);
|
|
251
316
|
} catch {
|
|
252
317
|
return failure(
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { waitForRosterTarget } from "../../../lib/home-agent-observer.ts";
|
|
2
|
+
import type { HomeAgentNavigationTarget } from "./application-home-agent-navigation.ts";
|
|
3
|
+
import type { AdmittedPaneSelectionOutcome } from "./application-terminal-interaction-controller.ts";
|
|
1
4
|
import { createApplicationNewAgentOwner } from "./application-new-agent-owner.ts";
|
|
2
5
|
import type { ApplicationPaletteCommand } from "./application-palette-input.ts";
|
|
3
6
|
import { createEffect, createSignal, onCleanup, untrack, type Accessor } from "solid-js";
|
|
@@ -142,7 +145,10 @@ export function createApplicationHomeAgentsOwner(options: {
|
|
|
142
145
|
readonly generation: () => OpenTuiGenerationHostSnapshot | null;
|
|
143
146
|
readonly sessionName: () => string | null;
|
|
144
147
|
readonly startGeneration: ReturnType<typeof createApplicationGenerationStarter>;
|
|
145
|
-
readonly selectPane: (
|
|
148
|
+
readonly selectPane: (
|
|
149
|
+
paneId: string,
|
|
150
|
+
admission?: Promise<boolean>,
|
|
151
|
+
) => void | Promise<AdmittedPaneSelectionOutcome>;
|
|
146
152
|
readonly showTerminals: (source: "keyboard" | "mouse") => void;
|
|
147
153
|
readonly restoreHome?: (source: "keyboard" | "mouse") => Promise<void> | void;
|
|
148
154
|
readonly setNote: (note: string | null) => void;
|
|
@@ -154,19 +160,20 @@ export function createApplicationHomeAgentsOwner(options: {
|
|
|
154
160
|
const [selected, setSelected] = createSignal(selection.snapshot());
|
|
155
161
|
const [opening, setOpening] = createSignal(false);
|
|
156
162
|
let request = 0;
|
|
163
|
+
const currentTarget = (target: HomeAgentNavigationTarget): boolean => {
|
|
164
|
+
const catalog = options.catalog();
|
|
165
|
+
return (
|
|
166
|
+
catalog.phase === "live" &&
|
|
167
|
+
catalog.daemonInstanceId === target.daemonInstanceId &&
|
|
168
|
+
catalog.sessions.some(
|
|
169
|
+
(session) =>
|
|
170
|
+
session.name === target.sessionName && session.liveSessionId === target.liveSessionId,
|
|
171
|
+
) &&
|
|
172
|
+
observer.isCurrentTarget(target)
|
|
173
|
+
);
|
|
174
|
+
};
|
|
157
175
|
const navigator = createApplicationHomeAgentNavigator({
|
|
158
|
-
isCurrentTarget
|
|
159
|
-
const catalog = options.catalog();
|
|
160
|
-
return (
|
|
161
|
-
catalog.phase === "live" &&
|
|
162
|
-
catalog.daemonInstanceId === target.daemonInstanceId &&
|
|
163
|
-
catalog.sessions.some(
|
|
164
|
-
(session) =>
|
|
165
|
-
session.name === target.sessionName && session.liveSessionId === target.liveSessionId,
|
|
166
|
-
) &&
|
|
167
|
-
observer.isCurrentTarget(target)
|
|
168
|
-
);
|
|
169
|
-
},
|
|
176
|
+
isCurrentTarget: currentTarget,
|
|
170
177
|
currentGeneration() {
|
|
171
178
|
const generation = options.generation();
|
|
172
179
|
const generationKey = applicationGenerationNavigationKey(generation);
|
|
@@ -181,6 +188,16 @@ export function createApplicationHomeAgentsOwner(options: {
|
|
|
181
188
|
agents: semantic.sidebar.agents,
|
|
182
189
|
};
|
|
183
190
|
},
|
|
191
|
+
waitForCurrentTarget: (target, signal) =>
|
|
192
|
+
waitForRosterTarget({
|
|
193
|
+
isCurrent: () => currentTarget(target),
|
|
194
|
+
refreshing: () => {
|
|
195
|
+
const observed = observer.getSnapshot();
|
|
196
|
+
return observed.refreshingSessionKeys.length > 0 || observed.loadingSessions > 0;
|
|
197
|
+
},
|
|
198
|
+
subscribe: (listener) => observer.subscribe(() => listener()),
|
|
199
|
+
signal,
|
|
200
|
+
}),
|
|
184
201
|
waitForGeneration: (key, signal) => waitForHomeAgentSemantic(options.generation, key, signal),
|
|
185
202
|
waitForAgent: (key, listed, signal) =>
|
|
186
203
|
waitForHomeAgentListed(options.generation, key, listed, signal),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AdmittedPaneSelectionOutcome } from "./application-terminal-interaction-controller.ts";
|
|
1
2
|
import { retainsAgentControl } from "./application-retained-agent.ts";
|
|
2
3
|
import {
|
|
3
4
|
createApplicationHomeAgentNavigator,
|
|
@@ -14,9 +15,34 @@ import type { OpenTuiGenerationHostSnapshot } from "./open-tui-generation-host.t
|
|
|
14
15
|
|
|
15
16
|
type HomeNavigatorOptions = Parameters<typeof createApplicationHomeAgentNavigator>[0];
|
|
16
17
|
|
|
18
|
+
/**
|
|
19
|
+
* The two checks the navigator asks of the machines' agent roster: is a row
|
|
20
|
+
* current, and is it current once a re-read in progress has finished.
|
|
21
|
+
*/
|
|
22
|
+
export function machineAgentRosterChecks(roster: {
|
|
23
|
+
isCurrentTarget(machineId: string, row: never): boolean;
|
|
24
|
+
whenCurrentTarget(machineId: string, row: never, signal: AbortSignal): Promise<boolean>;
|
|
25
|
+
}) {
|
|
26
|
+
return {
|
|
27
|
+
isCurrentTarget: (machineId: string, row: HomeAgentNavigationTarget): boolean =>
|
|
28
|
+
roster.isCurrentTarget(machineId, row as never),
|
|
29
|
+
waitForCurrentTarget: (
|
|
30
|
+
machineId: string,
|
|
31
|
+
row: HomeAgentNavigationTarget,
|
|
32
|
+
signal: AbortSignal,
|
|
33
|
+
): Promise<boolean> => roster.whenCurrentTarget(machineId, row as never, signal),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
17
37
|
/** Machine identity fences the existing exact-agent admission owner. No independent input path. */
|
|
18
38
|
export function createApplicationMachineAgentNavigator(options: {
|
|
19
39
|
readonly isCurrentTarget: (machineId: string, target: HomeAgentNavigationTarget) => boolean;
|
|
40
|
+
/** `isCurrentTarget` once the machine's roster has finished a re-read in progress. */
|
|
41
|
+
readonly waitForCurrentTarget?: (
|
|
42
|
+
machineId: string,
|
|
43
|
+
target: HomeAgentNavigationTarget,
|
|
44
|
+
signal: AbortSignal,
|
|
45
|
+
) => Promise<boolean>;
|
|
20
46
|
readonly selectedMachineId: () => string | null;
|
|
21
47
|
/** Identity of the attached generation, never inferred from the selected machine. */
|
|
22
48
|
readonly generationMachineId: () => string | null;
|
|
@@ -24,7 +50,10 @@ export function createApplicationMachineAgentNavigator(options: {
|
|
|
24
50
|
readonly sessionName: () => string | null;
|
|
25
51
|
readonly startGeneration: HomeNavigatorOptions["startGeneration"];
|
|
26
52
|
/** The interaction controller's selectPane: `admission` must reach it (#764). */
|
|
27
|
-
readonly selectPane: (
|
|
53
|
+
readonly selectPane: (
|
|
54
|
+
paneId: string,
|
|
55
|
+
admission?: Promise<boolean>,
|
|
56
|
+
) => void | Promise<AdmittedPaneSelectionOutcome>;
|
|
28
57
|
readonly showTerminals: HomeNavigatorOptions["showTerminals"];
|
|
29
58
|
readonly setNote: HomeNavigatorOptions["setNote"];
|
|
30
59
|
}) {
|
|
@@ -81,6 +110,14 @@ export function createApplicationMachineAgentNavigator(options: {
|
|
|
81
110
|
agents: semantic.sidebar.agents,
|
|
82
111
|
};
|
|
83
112
|
},
|
|
113
|
+
...(options.waitForCurrentTarget
|
|
114
|
+
? {
|
|
115
|
+
waitForCurrentTarget: (row: HomeAgentNavigationTarget, signal: AbortSignal) =>
|
|
116
|
+
selected()
|
|
117
|
+
? options.waitForCurrentTarget!(machineId, row, signal)
|
|
118
|
+
: Promise.resolve(false),
|
|
119
|
+
}
|
|
120
|
+
: {}),
|
|
84
121
|
waitForGeneration: (key, signal) => waitForHomeAgentSemantic(generation, key, signal),
|
|
85
122
|
waitForAgent: (key, listed, signal) =>
|
|
86
123
|
waitForHomeAgentListed(generation, key, listed, signal),
|
|
@@ -364,7 +364,8 @@ export function createApplicationMachineNavigation(options: {
|
|
|
364
364
|
const row = agentGroups()
|
|
365
365
|
.find((group) => group.machineId === id)
|
|
366
366
|
?.agents.find((agent) => agent.sessionName === sessionName && agent.paneId === paneId);
|
|
367
|
-
|
|
367
|
+
// A row is not current while its roster re-reads; the opener waits for that.
|
|
368
|
+
if (!row || (!agents.isCurrentTarget(id, row) && !agents.isRefreshing(id))) {
|
|
368
369
|
options.setNote(
|
|
369
370
|
"That agent is unavailable or has changed. Wait for its machine to reconnect.",
|
|
370
371
|
);
|
|
@@ -417,7 +418,11 @@ export function createApplicationMachineNavigation(options: {
|
|
|
417
418
|
agents,
|
|
418
419
|
selectedMachineId: () => manager.snapshot().selectedMachineId,
|
|
419
420
|
openHomeAgent: (row: ApplicationMachineAgent, source: "keyboard" | "mouse") => {
|
|
420
|
-
if (
|
|
421
|
+
if (
|
|
422
|
+
(!agents.isCurrentTarget(row.machineId, row) || row.disabled) &&
|
|
423
|
+
!agents.isRefreshing(row.machineId)
|
|
424
|
+
)
|
|
425
|
+
return;
|
|
421
426
|
const session = snapshot()
|
|
422
427
|
.groups.find((group) => group.id === row.machineId)
|
|
423
428
|
?.sessions.find(
|
|
@@ -5,7 +5,7 @@ import { terminalWindowActionCallbacks } from "./application-terminal-workspace-
|
|
|
5
5
|
import { applicationRouteConnection } from "./application-route-connection.ts";
|
|
6
6
|
import { ApplicationMachineOverlays } from "./application-machine-overlays.tsx";
|
|
7
7
|
import { applicationMachineAuthorityManager } from "./application-machine-authority.ts";
|
|
8
|
-
import
|
|
8
|
+
import * as machineAgentNavigation from "./application-machine-agent-navigation.ts";
|
|
9
9
|
import { createApplicationMachineNavigation } from "./application-machine-navigation.ts";
|
|
10
10
|
import { handleFleetShortcut } from "./application-machine-navigation.ts";
|
|
11
11
|
import { disposeApplicationDaemonAuthority } from "./application-daemon-authority.ts";
|
|
@@ -325,7 +325,7 @@ export async function startApplicationRoot(options: StartApplicationRootOptions
|
|
|
325
325
|
);
|
|
326
326
|
const startGeneration = terminalInputIngress.wrapStarter(generationStarter);
|
|
327
327
|
let machineAgentNavigator:
|
|
328
|
-
| ReturnType<typeof createApplicationMachineAgentNavigator>
|
|
328
|
+
| ReturnType<typeof machineAgentNavigation.createApplicationMachineAgentNavigator>
|
|
329
329
|
| undefined;
|
|
330
330
|
const machines = createApplicationMachineNavigation({
|
|
331
331
|
attachedGeneration: generation,
|
|
@@ -360,8 +360,8 @@ export async function startApplicationRoot(options: StartApplicationRootOptions
|
|
|
360
360
|
setNote: appearance.setNote,
|
|
361
361
|
});
|
|
362
362
|
const paneInteractions = createMachinePaneActivity(machines, generationMachineId, shell);
|
|
363
|
-
machineAgentNavigator = createApplicationMachineAgentNavigator({
|
|
364
|
-
|
|
363
|
+
machineAgentNavigator = machineAgentNavigation.createApplicationMachineAgentNavigator({
|
|
364
|
+
...machineAgentNavigation.machineAgentRosterChecks(machines.agents),
|
|
365
365
|
selectedMachineId: machines.selectedMachineId,
|
|
366
366
|
generationMachineId,
|
|
367
367
|
generation,
|
package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts
CHANGED
|
@@ -51,7 +51,23 @@ interface DiagnosticWindowFrameContext {
|
|
|
51
51
|
readonly rows: number;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* How a selection made behind an admission ended. "failed": the daemon did not
|
|
56
|
+
* select the pane. "superseded": a later selection or a new control replaced it.
|
|
57
|
+
*/
|
|
58
|
+
export type AdmittedPaneSelectionOutcome = "selected" | "not-admitted" | "failed" | "superseded";
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Waits between tries of a selection the daemon refused as
|
|
62
|
+
* `pane_inventory_not_ready`: it refuses, before any effect, a pane its
|
|
63
|
+
* inventory has not adopted yet, which is the case for a moment after a pane
|
|
64
|
+
* is created (#764). About 3 s in all.
|
|
65
|
+
*/
|
|
66
|
+
export const PANE_INVENTORY_RETRY_DELAYS_MS: readonly number[] = [100, 200, 400, 800, 1500];
|
|
67
|
+
|
|
54
68
|
export interface ApplicationTerminalInteractionControllerOptions {
|
|
69
|
+
/** Test seam for PANE_INVENTORY_RETRY_DELAYS_MS. */
|
|
70
|
+
readonly selectionRetryDelaysMs?: readonly number[];
|
|
55
71
|
readonly generation: Accessor<OpenTuiGenerationHostSnapshot | null>;
|
|
56
72
|
readonly layout: Accessor<OpenTuiWorkspaceLayoutSnapshot>;
|
|
57
73
|
readonly focusedPane?: Accessor<string | null>;
|
|
@@ -89,7 +105,12 @@ export interface ApplicationTerminalInteractionController {
|
|
|
89
105
|
* selection replaced it; otherwise that input is dropped, never delivered to
|
|
90
106
|
* another pane. (The app's root sends no input while an agent is opening.)
|
|
91
107
|
*/
|
|
92
|
-
selectPane(paneId: string
|
|
108
|
+
selectPane(paneId: string): void;
|
|
109
|
+
selectPane(paneId: string, admission: Promise<boolean>): Promise<AdmittedPaneSelectionOutcome>;
|
|
110
|
+
selectPane(
|
|
111
|
+
paneId: string,
|
|
112
|
+
admission?: Promise<boolean>,
|
|
113
|
+
): void | Promise<AdmittedPaneSelectionOutcome>;
|
|
93
114
|
selectWindowLink(target: WindowLinkTarget): Promise<void>;
|
|
94
115
|
unlinkWindowLink(target: WindowLinkTarget): Promise<string>;
|
|
95
116
|
sendInput(
|
|
@@ -830,7 +851,32 @@ export function createApplicationTerminalInteractionController(
|
|
|
830
851
|
|
|
831
852
|
// The one way a pane selection reaches the runtime (#764: also used once an
|
|
832
853
|
// admitted agent selection settles).
|
|
854
|
+
const selectionRetryDelaysMs = options.selectionRetryDelaysMs ?? PANE_INVENTORY_RETRY_DELAYS_MS;
|
|
855
|
+
/**
|
|
856
|
+
* A refusal for an inventory that is not ready happened before any effect,
|
|
857
|
+
* so the same selection may be sent again while it is still the current one.
|
|
858
|
+
* Any other failure is final.
|
|
859
|
+
*/
|
|
833
860
|
const selectInRuntime = async (paneId: string): Promise<boolean> => {
|
|
861
|
+
const version = paneInput.selectionVersion;
|
|
862
|
+
for (let attempt = 0; ; attempt++) {
|
|
863
|
+
const failure: { current: PaneSelectionFailure | null } = { current: null };
|
|
864
|
+
if (await selectInRuntimeOnce(paneId, failure)) return true;
|
|
865
|
+
const delayMs = selectionRetryDelaysMs[attempt];
|
|
866
|
+
if (
|
|
867
|
+
delayMs === undefined ||
|
|
868
|
+
failure.current?.backendReason !== "pane_inventory_not_ready" ||
|
|
869
|
+
paneInput.selectionVersion !== version
|
|
870
|
+
)
|
|
871
|
+
return false;
|
|
872
|
+
await new Promise<void>((resolve) => setTimeout(resolve, delayMs));
|
|
873
|
+
if (paneInput.selectionVersion !== version) return false;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
const selectInRuntimeOnce = async (
|
|
877
|
+
paneId: string,
|
|
878
|
+
selectionFailure: { current: PaneSelectionFailure | null },
|
|
879
|
+
): Promise<boolean> => {
|
|
834
880
|
finishLinkSelection(false);
|
|
835
881
|
const initial = options.generation();
|
|
836
882
|
const selectionControl = controlIdentity(initial);
|
|
@@ -856,7 +902,6 @@ export function createApplicationTerminalInteractionController(
|
|
|
856
902
|
let dispatchedRendererEpoch: number | undefined;
|
|
857
903
|
const selecting = pendingWindowSwitch;
|
|
858
904
|
const operationId = selecting?.traceId;
|
|
859
|
-
const selectionFailure: { current: PaneSelectionFailure | null } = { current: null };
|
|
860
905
|
const receipt = expected
|
|
861
906
|
? await selectTerminalPane(
|
|
862
907
|
expected,
|
|
@@ -1238,23 +1283,32 @@ export function createApplicationTerminalInteractionController(
|
|
|
1238
1283
|
maybeRequestWindowSwitchFrame();
|
|
1239
1284
|
maybeRequestPaneResizeFrame();
|
|
1240
1285
|
},
|
|
1241
|
-
selectPane: (paneId, admission) => {
|
|
1286
|
+
selectPane: ((paneId: string, admission?: Promise<boolean>) => {
|
|
1242
1287
|
finishLinkSelection(false);
|
|
1243
|
-
if (admission)
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1288
|
+
if (!admission) {
|
|
1289
|
+
paneInput.selectPane(paneId);
|
|
1290
|
+
selectionWaiter.reconcile();
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
let outcome!: Promise<AdmittedPaneSelectionOutcome>;
|
|
1294
|
+
// Ordered now; selected only once admitted, otherwise held input drops.
|
|
1295
|
+
paneInput.selectPane(paneId, {
|
|
1296
|
+
presentOptimistically: false,
|
|
1297
|
+
selection: () => {
|
|
1298
|
+
// A later selection supersedes this one: never select it after all.
|
|
1299
|
+
const version = paneInput.selectionVersion;
|
|
1300
|
+
outcome = admission.then(async (admitted): Promise<AdmittedPaneSelectionOutcome> => {
|
|
1301
|
+
if (!admitted) return "not-admitted";
|
|
1302
|
+
if (paneInput.selectionVersion !== version) return "superseded";
|
|
1303
|
+
if (await selectInRuntime(paneId)) return "selected";
|
|
1304
|
+
return paneInput.selectionVersion === version ? "failed" : "superseded";
|
|
1305
|
+
});
|
|
1306
|
+
return outcome.then((result) => result === "selected");
|
|
1307
|
+
},
|
|
1308
|
+
});
|
|
1256
1309
|
selectionWaiter.reconcile();
|
|
1257
|
-
|
|
1310
|
+
return outcome;
|
|
1311
|
+
}) as ApplicationTerminalInteractionController["selectPane"],
|
|
1258
1312
|
async unlinkWindowLink(target) {
|
|
1259
1313
|
const expected = liveSelectionTarget();
|
|
1260
1314
|
const observed = windowLinkTarget(options.layout(), target.linkId);
|
|
@@ -368,6 +368,19 @@ export function createDirectLoopbackDaemonTransport(
|
|
|
368
368
|
};
|
|
369
369
|
let terminalReconnectTimer: unknown | null = null;
|
|
370
370
|
let terminalReconnectController: AbortController | null = null;
|
|
371
|
+
// Failed terminal reconnects back off as the catalog-only one does (#764):
|
|
372
|
+
// a daemon that keeps refusing the inventory is asked at 1, 2, 4 … 30 s,
|
|
373
|
+
// never at a fixed 1 Hz forever. A committed reconnect resets it.
|
|
374
|
+
let terminalReconnectAttempt = 0;
|
|
375
|
+
// The target the backoff was counted for: another workspace or session
|
|
376
|
+
// starts again at 1 s. Kept apart from supervisorTargetKey, which a
|
|
377
|
+
// retirement clears before its own reconnect.
|
|
378
|
+
let terminalReconnectTargetKey: string | null = null;
|
|
379
|
+
const terminalReconnectDelay = (): number => {
|
|
380
|
+
const delayMs = Math.min(1_000 * 2 ** terminalReconnectAttempt, 30_000);
|
|
381
|
+
terminalReconnectAttempt += 1;
|
|
382
|
+
return delayMs;
|
|
383
|
+
};
|
|
371
384
|
let catalogReconnectTimer: unknown | null = null;
|
|
372
385
|
let catalogReconnectAttempt = 0;
|
|
373
386
|
let scheduleCatalogOnlyReconnect = (): void => undefined;
|
|
@@ -457,6 +470,10 @@ export function createDirectLoopbackDaemonTransport(
|
|
|
457
470
|
): WorkspaceEventSupervisor => {
|
|
458
471
|
const key = `${safeTarget.daemon.instanceId}\0${safeTarget.workspaceName}\0${sessionName}`;
|
|
459
472
|
if (eventSupervisor && supervisorTargetKey === key) return eventSupervisor;
|
|
473
|
+
if (terminalReconnectTargetKey !== key) {
|
|
474
|
+
terminalReconnectTargetKey = key;
|
|
475
|
+
terminalReconnectAttempt = 0;
|
|
476
|
+
}
|
|
460
477
|
eventSupervisor?.dispose();
|
|
461
478
|
const socket = createWebSocket(eventSocketUrl(descriptor, "semantic"), {
|
|
462
479
|
headers: dependencies.ownerToken
|
|
@@ -544,7 +561,7 @@ export function createDirectLoopbackDaemonTransport(
|
|
|
544
561
|
terminalReconnectTimer = terminalReconnectClock.setTimeout(() => {
|
|
545
562
|
terminalReconnectTimer = null;
|
|
546
563
|
reconnect();
|
|
547
|
-
},
|
|
564
|
+
}, terminalReconnectDelay());
|
|
548
565
|
};
|
|
549
566
|
const commitReplacement = (): void => {
|
|
550
567
|
if (
|
|
@@ -563,6 +580,7 @@ export function createDirectLoopbackDaemonTransport(
|
|
|
563
580
|
retryReplacement();
|
|
564
581
|
return;
|
|
565
582
|
}
|
|
583
|
+
terminalReconnectAttempt = 0;
|
|
566
584
|
sink(resource);
|
|
567
585
|
if (retainedWorkspaceCatalogReady?.subscriber === catalogSubscriber)
|
|
568
586
|
retainedWorkspaceCatalogReady.resolve();
|
|
@@ -589,14 +607,14 @@ export function createDirectLoopbackDaemonTransport(
|
|
|
589
607
|
terminalReconnectTimer = terminalReconnectClock.setTimeout(() => {
|
|
590
608
|
terminalReconnectTimer = null;
|
|
591
609
|
reconnect();
|
|
592
|
-
},
|
|
610
|
+
}, terminalReconnectDelay());
|
|
593
611
|
});
|
|
594
612
|
};
|
|
595
613
|
if (retiredDuringReconnect) {
|
|
596
614
|
terminalReconnectTimer = terminalReconnectClock.setTimeout(() => {
|
|
597
615
|
terminalReconnectTimer = null;
|
|
598
616
|
reconnect();
|
|
599
|
-
},
|
|
617
|
+
}, terminalReconnectDelay());
|
|
600
618
|
} else {
|
|
601
619
|
queueMicrotask(reconnect);
|
|
602
620
|
}
|