dmux 3.1.1 → 3.2.0

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.
Files changed (232) hide show
  1. package/dist/CleanTextInput.d.ts +9 -0
  2. package/dist/CleanTextInput.d.ts.map +1 -1
  3. package/dist/CleanTextInput.js +127 -47
  4. package/dist/CleanTextInput.js.map +1 -1
  5. package/dist/DmuxApp.d.ts +2 -2
  6. package/dist/DmuxApp.d.ts.map +1 -1
  7. package/dist/DmuxApp.js +1396 -750
  8. package/dist/DmuxApp.js.map +1 -1
  9. package/dist/actions/paneActions.d.ts.map +1 -1
  10. package/dist/actions/paneActions.js +68 -11
  11. package/dist/actions/paneActions.js.map +1 -1
  12. package/dist/actions/types.d.ts +1 -0
  13. package/dist/actions/types.d.ts.map +1 -1
  14. package/dist/actions/types.js +1 -0
  15. package/dist/actions/types.js.map +1 -1
  16. package/dist/components/ActionInputDialog.d.ts.map +1 -1
  17. package/dist/components/ActionInputDialog.js +3 -2
  18. package/dist/components/ActionInputDialog.js.map +1 -1
  19. package/dist/components/DialogBox.d.ts +16 -0
  20. package/dist/components/DialogBox.d.ts.map +1 -0
  21. package/dist/components/DialogBox.js +12 -0
  22. package/dist/components/DialogBox.js.map +1 -0
  23. package/dist/components/FooterHelp.d.ts +9 -0
  24. package/dist/components/FooterHelp.d.ts.map +1 -1
  25. package/dist/components/FooterHelp.js +41 -5
  26. package/dist/components/FooterHelp.js.map +1 -1
  27. package/dist/components/PaneCard.d.ts +3 -1
  28. package/dist/components/PaneCard.d.ts.map +1 -1
  29. package/dist/components/PaneCard.js +50 -33
  30. package/dist/components/PaneCard.js.map +1 -1
  31. package/dist/components/PanesGrid.d.ts +3 -5
  32. package/dist/components/PanesGrid.d.ts.map +1 -1
  33. package/dist/components/PanesGrid.js +40 -10
  34. package/dist/components/PanesGrid.js.map +1 -1
  35. package/dist/dashboard.js +1 -1
  36. package/dist/decorative-pane.d.ts +3 -0
  37. package/dist/decorative-pane.d.ts.map +1 -0
  38. package/dist/decorative-pane.js +136 -0
  39. package/dist/decorative-pane.js.map +1 -0
  40. package/dist/hooks/useActionSystem.d.ts +14 -1
  41. package/dist/hooks/useActionSystem.d.ts.map +1 -1
  42. package/dist/hooks/useActionSystem.js +93 -4
  43. package/dist/hooks/useActionSystem.js.map +1 -1
  44. package/dist/hooks/useNavigation.js +1 -1
  45. package/dist/hooks/useNavigation.js.map +1 -1
  46. package/dist/hooks/usePaneCreation.d.ts +1 -2
  47. package/dist/hooks/usePaneCreation.d.ts.map +1 -1
  48. package/dist/hooks/usePaneCreation.js +13 -27
  49. package/dist/hooks/usePaneCreation.js.map +1 -1
  50. package/dist/hooks/usePaneRunner.d.ts.map +1 -1
  51. package/dist/hooks/usePaneRunner.js +8 -3
  52. package/dist/hooks/usePaneRunner.js.map +1 -1
  53. package/dist/hooks/usePanes.d.ts.map +1 -1
  54. package/dist/hooks/usePanes.js +210 -37
  55. package/dist/hooks/usePanes.js.map +1 -1
  56. package/dist/hooks/useWorktreeActions.d.ts.map +1 -1
  57. package/dist/hooks/useWorktreeActions.js +7 -13
  58. package/dist/hooks/useWorktreeActions.js.map +1 -1
  59. package/dist/index.js +217 -29
  60. package/dist/index.js.map +1 -1
  61. package/dist/popups/agentChoicePopup.d.ts +7 -0
  62. package/dist/popups/agentChoicePopup.d.ts.map +1 -0
  63. package/dist/popups/agentChoicePopup.js +74 -0
  64. package/dist/popups/agentChoicePopup.js.map +1 -0
  65. package/dist/popups/choicePopup.d.ts +7 -0
  66. package/dist/popups/choicePopup.d.ts.map +1 -0
  67. package/dist/popups/choicePopup.js +64 -0
  68. package/dist/popups/choicePopup.js.map +1 -0
  69. package/dist/popups/components/FileList.d.ts +13 -0
  70. package/dist/popups/components/FileList.d.ts.map +1 -0
  71. package/dist/popups/components/FileList.js +61 -0
  72. package/dist/popups/components/FileList.js.map +1 -0
  73. package/dist/popups/components/PopupContainer.d.ts +14 -0
  74. package/dist/popups/components/PopupContainer.d.ts.map +1 -0
  75. package/dist/popups/components/PopupContainer.js +15 -0
  76. package/dist/popups/components/PopupContainer.js.map +1 -0
  77. package/dist/popups/components/PopupInputBox.d.ts +11 -0
  78. package/dist/popups/components/PopupInputBox.d.ts.map +1 -0
  79. package/dist/popups/components/PopupInputBox.js +10 -0
  80. package/dist/popups/components/PopupInputBox.js.map +1 -0
  81. package/dist/popups/components/PopupWrapper.d.ts +37 -0
  82. package/dist/popups/components/PopupWrapper.d.ts.map +1 -0
  83. package/dist/popups/components/PopupWrapper.js +88 -0
  84. package/dist/popups/components/PopupWrapper.js.map +1 -0
  85. package/dist/popups/components/index.d.ts +8 -0
  86. package/dist/popups/components/index.d.ts.map +1 -0
  87. package/dist/popups/components/index.js +8 -0
  88. package/dist/popups/components/index.js.map +1 -0
  89. package/dist/popups/config.d.ts +40 -0
  90. package/dist/popups/config.d.ts.map +1 -0
  91. package/dist/popups/config.js +40 -0
  92. package/dist/popups/config.js.map +1 -0
  93. package/dist/popups/confirmPopup.d.ts +7 -0
  94. package/dist/popups/confirmPopup.d.ts.map +1 -0
  95. package/dist/popups/confirmPopup.js +72 -0
  96. package/dist/popups/confirmPopup.js.map +1 -0
  97. package/dist/popups/hooksPopup.d.ts +7 -0
  98. package/dist/popups/hooksPopup.d.ts.map +1 -0
  99. package/dist/popups/hooksPopup.js +71 -0
  100. package/dist/popups/hooksPopup.js.map +1 -0
  101. package/dist/popups/inputPopup.d.ts +7 -0
  102. package/dist/popups/inputPopup.d.ts.map +1 -0
  103. package/dist/popups/inputPopup.js +48 -0
  104. package/dist/popups/inputPopup.js.map +1 -0
  105. package/dist/popups/kebabMenuPopup.d.ts +7 -0
  106. package/dist/popups/kebabMenuPopup.d.ts.map +1 -0
  107. package/dist/popups/kebabMenuPopup.js +52 -0
  108. package/dist/popups/kebabMenuPopup.js.map +1 -0
  109. package/dist/popups/logsPopup.d.ts +12 -0
  110. package/dist/popups/logsPopup.d.ts.map +1 -0
  111. package/dist/popups/logsPopup.js +364 -0
  112. package/dist/popups/logsPopup.js.map +1 -0
  113. package/dist/popups/mergePopup.d.ts +7 -0
  114. package/dist/popups/mergePopup.d.ts.map +1 -0
  115. package/dist/popups/mergePopup.js +310 -0
  116. package/dist/popups/mergePopup.js.map +1 -0
  117. package/dist/popups/newPanePopup.d.ts +7 -0
  118. package/dist/popups/newPanePopup.d.ts.map +1 -0
  119. package/dist/popups/newPanePopup.js +234 -0
  120. package/dist/popups/newPanePopup.js.map +1 -0
  121. package/dist/popups/progressPopup.d.ts +8 -0
  122. package/dist/popups/progressPopup.d.ts.map +1 -0
  123. package/dist/popups/progressPopup.js +54 -0
  124. package/dist/popups/progressPopup.js.map +1 -0
  125. package/dist/popups/remotePopup.d.ts +6 -0
  126. package/dist/popups/remotePopup.d.ts.map +1 -0
  127. package/dist/popups/remotePopup.js +166 -0
  128. package/dist/popups/remotePopup.js.map +1 -0
  129. package/dist/popups/settingsPopup.d.ts +7 -0
  130. package/dist/popups/settingsPopup.d.ts.map +1 -0
  131. package/dist/popups/settingsPopup.js +212 -0
  132. package/dist/popups/settingsPopup.js.map +1 -0
  133. package/dist/popups/shortcutsPopup.d.ts +6 -0
  134. package/dist/popups/shortcutsPopup.d.ts.map +1 -0
  135. package/dist/popups/shortcutsPopup.js +74 -0
  136. package/dist/popups/shortcutsPopup.js.map +1 -0
  137. package/dist/popups/templates/SimpleInputPopup.d.ts +15 -0
  138. package/dist/popups/templates/SimpleInputPopup.d.ts.map +1 -0
  139. package/dist/popups/templates/SimpleInputPopup.js +28 -0
  140. package/dist/popups/templates/SimpleInputPopup.js.map +1 -0
  141. package/dist/server/embedded-assets.d.ts.map +1 -1
  142. package/dist/server/embedded-assets.js +2066 -968
  143. package/dist/server/embedded-assets.js.map +1 -1
  144. package/dist/server/index.js +1 -1
  145. package/dist/server/index.js.map +1 -1
  146. package/dist/server/routes.d.ts +1 -1
  147. package/dist/server/routes.d.ts.map +1 -1
  148. package/dist/server/routes.js +73 -6
  149. package/dist/server/routes.js.map +1 -1
  150. package/dist/services/ConfigWatcher.d.ts.map +1 -1
  151. package/dist/services/ConfigWatcher.js +10 -3
  152. package/dist/services/ConfigWatcher.js.map +1 -1
  153. package/dist/services/LogService.d.ts +112 -0
  154. package/dist/services/LogService.d.ts.map +1 -0
  155. package/dist/services/LogService.js +252 -0
  156. package/dist/services/LogService.js.map +1 -0
  157. package/dist/services/PaneWorkerManager.d.ts.map +1 -1
  158. package/dist/services/PaneWorkerManager.js +35 -9
  159. package/dist/services/PaneWorkerManager.js.map +1 -1
  160. package/dist/services/TunnelService.d.ts +1 -0
  161. package/dist/services/TunnelService.d.ts.map +1 -1
  162. package/dist/services/TunnelService.js +56 -15
  163. package/dist/services/TunnelService.js.map +1 -1
  164. package/dist/shared/StateManager.d.ts +49 -1
  165. package/dist/shared/StateManager.d.ts.map +1 -1
  166. package/dist/shared/StateManager.js +97 -2
  167. package/dist/shared/StateManager.js.map +1 -1
  168. package/dist/spacer-pane.d.ts +8 -0
  169. package/dist/spacer-pane.d.ts.map +1 -0
  170. package/dist/spacer-pane.js +40 -0
  171. package/dist/spacer-pane.js.map +1 -0
  172. package/dist/theme/colors.d.ts +25 -0
  173. package/dist/theme/colors.d.ts.map +1 -0
  174. package/dist/theme/colors.js +33 -0
  175. package/dist/theme/colors.js.map +1 -0
  176. package/dist/types.d.ts +14 -0
  177. package/dist/types.d.ts.map +1 -1
  178. package/dist/utils/asciiArt.d.ts +26 -0
  179. package/dist/utils/asciiArt.d.ts.map +1 -0
  180. package/dist/utils/asciiArt.js +88 -0
  181. package/dist/utils/asciiArt.js.map +1 -0
  182. package/dist/utils/conflictResolutionPane.d.ts.map +1 -1
  183. package/dist/utils/conflictResolutionPane.js +8 -4
  184. package/dist/utils/conflictResolutionPane.js.map +1 -1
  185. package/dist/utils/fileScanner.d.ts +23 -0
  186. package/dist/utils/fileScanner.d.ts.map +1 -0
  187. package/dist/utils/fileScanner.js +123 -0
  188. package/dist/utils/fileScanner.js.map +1 -0
  189. package/dist/utils/generated-agents-doc.d.ts +1 -1
  190. package/dist/utils/generated-agents-doc.js +1 -1
  191. package/dist/utils/hooks.d.ts.map +1 -1
  192. package/dist/utils/hooks.js +65 -36
  193. package/dist/utils/hooks.js.map +1 -1
  194. package/dist/utils/hooksDocs.d.ts +1 -1
  195. package/dist/utils/layoutManager.d.ts +45 -0
  196. package/dist/utils/layoutManager.d.ts.map +1 -0
  197. package/dist/utils/layoutManager.js +500 -0
  198. package/dist/utils/layoutManager.js.map +1 -0
  199. package/dist/utils/paneCreation.d.ts.map +1 -1
  200. package/dist/utils/paneCreation.js +125 -11
  201. package/dist/utils/paneCreation.js.map +1 -1
  202. package/dist/utils/popup.d.ts +97 -0
  203. package/dist/utils/popup.d.ts.map +1 -0
  204. package/dist/utils/popup.js +509 -0
  205. package/dist/utils/popup.js.map +1 -0
  206. package/dist/utils/postPaneCleanup.d.ts +12 -0
  207. package/dist/utils/postPaneCleanup.d.ts.map +1 -0
  208. package/dist/utils/postPaneCleanup.js +53 -0
  209. package/dist/utils/postPaneCleanup.js.map +1 -0
  210. package/dist/utils/shellPaneDetection.d.ts +44 -0
  211. package/dist/utils/shellPaneDetection.d.ts.map +1 -0
  212. package/dist/utils/shellPaneDetection.js +175 -0
  213. package/dist/utils/shellPaneDetection.js.map +1 -0
  214. package/dist/utils/tmux.d.ts +53 -1
  215. package/dist/utils/tmux.d.ts.map +1 -1
  216. package/dist/utils/tmux.js +352 -84
  217. package/dist/utils/tmux.js.map +1 -1
  218. package/dist/utils/welcomePane.d.ts +22 -0
  219. package/dist/utils/welcomePane.d.ts.map +1 -0
  220. package/dist/utils/welcomePane.js +119 -0
  221. package/dist/utils/welcomePane.js.map +1 -0
  222. package/dist/utils/welcomePaneManager.d.ts +36 -0
  223. package/dist/utils/welcomePaneManager.d.ts.map +1 -0
  224. package/dist/utils/welcomePaneManager.js +160 -0
  225. package/dist/utils/welcomePaneManager.js.map +1 -0
  226. package/dist/workers/PaneWorker.js +2 -0
  227. package/dist/workers/PaneWorker.js.map +1 -1
  228. package/package.json +5 -2
  229. package/dist/components/NewPaneDialog.d.ts +0 -9
  230. package/dist/components/NewPaneDialog.d.ts.map +0 -1
  231. package/dist/components/NewPaneDialog.js +0 -11
  232. package/dist/components/NewPaneDialog.js.map +0 -1
