tmux-ide 2.9.20 → 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 +16998 -4283
- package/package.json +3 -2
- package/packages/contracts/src/command-catalog.ts +116 -0
- package/packages/contracts/src/commands.ts +5 -4
- package/packages/contracts/src/daemon-events.ts +2 -1
- package/packages/contracts/src/index.ts +3 -0
- package/packages/contracts/src/pane-reader.ts +121 -0
- package/packages/contracts/src/pane-stream.ts +18 -0
- package/packages/contracts/src/plain-text.ts +61 -0
- package/packages/contracts/src/visual-theme-presets.ts +58 -2
- package/packages/daemon/dist/command-center/command-catalog-routes.js +78 -0
- package/packages/daemon/dist/command-center/plugin-routes.js +84 -0
- package/packages/daemon/dist/command-center/server.js +13 -0
- 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-action-bridge.js +15 -0
- package/packages/daemon/dist/lib/cli-command.js +13 -0
- package/packages/daemon/dist/lib/daemon-embed.js +39 -1
- package/packages/daemon/dist/lib/headless-daemon.js +1 -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/lib/worktree.js +18 -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/action-catalog.js +129 -0
- package/packages/daemon/dist/plugins/action-cli.js +212 -0
- package/packages/daemon/dist/plugins/api-table.js +303 -0
- package/packages/daemon/dist/plugins/cli.js +556 -0
- package/packages/daemon/dist/plugins/consent.js +107 -0
- package/packages/daemon/dist/plugins/daemon-plugins.js +124 -0
- package/packages/daemon/dist/plugins/discovery.js +142 -0
- package/packages/daemon/dist/plugins/examples/worktree-tasks.js +115 -0
- package/packages/daemon/dist/plugins/exec-sandbox.js +202 -0
- package/packages/daemon/dist/plugins/host/actions-prelude.js +279 -0
- package/packages/daemon/dist/plugins/host/entry.js +4 -0
- package/packages/daemon/dist/plugins/host/host-api-prelude.js +232 -0
- package/packages/daemon/dist/plugins/host/lua-state.js +493 -0
- package/packages/daemon/dist/plugins/host/main.js +322 -0
- package/packages/daemon/dist/plugins/host/sandbox.js +299 -0
- package/packages/daemon/dist/plugins/host-calls.js +279 -0
- package/packages/daemon/dist/plugins/manifest.js +69 -0
- package/packages/daemon/dist/plugins/plugin-exec.js +261 -0
- package/packages/daemon/dist/plugins/plugin-log.js +54 -0
- package/packages/daemon/dist/plugins/plugin-store.js +74 -0
- package/packages/daemon/dist/plugins/protocol.js +252 -0
- package/packages/daemon/dist/plugins/safe-files.js +97 -0
- package/packages/daemon/dist/plugins/supervisor.js +790 -0
- package/packages/daemon/dist/plugins/worktree-calls.js +154 -0
- 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 +62 -5
- package/packages/daemon/dist/tui/mirror/runtime/application-home-experience.js +2 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agent-navigation.js +12 -8
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.js +30 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-plugin-commands.js +152 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-plugin-form.js +251 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +125 -111
- package/packages/daemon/dist/tui/mirror/workspace/application-command-description.js +14 -0
- package/packages/daemon/dist/tui/mirror/workspace/palette-list-layout.js +5 -0
- package/packages/daemon/src/command-center/command-catalog-routes.ts +116 -0
- package/packages/daemon/src/command-center/plugin-routes.ts +110 -0
- package/packages/daemon/src/command-center/server.ts +15 -0
- 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-action-bridge.ts +19 -0
- package/packages/daemon/src/lib/cli-command.ts +16 -0
- package/packages/daemon/src/lib/daemon-embed.ts +59 -0
- package/packages/daemon/src/lib/headless-daemon.ts +1 -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/lib/worktree.ts +16 -0
- package/packages/daemon/src/open-browser.ts +59 -18
- package/packages/daemon/src/open-reader.ts +148 -0
- package/packages/daemon/src/plugins/action-catalog.ts +141 -0
- package/packages/daemon/src/plugins/action-cli.ts +248 -0
- package/packages/daemon/src/plugins/api-table.ts +346 -0
- package/packages/daemon/src/plugins/cli.ts +630 -0
- package/packages/daemon/src/plugins/consent.ts +125 -0
- package/packages/daemon/src/plugins/daemon-plugins.ts +172 -0
- package/packages/daemon/src/plugins/discovery.ts +176 -0
- package/packages/daemon/src/plugins/examples/worktree-tasks.ts +120 -0
- package/packages/daemon/src/plugins/exec-sandbox.ts +264 -0
- package/packages/daemon/src/plugins/host/actions-prelude.ts +280 -0
- package/packages/daemon/src/plugins/host/entry.ts +5 -0
- package/packages/daemon/src/plugins/host/host-api-prelude.ts +233 -0
- package/packages/daemon/src/plugins/host/lua-state.ts +557 -0
- package/packages/daemon/src/plugins/host/main.ts +359 -0
- package/packages/daemon/src/plugins/host/sandbox.ts +301 -0
- package/packages/daemon/src/plugins/host-calls.ts +343 -0
- package/packages/daemon/src/plugins/manifest.ts +74 -0
- package/packages/daemon/src/plugins/plugin-exec.ts +326 -0
- package/packages/daemon/src/plugins/plugin-log.ts +63 -0
- package/packages/daemon/src/plugins/plugin-store.ts +80 -0
- package/packages/daemon/src/plugins/protocol.ts +275 -0
- package/packages/daemon/src/plugins/safe-files.ts +105 -0
- package/packages/daemon/src/plugins/supervisor.ts +954 -0
- package/packages/daemon/src/plugins/worktree-calls.ts +183 -0
- 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-fleet-switcher.tsx +3 -1
- 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 +90 -6
- package/packages/daemon/src/tui/mirror/runtime/application-home-experience.ts +2 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agent-navigation.ts +20 -9
- package/packages/daemon/src/tui/mirror/runtime/application-palette-command-owner.ts +42 -2
- package/packages/daemon/src/tui/mirror/runtime/application-palette-preview.tsx +7 -1
- package/packages/daemon/src/tui/mirror/runtime/application-plugin-commands.ts +229 -0
- package/packages/daemon/src/tui/mirror/runtime/application-plugin-form.ts +312 -0
- 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/daemon/src/tui/mirror/workspace/application-command-description.ts +44 -2
- package/packages/daemon/src/tui/mirror/workspace/palette-list-layout.ts +4 -0
- 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) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CHROME_ACTIONS } from "./application-action-descriptions.ts";
|
|
2
|
-
import type
|
|
2
|
+
import { terminalSafe, type CommandParam, type TmuxServerScope } from "@tmux-ide/contracts";
|
|
3
3
|
import { fuzzyTermsMatch as commandSearchMatch } from "../../team/fuzzy.ts";
|
|
4
4
|
export { fuzzyTermsMatch as commandSearchMatch } from "../../team/fuzzy.ts";
|
|
5
5
|
import { PANE_ACTION_MENU_ITEMS } from "./pane-action-menu-model.ts";
|
|
@@ -37,6 +37,30 @@ export interface ApplicationMachinePaletteCommand {
|
|
|
37
37
|
readonly fleet: FleetPaletteTarget;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/** A command a plugin registered, from the daemon's command catalog. */
|
|
41
|
+
export interface ApplicationPluginPaletteCommand {
|
|
42
|
+
readonly kind: "plugin-command";
|
|
43
|
+
readonly fleet?: undefined;
|
|
44
|
+
/** Catalog id, `plugin.<plugin>.<id>`. */
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly label: string;
|
|
47
|
+
readonly category: string;
|
|
48
|
+
readonly plugin: string;
|
|
49
|
+
readonly dangerous: boolean;
|
|
50
|
+
readonly params: readonly CommandParam[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** One choice in the step-by-step form a plugin command with parameters opens. */
|
|
54
|
+
export interface ApplicationPluginFormPaletteCommand {
|
|
55
|
+
readonly kind: "plugin-form";
|
|
56
|
+
readonly fleet?: undefined;
|
|
57
|
+
/** Unique within the current form step. */
|
|
58
|
+
readonly key: string;
|
|
59
|
+
readonly label: string;
|
|
60
|
+
readonly detail: string;
|
|
61
|
+
readonly disabledReason?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
40
64
|
export type ApplicationPaletteCommand =
|
|
41
65
|
| "hide-sidebar"
|
|
42
66
|
| "show-sidebar"
|
|
@@ -55,7 +79,9 @@ export type ApplicationPaletteCommand =
|
|
|
55
79
|
| "close-pane"
|
|
56
80
|
| ApplicationMachinePaletteCommand
|
|
57
81
|
| ApplicationAgentPaletteCommand
|
|
58
|
-
| ApplicationSessionPaletteCommand
|
|
82
|
+
| ApplicationSessionPaletteCommand
|
|
83
|
+
| ApplicationPluginPaletteCommand
|
|
84
|
+
| ApplicationPluginFormPaletteCommand;
|
|
59
85
|
|
|
60
86
|
export const PALETTE_REFERENCE_COMMANDS = {
|
|
61
87
|
shortcuts: { label: "Keyboard shortcuts", shortcut: "Ctrl+K", key: "k", page: "shortcuts" },
|
|
@@ -93,6 +119,22 @@ export function applicationCommandDescription(command: ApplicationPaletteCommand
|
|
|
93
119
|
};
|
|
94
120
|
if (command === "shortcuts" || command === "whats-new")
|
|
95
121
|
return { id: command, ...PALETTE_REFERENCE_COMMANDS[command], detail: "Help and reference" };
|
|
122
|
+
if (typeof command === "object" && command.kind === "plugin-command")
|
|
123
|
+
return {
|
|
124
|
+
id: JSON.stringify([command.kind, command.id]),
|
|
125
|
+
// Plugin text: plain text only, even if something upstream let it through.
|
|
126
|
+
label: terminalSafe(
|
|
127
|
+
command.params.length > 0 || command.dangerous ? `${command.label}…` : command.label,
|
|
128
|
+
200,
|
|
129
|
+
),
|
|
130
|
+
detail: terminalSafe(`${command.category} · ${command.plugin} plugin`, 200),
|
|
131
|
+
};
|
|
132
|
+
if (typeof command === "object" && command.kind === "plugin-form")
|
|
133
|
+
return {
|
|
134
|
+
id: JSON.stringify([command.kind, command.key]),
|
|
135
|
+
label: terminalSafe(command.label, 200),
|
|
136
|
+
detail: terminalSafe(command.detail, 500),
|
|
137
|
+
};
|
|
96
138
|
if (typeof command === "object" && command.kind === "open-machine")
|
|
97
139
|
return {
|
|
98
140
|
id: JSON.stringify([
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { terminalSafe } from "@tmux-ide/contracts";
|
|
1
2
|
import type { ApplicationPaletteCommand } from "./application-command-description.ts";
|
|
2
3
|
|
|
3
4
|
export function paletteSection(command: ApplicationPaletteCommand): string {
|
|
4
5
|
if (command === "switch-session") return "Sessions";
|
|
6
|
+
if (typeof command === "object" && command.kind === "plugin-command")
|
|
7
|
+
return terminalSafe(command.category, 80);
|
|
8
|
+
if (typeof command === "object" && command.kind === "plugin-form") return "Choose";
|
|
5
9
|
if (typeof command === "object")
|
|
6
10
|
return command.kind === "jump-agent"
|
|
7
11
|
? "Agents"
|
|
@@ -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
|
}
|