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
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
paneStreamCloseForRetirement,
|
|
3
|
+
type PaneStreamShutdownClose,
|
|
4
|
+
} from "../terminal/pane-stream/pane-stream-websocket.ts";
|
|
5
|
+
import type { TrackTeardownStep } from "./daemon-stop-progress.ts";
|
|
6
|
+
import type { TmuxServerOwnerRetirement } from "./tmux-server-owners.ts";
|
|
7
|
+
|
|
8
|
+
export type NativeOwnerTeardownStep = readonly [name: string, close: () => unknown];
|
|
9
|
+
|
|
10
|
+
export interface NativeOwnerTeardownParts {
|
|
11
|
+
readonly serverId: string;
|
|
12
|
+
readonly paneStreams: { dispose(close?: PaneStreamShutdownClose): Promise<void> };
|
|
13
|
+
/** Synchronous: from here on the owner refuses new work. */
|
|
14
|
+
readonly markRetired: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Synchronous prelude (abort credentials, start observation disposal), then
|
|
17
|
+
* the ordered steps. `streamsClosed` is the stream shutdown already under way.
|
|
18
|
+
*/
|
|
19
|
+
readonly begin: (streamsClosed: Promise<void>) => readonly NativeOwnerTeardownStep[];
|
|
20
|
+
readonly track?: TrackTeardownStep;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* One tmux server owner's teardown. The pane streams hear first, and hear why:
|
|
25
|
+
* a retired owner under a live daemon means "reconnect now", not "the daemon
|
|
26
|
+
* is shutting down" (#840). Every later step runs even if an earlier one
|
|
27
|
+
* fails; the failures are reported together. Idempotent.
|
|
28
|
+
*/
|
|
29
|
+
export function createNativeOwnerTeardown(
|
|
30
|
+
parts: NativeOwnerTeardownParts,
|
|
31
|
+
): (retirement?: TmuxServerOwnerRetirement) => Promise<void> {
|
|
32
|
+
let teardown: Promise<void> | null = null;
|
|
33
|
+
return (retirement) => {
|
|
34
|
+
if (teardown) return teardown;
|
|
35
|
+
parts.markRetired();
|
|
36
|
+
const streamsClosed = parts.paneStreams.dispose(paneStreamCloseForRetirement(retirement));
|
|
37
|
+
streamsClosed.catch(() => undefined);
|
|
38
|
+
const steps = parts.begin(streamsClosed);
|
|
39
|
+
const track: TrackTeardownStep = parts.track ?? (async (_step, work) => await work());
|
|
40
|
+
teardown = (async () => {
|
|
41
|
+
const failures: unknown[] = [];
|
|
42
|
+
for (const [step, close] of steps) {
|
|
43
|
+
try {
|
|
44
|
+
await track(`owner:${parts.serverId}:${step}`, close);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
failures.push(error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (failures.length)
|
|
50
|
+
throw new AggregateError(failures, "Tmux server owner retirement failed");
|
|
51
|
+
})();
|
|
52
|
+
return teardown;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -48,10 +48,13 @@ import { isVisibleFleetSession, type LiveSessionSummary } from "../command-cente
|
|
|
48
48
|
import { WorkspaceTerminalInventoryRuntime } from "../terminal/attachments/native-runtime.ts";
|
|
49
49
|
import { createTmuxAgentStatusProbe } from "../terminal/attachments/agent-status-probe.ts";
|
|
50
50
|
import { createPaneStreamRuntime } from "../terminal/pane-stream/runtime.ts";
|
|
51
|
+
import { createNativeOwnerTeardown } from "./tmux-server-owner-teardown.ts";
|
|
52
|
+
import type { TrackTeardownStep } from "./daemon-stop-progress.ts";
|
|
51
53
|
import { liveSessionIdForNativeIdentity } from "../terminal/protocol/live-session-identity.ts";
|
|
52
54
|
import { SessionRuntimeRegistry } from "../terminal/session-runtime/registry.ts";
|
|
53
55
|
import { createSessionRuntimeMultiplexerBackend } from "../terminal/session-runtime/multiplexer-backend.ts";
|
|
54
56
|
import { TmuxExternalInteractionObserver } from "./tmux-external-interaction-observer.ts";
|
|
57
|
+
import { createOrphanedControlClientWatch } from "./orphaned-control-clients.ts";
|
|
55
58
|
import { InteractionReceiptJournal } from "./interaction-receipt-journal.ts";
|
|
56
59
|
import { InteractionObservationStatusStore } from "./interaction-observation-status.ts";
|
|
57
60
|
import { InteractionEvidenceAuthority } from "./interaction-evidence-authority.ts";
|
|
@@ -81,6 +84,8 @@ export interface NativeTmuxServerOwnerOptions {
|
|
|
81
84
|
readonly stateDirectory: string;
|
|
82
85
|
readonly webSocketUrl: string;
|
|
83
86
|
readonly nativeServerIdentity?: NativeTmuxServerIdentity;
|
|
87
|
+
/** Names each step of this owner's teardown for the daemon's stop diagnostics. */
|
|
88
|
+
readonly trackTeardown?: TrackTeardownStep;
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
/** Native display names are not necessarily valid shared-contract record identities. */
|
|
@@ -114,9 +119,18 @@ export function createNativeTmuxServerCatalog(
|
|
|
114
119
|
workspaceRegistry: WorkspaceRegistry,
|
|
115
120
|
run: (args: readonly string[], signal?: AbortSignal) => Promise<string>,
|
|
116
121
|
assertOpen: () => void = () => undefined,
|
|
122
|
+
/** Told when the server has no sessions or does not answer; never awaited. */
|
|
123
|
+
onTrouble?: (kind: "no-sessions" | "unanswered") => unknown,
|
|
117
124
|
): () => Promise<NativeLiveSessionSummary[]> {
|
|
118
125
|
return async (): Promise<NativeLiveSessionSummary[]> => {
|
|
119
126
|
assertOpen();
|
|
127
|
+
const tell = (kind: "no-sessions" | "unanswered"): void => {
|
|
128
|
+
try {
|
|
129
|
+
void Promise.resolve(onTrouble?.(kind)).catch(() => undefined);
|
|
130
|
+
} catch {
|
|
131
|
+
/* A watcher never decides the catalog. */
|
|
132
|
+
}
|
|
133
|
+
};
|
|
120
134
|
const raw = await run(
|
|
121
135
|
[
|
|
122
136
|
"-N",
|
|
@@ -135,7 +149,10 @@ export function createNativeTmuxServerCatalog(
|
|
|
135
149
|
.join(" "),
|
|
136
150
|
],
|
|
137
151
|
AbortSignal.timeout(2_000),
|
|
138
|
-
)
|
|
152
|
+
).catch((error: unknown) => {
|
|
153
|
+
tell("unanswered");
|
|
154
|
+
throw error;
|
|
155
|
+
});
|
|
139
156
|
assertOpen();
|
|
140
157
|
const rows = new Map<
|
|
141
158
|
string,
|
|
@@ -149,7 +166,9 @@ export function createNativeTmuxServerCatalog(
|
|
|
149
166
|
>();
|
|
150
167
|
// Only the successful server-side zero-session branch proves emptiness.
|
|
151
168
|
// Command errors, unsupported formats and unwitnessed blank output stay failures.
|
|
152
|
-
const
|
|
169
|
+
const empty = raw.trim() === "tmux-ide-empty-catalog-v1";
|
|
170
|
+
if (empty) tell("no-sessions");
|
|
171
|
+
const lines = empty ? [] : raw.trim().split("\n");
|
|
153
172
|
for (const line of lines) {
|
|
154
173
|
const [pid, id, created, name, pane, window, activity, ...pathParts] = line.split("\t");
|
|
155
174
|
const dir = pathParts.join("\t");
|
|
@@ -237,6 +256,11 @@ export async function createNativeTmuxServerOwner(options: NativeTmuxServerOwner
|
|
|
237
256
|
authority,
|
|
238
257
|
nativeServerIdentity,
|
|
239
258
|
);
|
|
259
|
+
const orphanWatch = createOrphanedControlClientWatch({
|
|
260
|
+
selector: authority.socketSelector,
|
|
261
|
+
serverId: options.serverId,
|
|
262
|
+
});
|
|
263
|
+
void orphanWatch.onOwnership();
|
|
240
264
|
const multiplexer = new WorkspaceMultiplexerAuthority({
|
|
241
265
|
daemonInstanceId: generation,
|
|
242
266
|
registry: workspaceRegistry,
|
|
@@ -259,7 +283,6 @@ export async function createNativeTmuxServerOwner(options: NativeTmuxServerOwner
|
|
|
259
283
|
io: { runTmux: generationRun },
|
|
260
284
|
});
|
|
261
285
|
let disposed = false;
|
|
262
|
-
let disposePromise: Promise<void> | null = null;
|
|
263
286
|
let observerStarted: Promise<void> | null = null;
|
|
264
287
|
const interactionReceipts = new InteractionReceiptJournal();
|
|
265
288
|
const interactionEvidence = new InteractionEvidenceAuthority(options.environmentId, {
|
|
@@ -537,7 +560,12 @@ export async function createNativeTmuxServerOwner(options: NativeTmuxServerOwner
|
|
|
537
560
|
registry: sessionRuntimeRegistry,
|
|
538
561
|
resolveSession: (name) => workspaceRegistry.get(name)?.sessionName ?? null,
|
|
539
562
|
});
|
|
540
|
-
const catalog = createNativeTmuxServerCatalog(
|
|
563
|
+
const catalog = createNativeTmuxServerCatalog(
|
|
564
|
+
workspaceRegistry,
|
|
565
|
+
generationRunAsync,
|
|
566
|
+
assertOpen,
|
|
567
|
+
orphanWatch.onTrouble,
|
|
568
|
+
);
|
|
541
569
|
const sessionCreator = createNativeTmuxSessionCreator({
|
|
542
570
|
generation,
|
|
543
571
|
registry: workspaceRegistry,
|
|
@@ -575,40 +603,34 @@ export async function createNativeTmuxServerOwner(options: NativeTmuxServerOwner
|
|
|
575
603
|
return backend.mutate(...args);
|
|
576
604
|
},
|
|
577
605
|
};
|
|
578
|
-
const dispose = (
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
() =>
|
|
592
|
-
() =>
|
|
593
|
-
() =>
|
|
594
|
-
() =>
|
|
595
|
-
() =>
|
|
596
|
-
() =>
|
|
597
|
-
() =>
|
|
598
|
-
() =>
|
|
599
|
-
() =>
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
if (failures.length)
|
|
608
|
-
throw new AggregateError(failures, "Tmux server owner retirement failed");
|
|
609
|
-
})();
|
|
610
|
-
return disposePromise;
|
|
611
|
-
};
|
|
606
|
+
const dispose = createNativeOwnerTeardown({
|
|
607
|
+
serverId: options.serverId,
|
|
608
|
+
paneStreams: paneStreamRuntime,
|
|
609
|
+
track: options.trackTeardown,
|
|
610
|
+
markRetired: () => {
|
|
611
|
+
disposed = true;
|
|
612
|
+
},
|
|
613
|
+
begin: (streamsClosed) => {
|
|
614
|
+
credentialLifetime.abort();
|
|
615
|
+
sourceCredentials.dispose();
|
|
616
|
+
authoredReceiptEnricher.dispose();
|
|
617
|
+
const observationDisposal = observationSelector.dispose();
|
|
618
|
+
return [
|
|
619
|
+
["observation-selector", () => observationDisposal],
|
|
620
|
+
["session-opener", () => sessionOpener.dispose()],
|
|
621
|
+
["session-creator", () => sessionCreator.dispose()],
|
|
622
|
+
["pane-creation", () => paneCreation.dispose()],
|
|
623
|
+
["pane-streams", () => streamsClosed],
|
|
624
|
+
["interaction-observer", () => observer.dispose()],
|
|
625
|
+
["terminal-inventory", () => terminalInventoryRuntime.dispose()],
|
|
626
|
+
["multiplexer", () => multiplexer.dispose()],
|
|
627
|
+
["session-runtimes", () => sessionRuntimeRegistry.dispose()],
|
|
628
|
+
["interaction-receipts", () => interactionReceipts.dispose()],
|
|
629
|
+
["interaction-evidence", () => interactionEvidence.dispose()],
|
|
630
|
+
["interaction-observation", () => interactionObservation.dispose()],
|
|
631
|
+
];
|
|
632
|
+
},
|
|
633
|
+
});
|
|
612
634
|
try {
|
|
613
635
|
await terminalInventoryRuntime.whenReady();
|
|
614
636
|
await catalog();
|