@@ -0,0 +1,509 @@
1
+ /**
2
+ * Utility for launching tmux popup modals
3
+ * Requires tmux 3.2+
4
+ */
5
+ import { execSync, spawn } from 'child_process';
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import * as os from 'os';
9
+ import { POPUP_CONFIG } from '../popups/config.js';
10
+ /**
11
+ * Calculate actual popup bounds based on tmux terminal dimensions
12
+ */
13
+ function calculatePopupBounds(options) {
14
+ const { width = 80, height = 20, centered = true, x, y, leftOffset = 0, topOffset = 0, } = options;
15
+ try {
16
+ // Get tmux client dimensions
17
+ const dims = execSync('tmux display-message -p "#{client_width},#{client_height}"', {
18
+ encoding: 'utf-8',
19
+ stdio: 'pipe'
20
+ }).trim();
21
+ const [clientWidth, clientHeight] = dims.split(',').map(Number);
22
+ let posX;
23
+ let posY;
24
+ if (!centered && (leftOffset > 0 || topOffset > 0)) {
25
+ posX = leftOffset;
26
+ posY = topOffset;
27
+ }
28
+ else if (!centered && x !== undefined && y !== undefined) {
29
+ posX = x;
30
+ posY = y;
31
+ }
32
+ else if (centered && leftOffset > 0) {
33
+ posX = Math.floor((clientWidth - width) / 2) + leftOffset;
34
+ posY = Math.floor((clientHeight - height) / 2) + topOffset;
35
+ }
36
+ else {
37
+ // Fully centered
38
+ posX = Math.floor((clientWidth - width) / 2);
39
+ posY = Math.floor((clientHeight - height) / 2);
40
+ }
41
+ return { x: posX, y: posY, width, height };
42
+ }
43
+ catch {
44
+ // Fallback to defaults if we can't get tmux dimensions
45
+ return { x: leftOffset || 0, y: topOffset || 0, width, height };
46
+ }
47
+ }
48
+ /**
49
+ * Launch a tmux popup modal
50
+ * @param command - Command to run in the popup
51
+ * @param options - Popup display options
52
+ * @returns Promise that resolves when popup closes
53
+ */
54
+ export async function launchPopup(command, options = {}) {
55
+ const { width = 80, height = 20, title, centered = true, x, y, cwd = process.cwd(), borderStyle = 'double', leftOffset = 0, topOffset = 0, } = options;
56
+ // Create a temp file for the result
57
+ const resultFile = path.join(os.tmpdir(), `dmux-popup-${Date.now()}.json`);
58
+ // Build tmux popup command
59
+ const args = [
60
+ 'display-popup',
61
+ '-E', // Close on command exit
62
+ '-w', width.toString(),
63
+ '-h', height.toString(),
64
+ '-d', `"${cwd}"`,
65
+ ];
66
+ // Add border style if supported (tmux 3.2+)
67
+ // Skip if borderStyle is 'none' (we want no tmux border)
68
+ if (borderStyle && borderStyle !== 'none') {
69
+ args.push('-b', borderStyle);
70
+ }
71
+ // Add popup border color (foreground only - respects user's terminal background)
72
+ args.push('-s', `'border-fg=colour${POPUP_CONFIG.tmuxBorderColor}'`);
73
+ // Position: centered or custom
74
+ if (!centered && (leftOffset > 0 || topOffset > 0)) {
75
+ // Absolute positioning with leftOffset/topOffset
76
+ args.push('-x', leftOffset.toString());
77
+ args.push('-y', topOffset.toString());
78
+ }
79
+ else if (!centered && x !== undefined && y !== undefined) {
80
+ // Absolute positioning with x/y
81
+ args.push('-x', x.toString());
82
+ args.push('-y', y.toString());
83
+ }
84
+ else if (centered && leftOffset > 0) {
85
+ // Centered with sidebar offset
86
+ args.push('-x', leftOffset.toString());
87
+ args.push('-y', topOffset.toString());
88
+ }
89
+ else {
90
+ // Fully centered
91
+ args.push('-x', 'C');
92
+ args.push('-y', 'C');
93
+ }
94
+ // Title
95
+ if (title) {
96
+ args.push('-T', `"${title}"`);
97
+ }
98
+ // Escape the command for tmux
99
+ const escapedCommand = command.replace(/'/g, "'\\''");
100
+ const fullCommand = `tmux ${args.join(' ')} '${escapedCommand}'`;
101
+ return new Promise((resolve) => {
102
+ // Launch popup with spawn (non-blocking)
103
+ const child = spawn('sh', ['-c', fullCommand], {
104
+ stdio: 'inherit',
105
+ });
106
+ child.on('close', () => {
107
+ // Read result from temp file
108
+ if (fs.existsSync(resultFile)) {
109
+ try {
110
+ const resultData = fs.readFileSync(resultFile, 'utf-8');
111
+ fs.unlinkSync(resultFile); // Clean up
112
+ try {
113
+ const result = JSON.parse(resultData);
114
+ resolve(result);
115
+ }
116
+ catch {
117
+ // Not JSON, treat as plain text
118
+ resolve({
119
+ success: true,
120
+ data: resultData,
121
+ });
122
+ }
123
+ }
124
+ catch (error) {
125
+ resolve({
126
+ success: false,
127
+ error: error.message,
128
+ });
129
+ }
130
+ }
131
+ else {
132
+ // No result file = cancelled
133
+ resolve({
134
+ success: false,
135
+ cancelled: true,
136
+ });
137
+ }
138
+ });
139
+ child.on('error', (error) => {
140
+ // Clean up temp file if it exists
141
+ if (fs.existsSync(resultFile)) {
142
+ fs.unlinkSync(resultFile);
143
+ }
144
+ resolve({
145
+ success: false,
146
+ error: error.message,
147
+ });
148
+ });
149
+ });
150
+ }
151
+ /**
152
+ * Launch a popup that runs a Node.js script
153
+ * @param scriptPath - Path to the compiled JS script
154
+ * @param args - Arguments to pass to the script
155
+ * @param options - Popup display options
156
+ */
157
+ export async function launchNodePopup(scriptPath, args = [], options = {}) {
158
+ // Get the result file path that the script will write to
159
+ const resultFile = path.join(os.tmpdir(), `dmux-popup-${Date.now()}.json`);
160
+ // Build node command with proper escaping
161
+ // Escape each argument for shell: replace backslashes, then single quotes
162
+ const escapedArgs = [scriptPath, resultFile, ...args].map(arg => {
163
+ // Escape for shell: replace ' with '\''
164
+ const escaped = arg.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
165
+ return `'${escaped}'`;
166
+ });
167
+ const command = `node ${escapedArgs.join(' ')}`;
168
+ return launchPopup(command, options);
169
+ }
170
+ /**
171
+ * Launch a popup non-blocking (returns handle immediately)
172
+ * @param command - Command to run in the popup
173
+ * @param options - Popup display options
174
+ * @returns Handle with PID, bounds, and result promise
175
+ */
176
+ export function launchPopupNonBlocking(command, options = {}) {
177
+ const { width = 80, height = 20, title, centered = true, x, y, cwd = process.cwd(), borderStyle = 'double', leftOffset = 0, topOffset = 0, } = options;
178
+ // Calculate popup bounds
179
+ const bounds = calculatePopupBounds(options);
180
+ // Create a temp file for the result
181
+ const resultFile = path.join(os.tmpdir(), `dmux-popup-${Date.now()}.json`);
182
+ // Build tmux popup command
183
+ const args = [
184
+ 'display-popup',
185
+ '-E', // Close on command exit
186
+ '-w', width.toString(),
187
+ '-h', height.toString(),
188
+ '-d', `"${cwd}"`,
189
+ ];
190
+ // Add border style if supported (tmux 3.2+)
191
+ if (borderStyle && borderStyle !== 'none') {
192
+ args.push('-b', borderStyle);
193
+ }
194
+ // Add popup border color (foreground only - respects user's terminal background)
195
+ args.push('-s', `'border-fg=colour${POPUP_CONFIG.tmuxBorderColor}'`);
196
+ // Position: centered or custom
197
+ if (!centered && (leftOffset > 0 || topOffset > 0)) {
198
+ args.push('-x', leftOffset.toString());
199
+ args.push('-y', topOffset.toString());
200
+ }
201
+ else if (!centered && x !== undefined && y !== undefined) {
202
+ args.push('-x', x.toString());
203
+ args.push('-y', y.toString());
204
+ }
205
+ else if (centered && leftOffset > 0) {
206
+ args.push('-x', leftOffset.toString());
207
+ args.push('-y', topOffset.toString());
208
+ }
209
+ else {
210
+ args.push('-x', 'C');
211
+ args.push('-y', 'C');
212
+ }
213
+ // Title
214
+ if (title) {
215
+ args.push('-T', `"${title}"`);
216
+ }
217
+ // Escape the command for tmux
218
+ const escapedCommand = command.replace(/'/g, "'\\''");
219
+ const fullCommand = `tmux ${args.join(' ')} '${escapedCommand}'`;
220
+ // Launch popup with spawn (non-blocking)
221
+ const child = spawn('sh', ['-c', fullCommand], {
222
+ stdio: 'inherit',
223
+ });
224
+ const resultPromise = new Promise((resolve) => {
225
+ child.on('close', () => {
226
+ // Small delay to ensure file is written
227
+ setTimeout(() => {
228
+ // Read result from temp file
229
+ if (fs.existsSync(resultFile)) {
230
+ try {
231
+ const resultData = fs.readFileSync(resultFile, 'utf-8');
232
+ fs.unlinkSync(resultFile); // Clean up
233
+ try {
234
+ const result = JSON.parse(resultData);
235
+ resolve(result);
236
+ }
237
+ catch {
238
+ // Not JSON, treat as plain text
239
+ resolve({
240
+ success: true,
241
+ data: resultData,
242
+ });
243
+ }
244
+ }
245
+ catch (error) {
246
+ resolve({
247
+ success: false,
248
+ error: error.message,
249
+ });
250
+ }
251
+ }
252
+ else {
253
+ // No result file = cancelled
254
+ console.error(`[popup] Result file not found: ${resultFile}`);
255
+ resolve({
256
+ success: false,
257
+ cancelled: true,
258
+ });
259
+ }
260
+ }, 100); // Wait 100ms for file to be written
261
+ });
262
+ child.on('error', (error) => {
263
+ // Clean up temp file if it exists
264
+ if (fs.existsSync(resultFile)) {
265
+ fs.unlinkSync(resultFile);
266
+ }
267
+ resolve({
268
+ success: false,
269
+ error: error.message,
270
+ });
271
+ });
272
+ });
273
+ return {
274
+ pid: child.pid,
275
+ bounds,
276
+ resultPromise,
277
+ kill: () => {
278
+ try {
279
+ child.kill('SIGTERM');
280
+ // Clean up temp file
281
+ if (fs.existsSync(resultFile)) {
282
+ fs.unlinkSync(resultFile);
283
+ }
284
+ }
285
+ catch {
286
+ // Ignore errors if process already dead
287
+ }
288
+ },
289
+ };
290
+ }
291
+ /**
292
+ * Launch a Node.js popup non-blocking (returns handle immediately)
293
+ * @param scriptPath - Path to the compiled JS script
294
+ * @param args - Arguments to pass to the script
295
+ * @param options - Popup display options
296
+ * @returns Handle with PID, bounds, and result promise
297
+ */
298
+ export function launchNodePopupNonBlocking(scriptPath, args = [], options = {}) {
299
+ const { width = 80, height = 20, title, centered = true, x, y, cwd = process.cwd(), borderStyle = 'double', leftOffset = 0, topOffset = 0, } = options;
300
+ // Calculate popup bounds
301
+ const bounds = calculatePopupBounds(options);
302
+ // Get the result file path that the script will write to
303
+ // IMPORTANT: Only create this ONCE - do NOT create it again in child.on('close')
304
+ const resultFile = path.join(os.tmpdir(), `dmux-popup-${Date.now()}.json`);
305
+ // Build node command with proper escaping
306
+ const escapedArgs = [scriptPath, resultFile, ...args].map(arg => {
307
+ const escaped = arg.replace(/\\/g, '\\\\').replace(/'/g, "'\\''");
308
+ return `'${escaped}'`;
309
+ });
310
+ const command = `node ${escapedArgs.join(' ')}`;
311
+ // Build tmux popup command
312
+ const tmuxArgs = [
313
+ 'display-popup',
314
+ '-E', // Close on command exit
315
+ '-w', width.toString(),
316
+ '-h', height.toString(),
317
+ '-d', `"${cwd}"`,
318
+ ];
319
+ // Add border style if supported (tmux 3.2+)
320
+ if (borderStyle && borderStyle !== 'none') {
321
+ tmuxArgs.push('-b', borderStyle);
322
+ }
323
+ // Add popup border color (foreground only - respects user's terminal background)
324
+ tmuxArgs.push('-s', `'border-fg=colour${POPUP_CONFIG.tmuxBorderColor}'`);
325
+ // Position: centered or custom
326
+ if (!centered && (leftOffset > 0 || topOffset > 0)) {
327
+ tmuxArgs.push('-x', leftOffset.toString());
328
+ tmuxArgs.push('-y', topOffset.toString());
329
+ }
330
+ else if (!centered && x !== undefined && y !== undefined) {
331
+ tmuxArgs.push('-x', x.toString());
332
+ tmuxArgs.push('-y', y.toString());
333
+ }
334
+ else if (centered && leftOffset > 0) {
335
+ tmuxArgs.push('-x', leftOffset.toString());
336
+ tmuxArgs.push('-y', topOffset.toString());
337
+ }
338
+ else {
339
+ tmuxArgs.push('-x', 'C');
340
+ tmuxArgs.push('-y', 'C');
341
+ }
342
+ // Title
343
+ if (title) {
344
+ tmuxArgs.push('-T', `"${title}"`);
345
+ }
346
+ // Escape the command for tmux
347
+ const escapedCommand = command.replace(/'/g, "'\\''");
348
+ const fullCommand = `tmux ${tmuxArgs.join(' ')} '${escapedCommand}'`;
349
+ // DEBUG: Log the actual tmux command
350
+ console.error('[DEBUG popup.ts launchNodePopupNonBlocking] Full tmux command:', fullCommand);
351
+ console.error('[DEBUG popup.ts] tmuxBorderColor:', POPUP_CONFIG.tmuxBorderColor);
352
+ // Launch popup with spawn (non-blocking)
353
+ const child = spawn('sh', ['-c', fullCommand], {
354
+ stdio: 'inherit',
355
+ });
356
+ const resultPromise = new Promise((resolve) => {
357
+ child.on('close', () => {
358
+ // Small delay to ensure file is written
359
+ setTimeout(() => {
360
+ // Read result from temp file using the SAME resultFile path we passed to the script
361
+ if (fs.existsSync(resultFile)) {
362
+ try {
363
+ const resultData = fs.readFileSync(resultFile, 'utf-8');
364
+ fs.unlinkSync(resultFile); // Clean up
365
+ try {
366
+ const result = JSON.parse(resultData);
367
+ resolve(result);
368
+ }
369
+ catch {
370
+ // Not JSON, treat as plain text
371
+ resolve({
372
+ success: true,
373
+ data: resultData,
374
+ });
375
+ }
376
+ }
377
+ catch (error) {
378
+ resolve({
379
+ success: false,
380
+ error: error.message,
381
+ });
382
+ }
383
+ }
384
+ else {
385
+ // No result file = cancelled
386
+ console.error(`[popup] Result file not found: ${resultFile}`);
387
+ resolve({
388
+ success: false,
389
+ cancelled: true,
390
+ });
391
+ }
392
+ }, 100); // Wait 100ms for file to be written
393
+ });
394
+ child.on('error', (error) => {
395
+ // Clean up temp file if it exists
396
+ if (fs.existsSync(resultFile)) {
397
+ fs.unlinkSync(resultFile);
398
+ }
399
+ resolve({
400
+ success: false,
401
+ error: error.message,
402
+ });
403
+ });
404
+ });
405
+ return {
406
+ pid: child.pid,
407
+ bounds,
408
+ resultPromise,
409
+ kill: () => {
410
+ try {
411
+ child.kill('SIGTERM');
412
+ // Clean up temp file
413
+ if (fs.existsSync(resultFile)) {
414
+ fs.unlinkSync(resultFile);
415
+ }
416
+ }
417
+ catch {
418
+ // Ignore errors if process already dead
419
+ }
420
+ },
421
+ };
422
+ }
423
+ /**
424
+ * Enable tmux mouse mode for click-outside-to-close popup behavior (session-specific)
425
+ * @param sessionName - The tmux session name to enable mouse mode for
426
+ */
427
+ export function ensureMouseMode(sessionName) {
428
+ try {
429
+ // Check if mouse mode is already enabled for this session
430
+ const mouseStatus = execSync(`tmux show -t ${sessionName} mouse`, {
431
+ encoding: 'utf-8',
432
+ stdio: 'pipe'
433
+ }).trim();
434
+ // If mouse is off, enable it for this session only (not global)
435
+ if (mouseStatus.includes('off')) {
436
+ execSync(`tmux set -t ${sessionName} mouse on`, { stdio: 'pipe' });
437
+ }
438
+ }
439
+ catch {
440
+ // Ignore errors - might not be in tmux session or session doesn't exist yet
441
+ }
442
+ }
443
+ /**
444
+ * Check if tmux supports popups (3.2+)
445
+ */
446
+ export function supportsPopups() {
447
+ try {
448
+ const version = execSync('tmux -V', { encoding: 'utf-8' }).trim();
449
+ // Extract version number (e.g., "tmux 3.2" -> "3.2")
450
+ const match = version.match(/tmux (\d+\.\d+)/);
451
+ if (match) {
452
+ const versionNum = parseFloat(match[1]);
453
+ return versionNum >= 3.2;
454
+ }
455
+ return false;
456
+ }
457
+ catch {
458
+ return false;
459
+ }
460
+ }
461
+ /**
462
+ * Standard popup positioning presets for consistent UX
463
+ */
464
+ export const POPUP_POSITIONING = {
465
+ /**
466
+ * Standard position: top-left corner, offset from sidebar
467
+ * Use this for most popups (menus, dialogs, forms)
468
+ */
469
+ standard(sidebarWidth) {
470
+ return {
471
+ centered: false,
472
+ leftOffset: sidebarWidth + 1,
473
+ topOffset: 0,
474
+ };
475
+ },
476
+ /**
477
+ * Centered with sidebar offset
478
+ * Use for important dialogs like new pane creation
479
+ */
480
+ centeredWithSidebar(sidebarWidth) {
481
+ return {
482
+ centered: true,
483
+ leftOffset: sidebarWidth,
484
+ };
485
+ },
486
+ /**
487
+ * Fully centered (no sidebar consideration)
488
+ * Use only when sidebar doesn't exist or doesn't matter
489
+ */
490
+ fullyCentered() {
491
+ return {
492
+ centered: true,
493
+ };
494
+ },
495
+ /**
496
+ * Large popup that takes up most of the available space
497
+ * Use for logs viewer and other content-heavy popups
498
+ */
499
+ large(sidebarWidth, terminalWidth, terminalHeight) {
500
+ return {
501
+ centered: false,
502
+ leftOffset: sidebarWidth + 1,
503
+ topOffset: 0,
504
+ width: Math.min(terminalWidth - sidebarWidth - 2, 100),
505
+ height: Math.floor(terminalHeight * 0.9),
506
+ };
507
+ },
508
+ };
509
+ //# sourceMappingURL=popup.js.map
@@ -0,0 +1 @@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,CAAC,IAAI,EAAE,CAAC;QAClE,qDAAqD;QACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC/C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,UAAU,IAAI,GAAG,CAAC;QAC3B,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B;;;OAGG;IACH,QAAQ,CAAC,YAAoB;QAC3B,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,YAAY,GAAG,CAAC;YAC5B,SAAS,EAAE,CAAC;SACb,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,mBAAmB,CAAC,YAAoB;QACtC,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,YAAY;SACzB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO;YACL,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAoB,EAAE,aAAqB,EAAE,cAAsB;QACvE,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,YAAY,GAAG,CAAC;YAC5B,SAAS,EAAE,CAAC;YACZ,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,YAAY,GAAG,CAAC,EAAE,GAAG,CAAC;YACtD,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,GAAG,CAAC;SACzC,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared utility for post-pane cleanup operations
3
+ * Handles welcome pane recreation and layout recalculation when last pane is removed
4
+ */
5
+ /**
6
+ * Recreate welcome pane and recalculate layout after the last pane is removed
7
+ * This should be called whenever panes.length transitions from >0 to 0
8
+ *
9
+ * @param projectRoot - The project root directory
10
+ */
11
+ export declare function handleLastPaneRemoved(projectRoot: string): Promise<void>;
12
+ //# sourceMappingURL=postPaneCleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postPaneCleanup.d.ts","sourceRoot":"","sources":["../../src/utils/postPaneCleanup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD9E"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Shared utility for post-pane cleanup operations
3
+ * Handles welcome pane recreation and layout recalculation when last pane is removed
4
+ */
5
+ import { execSync } from 'child_process';
6
+ import { LogService } from '../services/LogService.js';
7
+ /**
8
+ * Recreate welcome pane and recalculate layout after the last pane is removed
9
+ * This should be called whenever panes.length transitions from >0 to 0
10
+ *
11
+ * @param projectRoot - The project root directory
12
+ */
13
+ export async function handleLastPaneRemoved(projectRoot) {
14
+ try {
15
+ // Get the ACTUAL current control pane ID from tmux (don't trust config)
16
+ let controlPaneId;
17
+ try {
18
+ controlPaneId = execSync('tmux display-message -p "#{pane_id}"', {
19
+ encoding: 'utf-8',
20
+ stdio: 'pipe'
21
+ }).trim();
22
+ }
23
+ catch (error) {
24
+ LogService.getInstance().debug('Failed to get current pane ID from tmux', 'postPaneCleanup');
25
+ return;
26
+ }
27
+ if (!controlPaneId) {
28
+ LogService.getInstance().debug('No controlPaneId from tmux, skipping welcome pane recreation', 'postPaneCleanup');
29
+ return;
30
+ }
31
+ LogService.getInstance().debug(`Last pane removed, recreating welcome pane and recalculating layout (controlPaneId: ${controlPaneId})`, 'postPaneCleanup');
32
+ // Recreate welcome pane
33
+ const { createWelcomePaneCoordinated } = await import('./welcomePaneManager.js');
34
+ const created = await createWelcomePaneCoordinated(projectRoot, controlPaneId);
35
+ if (created) {
36
+ LogService.getInstance().debug('Recreated welcome pane after last pane removed', 'postPaneCleanup');
37
+ }
38
+ else {
39
+ LogService.getInstance().debug('Failed to recreate welcome pane', 'postPaneCleanup');
40
+ }
41
+ // Recalculate layout to fix sidebar size
42
+ const { recalculateAndApplyLayout } = await import('./layoutManager.js');
43
+ const { getTerminalDimensions } = await import('./tmux.js');
44
+ const dimensions = getTerminalDimensions();
45
+ recalculateAndApplyLayout(controlPaneId, [], // No content panes
46
+ dimensions.width, dimensions.height);
47
+ LogService.getInstance().debug('Recalculated layout after last pane removed', 'postPaneCleanup');
48
+ }
49
+ catch (error) {
50
+ LogService.getInstance().error('Failed to handle last pane removal', 'postPaneCleanup', undefined, error instanceof Error ? error : undefined);
51
+ }
52
+ }
53
+ //# sourceMappingURL=postPaneCleanup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postPaneCleanup.js","sourceRoot":"","sources":["../../src/utils/postPaneCleanup.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,WAAmB;IAC7D,IAAI,CAAC;QACH,wEAAwE;QACxE,IAAI,aAAqB,CAAC;QAC1B,IAAI,CAAC;YACH,aAAa,GAAG,QAAQ,CAAC,sCAAsC,EAAE;gBAC/D,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,MAAM;aACd,CAAC,CAAC,IAAI,EAAE,CAAC;QACZ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,yCAAyC,EAAE,iBAAiB,CAAC,CAAC;YAC7F,OAAO;QACT,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,UAAU,CAAC,WAAW,EAAE,CAAC,K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
+ * Shell Pane Detection Utility
3
+ *
4
+ * Detects manually-created tmux panes and determines their shell type.
5
+ */
6
+ import type { DmuxPane } from '../types.js';
7
+ /**
8
+ * Detects the shell type running in a tmux pane
9
+ * @param paneId The tmux pane ID (e.g., %1)
10
+ * @returns Shell type (bash, zsh, fish, etc) or 'shell' as fallback
11
+ */
12
+ export declare function detectShellType(paneId: string): string;
13
+ /**
14
+ * Information about an untracked pane
15
+ */
16
+ export interface UntrackedPaneInfo {
17
+ paneId: string;
18
+ title: string;
19
+ command: string;
20
+ }
21
+ /**
22
+ * Gets all untracked tmux panes (panes not in dmux config)
23
+ * @param sessionName The tmux session name
24
+ * @param trackedPaneIds Array of pane IDs already tracked by dmux
25
+ * @param controlPaneId Optional control pane ID to exclude
26
+ * @param welcomePaneId Optional welcome pane ID to exclude
27
+ * @returns Array of untracked pane information
28
+ */
29
+ export declare function getUntrackedPanes(sessionName: string, trackedPaneIds: string[], controlPaneId?: string, welcomePaneId?: string): UntrackedPaneInfo[];
30
+ /**
31
+ * Creates a DmuxPane object for a shell pane
32
+ * @param paneId The tmux pane ID
33
+ * @param nextId The next available dmux ID number
34
+ * @param existingTitle Optional existing title to preserve
35
+ * @returns DmuxPane object for the shell pane
36
+ */
37
+ export declare function createShellPane(paneId: string, nextId: number, existingTitle?: string): DmuxPane;
38
+ /**
39
+ * Gets the next available dmux ID number
40
+ * @param existingPanes Array of existing panes
41
+ * @returns Next available ID number
42
+ */
43
+ export declare function getNextDmuxId(existingPanes: DmuxPane[]): number;
44
+ //# sourceMappingURL=shellPaneDetection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shellPaneDetection.d.ts","sourceRoot":"","sources":["../../src/utils/shellPaneDetection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA2DtD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,MAAM,EAAE,EACxB,aAAa,CAAC,EAAE,MAAM,EACtB,aAAa,CAAC,EAAE,MAAM,GACrB,iBAAiB,EAAE,CA+DrB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAgChG;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,QAAQ,EAAE,GAAG,MAAM,CAc/D"}