tmux-ide 2.9.21 → 2.9.22
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 +5282 -3386
- package/package.json +1 -1
- package/packages/contracts/src/index.ts +1 -0
- package/packages/contracts/src/pane-reader.ts +121 -0
- package/packages/contracts/src/pane-stream.ts +18 -0
- package/packages/contracts/src/visual-theme-presets.ts +58 -2
- package/packages/daemon/dist/command-center/tmux-server-reader.js +41 -0
- package/packages/daemon/dist/command-center/tmux-servers.js +6 -0
- package/packages/daemon/dist/doctor.js +106 -43
- package/packages/daemon/dist/lib/cli-command.js +13 -0
- package/packages/daemon/dist/lib/daemon-embed.js +15 -0
- package/packages/daemon/dist/lib/pane-reader-files.js +226 -0
- package/packages/daemon/dist/lib/remote-tmux-command.js +8 -5
- package/packages/daemon/dist/lib/tmux-client-execution.js +73 -7
- package/packages/daemon/dist/lib/tmux-pane-reader.js +105 -0
- package/packages/daemon/dist/lib/tmux-server-features.js +38 -0
- package/packages/daemon/dist/lib/tmux-server-owner.js +9 -0
- 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/open-browser.js +26 -12
- package/packages/daemon/dist/open-reader.js +84 -0
- package/packages/daemon/dist/plugins/daemon-plugins.js +2 -10
- package/packages/daemon/dist/restore.js +57 -40
- package/packages/daemon/dist/terminal/mirror/session-channel.js +4 -1
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +12 -3
- package/packages/daemon/dist/terminal/protocol/reader-option.js +66 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +7 -2
- package/packages/daemon/dist/tmux-upgrade/cli.js +106 -0
- package/packages/daemon/dist/tmux-upgrade/io.js +540 -0
- package/packages/daemon/dist/tmux-upgrade/plan.js +238 -0
- package/packages/daemon/dist/tmux-upgrade/run.js +199 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +3 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-navigation.js +64 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agents-owner.js +35 -5
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agent-navigation.js +12 -8
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +125 -111
- package/packages/daemon/src/command-center/tmux-server-reader.ts +62 -0
- package/packages/daemon/src/command-center/tmux-servers.ts +6 -0
- package/packages/daemon/src/doctor.ts +118 -45
- package/packages/daemon/src/lib/cli-command.ts +16 -0
- package/packages/daemon/src/lib/daemon-embed.ts +17 -0
- package/packages/daemon/src/lib/pane-reader-files.ts +294 -0
- package/packages/daemon/src/lib/remote-tmux-command.ts +13 -6
- package/packages/daemon/src/lib/tmux-client-execution.ts +79 -7
- package/packages/daemon/src/lib/tmux-pane-reader.ts +144 -0
- package/packages/daemon/src/lib/tmux-server-features.ts +43 -0
- package/packages/daemon/src/lib/tmux-server-owner.ts +9 -0
- package/packages/daemon/src/open-browser.ts +59 -18
- package/packages/daemon/src/open-reader.ts +148 -0
- package/packages/daemon/src/plugins/daemon-plugins.ts +2 -12
- package/packages/daemon/src/restore.ts +80 -44
- package/packages/daemon/src/terminal/mirror/events.ts +2 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +6 -1
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +15 -2
- package/packages/daemon/src/terminal/protocol/reader-option.ts +77 -0
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +10 -1
- package/packages/daemon/src/tmux-upgrade/cli.ts +118 -0
- package/packages/daemon/src/tmux-upgrade/io.ts +596 -0
- package/packages/daemon/src/tmux-upgrade/plan.ts +353 -0
- package/packages/daemon/src/tmux-upgrade/run.ts +325 -0
- package/packages/daemon/src/tui/chrome/snapshot.ts +3 -4
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-navigation.ts +110 -10
- package/packages/daemon/src/tui/mirror/runtime/application-home-agents-owner.ts +58 -6
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agent-navigation.ts +20 -9
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +2 -2
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +149 -128
- package/packages/tmux-bridge/src/runner.ts +3 -1
package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts
CHANGED
|
@@ -83,7 +83,13 @@ export interface ApplicationTerminalInteractionController {
|
|
|
83
83
|
adoptGeneration(snapshot: OpenTuiGenerationHostSnapshot | null): void;
|
|
84
84
|
cancelPendingInput(): void;
|
|
85
85
|
adoptLayout(snapshot: OpenTuiWorkspaceLayoutSnapshot): void;
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* With `admission`, input sent from now on is ordered behind this pane, and
|
|
88
|
+
* the pane is selected only if `admission` resolves true and no later
|
|
89
|
+
* selection replaced it; otherwise that input is dropped, never delivered to
|
|
90
|
+
* another pane. (The app's root sends no input while an agent is opening.)
|
|
91
|
+
*/
|
|
92
|
+
selectPane(paneId: string, admission?: Promise<boolean>): void;
|
|
87
93
|
selectWindowLink(target: WindowLinkTarget): Promise<void>;
|
|
88
94
|
unlinkWindowLink(target: WindowLinkTarget): Promise<string>;
|
|
89
95
|
sendInput(
|
|
@@ -822,100 +828,118 @@ export function createApplicationTerminalInteractionController(
|
|
|
822
828
|
);
|
|
823
829
|
};
|
|
824
830
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
(
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
selecting.
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
831
|
+
// The one way a pane selection reaches the runtime (#764: also used once an
|
|
832
|
+
// admitted agent selection settles).
|
|
833
|
+
const selectInRuntime = async (paneId: string): Promise<boolean> => {
|
|
834
|
+
finishLinkSelection(false);
|
|
835
|
+
const initial = options.generation();
|
|
836
|
+
const selectionControl = controlIdentity(initial);
|
|
837
|
+
const selectionVersion = paneInput.selectionVersion;
|
|
838
|
+
const selectionCurrent = (): boolean =>
|
|
839
|
+
paneInput.selectionVersion === selectionVersion &&
|
|
840
|
+
sameControl(selectionControl, controlIdentity(selectionGeneration));
|
|
841
|
+
const panePresent = () =>
|
|
842
|
+
selectionLayout.windows.some((window) => window.panes.some((pane) => pane.pane === paneId));
|
|
843
|
+
if (initial?.status === "rebinding") {
|
|
844
|
+
// Reserve the optimistic target now, but send its FIRST mutation only
|
|
845
|
+
// after this same control connection has a coherent terminal runtime.
|
|
846
|
+
const ready = await selectionWaiter.wait(() => {
|
|
847
|
+
if (!selectionCurrent()) return false;
|
|
848
|
+
const active = selectionGeneration;
|
|
849
|
+
if (active?.status !== "live" || observedLayoutEpoch !== active.rendererEpoch)
|
|
850
|
+
return "pending";
|
|
851
|
+
return panePresent();
|
|
852
|
+
});
|
|
853
|
+
if (!ready || !selectionCurrent()) return false;
|
|
854
|
+
}
|
|
855
|
+
const expected = liveSelectionTarget();
|
|
856
|
+
let dispatchedRendererEpoch: number | undefined;
|
|
857
|
+
const selecting = pendingWindowSwitch;
|
|
858
|
+
const operationId = selecting?.traceId;
|
|
859
|
+
const selectionFailure: { current: PaneSelectionFailure | null } = { current: null };
|
|
860
|
+
const receipt = expected
|
|
861
|
+
? await selectTerminalPane(
|
|
862
|
+
expected,
|
|
863
|
+
() => {
|
|
864
|
+
if (!selectionControl) return liveSelectionTarget();
|
|
865
|
+
return sameControl(selectionControl, controlIdentity(options.generation()))
|
|
866
|
+
? expected
|
|
867
|
+
: null;
|
|
868
|
+
},
|
|
869
|
+
paneId,
|
|
870
|
+
operationId,
|
|
871
|
+
(failure) => {
|
|
872
|
+
selectionFailure.current = failure;
|
|
873
|
+
},
|
|
874
|
+
windowLinkForPane(options.layout(), paneId) ?? undefined,
|
|
875
|
+
() => {
|
|
876
|
+
dispatchedRendererEpoch = options.generation()?.rendererEpoch;
|
|
877
|
+
},
|
|
878
|
+
)
|
|
879
|
+
: null;
|
|
880
|
+
if (
|
|
881
|
+
receipt === null &&
|
|
882
|
+
selectionFailure.current?.reason === "topology-changed" &&
|
|
883
|
+
selectionCurrent()
|
|
884
|
+
) {
|
|
885
|
+
// The daemon may have selected the pane before retiring its stream.
|
|
886
|
+
// Observe the replacement runtime; never resubmit an uncertain command
|
|
887
|
+
// or manufacture an operation receipt. Input still waits on this promise.
|
|
888
|
+
const confirmed = await selectionWaiter.wait(() => {
|
|
889
|
+
if (!selectionCurrent()) return false;
|
|
890
|
+
const active = selectionGeneration;
|
|
891
|
+
if (
|
|
892
|
+
active?.status !== "live" ||
|
|
893
|
+
active.rendererEpoch === dispatchedRendererEpoch ||
|
|
894
|
+
observedLayoutEpoch !== active.rendererEpoch
|
|
895
|
+
)
|
|
896
|
+
return "pending";
|
|
897
|
+
if (!panePresent()) return false;
|
|
898
|
+
const current = selectionLayout.current;
|
|
899
|
+
const activePanes = current?.panes.filter((pane) => pane.active) ?? [];
|
|
900
|
+
if (!current?.currentWindow || activePanes.length !== 1) return "pending";
|
|
901
|
+
return activePanes[0]?.pane === paneId ? true : "pending";
|
|
902
|
+
});
|
|
903
|
+
if (selecting && pendingWindowSwitch === selecting) pendingWindowSwitch = null;
|
|
904
|
+
return confirmed && selectionCurrent();
|
|
905
|
+
}
|
|
906
|
+
if (selecting && pendingWindowSwitch === selecting) {
|
|
907
|
+
const receiptAtMicros = options.detailedWindowSwitchTiming ? diagnosticNowMicros() : null;
|
|
908
|
+
if (selecting.timing) selecting.timing.receiptAtMicros = receiptAtMicros;
|
|
909
|
+
selecting.selectionApplied =
|
|
910
|
+
receipt?.applied === true &&
|
|
911
|
+
receipt.operationId === selecting.traceId &&
|
|
912
|
+
receipt.semanticPaneId === selecting.paneId;
|
|
913
|
+
diagnose("window-switch-receipt", {
|
|
914
|
+
traceId: selecting.traceId,
|
|
915
|
+
target: selecting.target,
|
|
916
|
+
paneId: selecting.paneId,
|
|
917
|
+
operationId: receipt?.operationId ?? null,
|
|
918
|
+
selected: receipt !== null,
|
|
919
|
+
applied: receipt?.applied === true,
|
|
920
|
+
daemonGeneration: selecting.daemonGeneration,
|
|
921
|
+
clientGeneration: selecting.clientGeneration,
|
|
922
|
+
rendererEpoch: selecting.rendererEpoch,
|
|
923
|
+
sourceEpoch: selecting.sourceEpoch,
|
|
924
|
+
generation: selecting.generation,
|
|
925
|
+
incarnation: selecting.incarnation,
|
|
926
|
+
revision: selecting.revision,
|
|
927
|
+
stateHash: selecting.stateHash,
|
|
928
|
+
cols: selecting.cols,
|
|
929
|
+
rows: selecting.rows,
|
|
930
|
+
failureStage: selectionFailure.current?.stage ?? (expected ? null : "pre-dispatch"),
|
|
931
|
+
failureReason:
|
|
932
|
+
selectionFailure.current?.reason ?? (expected ? null : "generation-replaced"),
|
|
933
|
+
failureBackendReason: selectionFailure.current?.backendReason ?? null,
|
|
934
|
+
durationMicros:
|
|
935
|
+
receiptAtMicros === null ? null : receiptAtMicros - selecting.startedAtMicros,
|
|
936
|
+
...(receiptAtMicros === null ? {} : { phaseAtMicros: receiptAtMicros }),
|
|
937
|
+
});
|
|
938
|
+
if (!selecting.selectionApplied) {
|
|
939
|
+
diagnoseCritical(`window-switch:${selecting.traceId}:failed`, "window-switch-failed", {
|
|
913
940
|
traceId: selecting.traceId,
|
|
914
941
|
target: selecting.target,
|
|
915
942
|
paneId: selecting.paneId,
|
|
916
|
-
operationId: receipt?.operationId ?? null,
|
|
917
|
-
selected: receipt !== null,
|
|
918
|
-
applied: receipt?.applied === true,
|
|
919
943
|
daemonGeneration: selecting.daemonGeneration,
|
|
920
944
|
clientGeneration: selecting.clientGeneration,
|
|
921
945
|
rendererEpoch: selecting.rendererEpoch,
|
|
@@ -926,44 +950,29 @@ export function createApplicationTerminalInteractionController(
|
|
|
926
950
|
stateHash: selecting.stateHash,
|
|
927
951
|
cols: selecting.cols,
|
|
928
952
|
rows: selecting.rows,
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
selectionFailure.current?.reason ??
|
|
932
|
-
|
|
953
|
+
stage: selectionFailure.current?.stage ?? (expected ? "receipt" : "pre-dispatch"),
|
|
954
|
+
reason:
|
|
955
|
+
selectionFailure.current?.reason ??
|
|
956
|
+
(expected ? "receipt-invalid" : "generation-replaced"),
|
|
957
|
+
backendReason: selectionFailure.current?.backendReason ?? null,
|
|
933
958
|
durationMicros:
|
|
934
959
|
receiptAtMicros === null ? null : receiptAtMicros - selecting.startedAtMicros,
|
|
935
|
-
...(receiptAtMicros === null ? {} : { phaseAtMicros: receiptAtMicros }),
|
|
936
960
|
});
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
traceId: selecting.traceId,
|
|
940
|
-
target: selecting.target,
|
|
941
|
-
paneId: selecting.paneId,
|
|
942
|
-
daemonGeneration: selecting.daemonGeneration,
|
|
943
|
-
clientGeneration: selecting.clientGeneration,
|
|
944
|
-
rendererEpoch: selecting.rendererEpoch,
|
|
945
|
-
sourceEpoch: selecting.sourceEpoch,
|
|
946
|
-
generation: selecting.generation,
|
|
947
|
-
incarnation: selecting.incarnation,
|
|
948
|
-
revision: selecting.revision,
|
|
949
|
-
stateHash: selecting.stateHash,
|
|
950
|
-
cols: selecting.cols,
|
|
951
|
-
rows: selecting.rows,
|
|
952
|
-
stage: selectionFailure.current?.stage ?? (expected ? "receipt" : "pre-dispatch"),
|
|
953
|
-
reason:
|
|
954
|
-
selectionFailure.current?.reason ??
|
|
955
|
-
(expected ? "receipt-invalid" : "generation-replaced"),
|
|
956
|
-
backendReason: selectionFailure.current?.backendReason ?? null,
|
|
957
|
-
durationMicros:
|
|
958
|
-
receiptAtMicros === null ? null : receiptAtMicros - selecting.startedAtMicros,
|
|
959
|
-
});
|
|
960
|
-
pendingWindowSwitch = null;
|
|
961
|
-
return false;
|
|
962
|
-
}
|
|
963
|
-
maybeRequestWindowSwitchFrame();
|
|
961
|
+
pendingWindowSwitch = null;
|
|
962
|
+
return false;
|
|
964
963
|
}
|
|
965
|
-
|
|
966
|
-
}
|
|
964
|
+
maybeRequestWindowSwitchFrame();
|
|
965
|
+
}
|
|
966
|
+
return receipt !== null;
|
|
967
|
+
};
|
|
968
|
+
const paneInput = new TerminalPaneInputRouter<{
|
|
969
|
+
readonly input: SessionRuntimeTerminalInput;
|
|
970
|
+
readonly parserOrigin?: Omit<
|
|
971
|
+
TuiTerminalInputOrigin,
|
|
972
|
+
"semanticPaneId" | "generation" | "incarnation" | "revision" | "stateHash"
|
|
973
|
+
>;
|
|
974
|
+
}>({
|
|
975
|
+
select: (paneId) => selectInRuntime(paneId),
|
|
967
976
|
send: async (paneId, routed) => {
|
|
968
977
|
const { input, parserOrigin } = routed;
|
|
969
978
|
const selectionVersion = paneInput.selectionVersion;
|
|
@@ -1229,9 +1238,21 @@ export function createApplicationTerminalInteractionController(
|
|
|
1229
1238
|
maybeRequestWindowSwitchFrame();
|
|
1230
1239
|
maybeRequestPaneResizeFrame();
|
|
1231
1240
|
},
|
|
1232
|
-
selectPane: (paneId) => {
|
|
1241
|
+
selectPane: (paneId, admission) => {
|
|
1233
1242
|
finishLinkSelection(false);
|
|
1234
|
-
|
|
1243
|
+
if (admission)
|
|
1244
|
+
// Ordered now; selected only once admitted, otherwise held input drops.
|
|
1245
|
+
paneInput.selectPane(paneId, {
|
|
1246
|
+
presentOptimistically: false,
|
|
1247
|
+
selection: () => {
|
|
1248
|
+
// A later selection supersedes this one: never select it after all.
|
|
1249
|
+
const version = paneInput.selectionVersion;
|
|
1250
|
+
return admission.then((admitted) =>
|
|
1251
|
+
admitted && paneInput.selectionVersion === version ? selectInRuntime(paneId) : false,
|
|
1252
|
+
);
|
|
1253
|
+
},
|
|
1254
|
+
});
|
|
1255
|
+
else paneInput.selectPane(paneId);
|
|
1235
1256
|
selectionWaiter.reconcile();
|
|
1236
1257
|
},
|
|
1237
1258
|
async unlinkWindowLink(target) {
|
|
@@ -64,6 +64,8 @@ type TmuxClientResolver = (
|
|
|
64
64
|
) => {
|
|
65
65
|
executable: string;
|
|
66
66
|
environment: NodeJS.ProcessEnv;
|
|
67
|
+
/** Global options put before every command, e.g. `["-S", socket]` to pin one server. */
|
|
68
|
+
globalArgs?: readonly string[];
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
let clientResolver: TmuxClientResolver | undefined;
|
|
@@ -84,7 +86,7 @@ export function runTmux(args: string[], options: ExecFileSyncOptions = {}): stri
|
|
|
84
86
|
const resolved = clientResolver?.(options.env ?? process.env, options.cwd);
|
|
85
87
|
return runTmuxBinary(
|
|
86
88
|
resolved?.executable ?? "tmux",
|
|
87
|
-
args,
|
|
89
|
+
resolved?.globalArgs?.length ? [...resolved.globalArgs, ...args] : args,
|
|
88
90
|
resolved ? { ...options, env: resolved.environment } : options,
|
|
89
91
|
);
|
|
90
92
|
}
|