dmux 5.2.0 → 5.4.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 (240) hide show
  1. package/README.md +9 -5
  2. package/dist/DmuxApp.d.ts.map +1 -1
  3. package/dist/DmuxApp.js +100 -56
  4. package/dist/DmuxApp.js.map +1 -1
  5. package/dist/actions/implementations/closeAction.d.ts.map +1 -1
  6. package/dist/actions/implementations/closeAction.js +84 -13
  7. package/dist/actions/implementations/closeAction.js.map +1 -1
  8. package/dist/actions/implementations/index.d.ts +1 -0
  9. package/dist/actions/implementations/index.d.ts.map +1 -1
  10. package/dist/actions/implementations/index.js +3 -0
  11. package/dist/actions/implementations/index.js.map +1 -1
  12. package/dist/actions/implementations/mergeAction.d.ts.map +1 -1
  13. package/dist/actions/implementations/mergeAction.js +59 -19
  14. package/dist/actions/implementations/mergeAction.js.map +1 -1
  15. package/dist/actions/index.d.ts.map +1 -1
  16. package/dist/actions/index.js +18 -0
  17. package/dist/actions/index.js.map +1 -1
  18. package/dist/actions/merge/conflictResolution.d.ts.map +1 -1
  19. package/dist/actions/merge/conflictResolution.js +17 -12
  20. package/dist/actions/merge/conflictResolution.js.map +1 -1
  21. package/dist/actions/merge/issueHandlers/mainDirtyHandler.d.ts.map +1 -1
  22. package/dist/actions/merge/issueHandlers/mainDirtyHandler.js +8 -6
  23. package/dist/actions/merge/issueHandlers/mainDirtyHandler.js.map +1 -1
  24. package/dist/actions/merge/issueHandlers/worktreeUncommittedHandler.d.ts +1 -1
  25. package/dist/actions/merge/issueHandlers/worktreeUncommittedHandler.d.ts.map +1 -1
  26. package/dist/actions/merge/issueHandlers/worktreeUncommittedHandler.js +9 -2
  27. package/dist/actions/merge/issueHandlers/worktreeUncommittedHandler.js.map +1 -1
  28. package/dist/actions/merge/multiMergeOrchestrator.d.ts.map +1 -1
  29. package/dist/actions/merge/multiMergeOrchestrator.js +33 -14
  30. package/dist/actions/merge/multiMergeOrchestrator.js.map +1 -1
  31. package/dist/actions/types.d.ts +5 -2
  32. package/dist/actions/types.d.ts.map +1 -1
  33. package/dist/actions/types.js +28 -1
  34. package/dist/actions/types.js.map +1 -1
  35. package/dist/components/dialogs/AgentChoiceDialog.d.ts +2 -1
  36. package/dist/components/dialogs/AgentChoiceDialog.d.ts.map +1 -1
  37. package/dist/components/dialogs/AgentChoiceDialog.js +4 -5
  38. package/dist/components/dialogs/AgentChoiceDialog.js.map +1 -1
  39. package/dist/components/panes/PaneCard.d.ts +1 -3
  40. package/dist/components/panes/PaneCard.d.ts.map +1 -1
  41. package/dist/components/panes/PaneCard.js +54 -37
  42. package/dist/components/panes/PaneCard.js.map +1 -1
  43. package/dist/components/panes/PanesGrid.d.ts +1 -0
  44. package/dist/components/panes/PanesGrid.d.ts.map +1 -1
  45. package/dist/components/panes/PanesGrid.js +60 -78
  46. package/dist/components/panes/PanesGrid.js.map +1 -1
  47. package/dist/components/popups/agentChoicePopup.d.ts +2 -2
  48. package/dist/components/popups/agentChoicePopup.js +90 -56
  49. package/dist/components/popups/agentChoicePopup.js.map +1 -1
  50. package/dist/components/popups/agentChoiceSelection.d.ts +8 -0
  51. package/dist/components/popups/agentChoiceSelection.d.ts.map +1 -0
  52. package/dist/components/popups/agentChoiceSelection.js +14 -0
  53. package/dist/components/popups/agentChoiceSelection.js.map +1 -0
  54. package/dist/components/popups/diffPeekPopup.d.ts +7 -0
  55. package/dist/components/popups/diffPeekPopup.d.ts.map +1 -0
  56. package/dist/components/popups/diffPeekPopup.js +99 -0
  57. package/dist/components/popups/diffPeekPopup.js.map +1 -0
  58. package/dist/components/popups/enabledAgentsPopup.d.ts +7 -0
  59. package/dist/components/popups/enabledAgentsPopup.d.ts.map +1 -0
  60. package/dist/components/popups/enabledAgentsPopup.js +196 -0
  61. package/dist/components/popups/enabledAgentsPopup.js.map +1 -0
  62. package/dist/components/popups/kebabMenuPopup.js +2 -2
  63. package/dist/components/popups/kebabMenuPopup.js.map +1 -1
  64. package/dist/components/popups/mergeUncommittedChoicePopup.d.ts +7 -0
  65. package/dist/components/popups/mergeUncommittedChoicePopup.d.ts.map +1 -0
  66. package/dist/components/popups/mergeUncommittedChoicePopup.js +289 -0
  67. package/dist/components/popups/mergeUncommittedChoicePopup.js.map +1 -0
  68. package/dist/components/popups/newPanePopup.js +8 -0
  69. package/dist/components/popups/newPanePopup.js.map +1 -1
  70. package/dist/components/popups/reopenWorktreePopup.js +33 -3
  71. package/dist/components/popups/reopenWorktreePopup.js.map +1 -1
  72. package/dist/components/popups/settingsPopup.js +346 -25
  73. package/dist/components/popups/settingsPopup.js.map +1 -1
  74. package/dist/components/popups/shortcutsPopup.js +17 -13
  75. package/dist/components/popups/shortcutsPopup.js.map +1 -1
  76. package/dist/components/popups/singleAgentChoicePopup.d.ts +7 -0
  77. package/dist/components/popups/singleAgentChoicePopup.d.ts.map +1 -0
  78. package/dist/components/popups/singleAgentChoicePopup.js +95 -0
  79. package/dist/components/popups/singleAgentChoicePopup.js.map +1 -0
  80. package/dist/components/ui/FooterHelp.js +1 -1
  81. package/dist/components/ui/FooterHelp.js.map +1 -1
  82. package/dist/constants/layout.d.ts +9 -0
  83. package/dist/constants/layout.d.ts.map +1 -0
  84. package/dist/constants/layout.js +9 -0
  85. package/dist/constants/layout.js.map +1 -0
  86. package/dist/hooks/useActionSystem.d.ts +1 -1
  87. package/dist/hooks/useActionSystem.d.ts.map +1 -1
  88. package/dist/hooks/useActionSystem.js +1 -1
  89. package/dist/hooks/useActionSystem.js.map +1 -1
  90. package/dist/hooks/useAgentDetection.d.ts +2 -2
  91. package/dist/hooks/useAgentDetection.d.ts.map +1 -1
  92. package/dist/hooks/useAgentDetection.js +18 -88
  93. package/dist/hooks/useAgentDetection.js.map +1 -1
  94. package/dist/hooks/useAutoUpdater.d.ts.map +1 -1
  95. package/dist/hooks/useAutoUpdater.js +2 -4
  96. package/dist/hooks/useAutoUpdater.js.map +1 -1
  97. package/dist/hooks/useInputHandling.d.ts +5 -0
  98. package/dist/hooks/useInputHandling.d.ts.map +1 -1
  99. package/dist/hooks/useInputHandling.js +230 -22
  100. package/dist/hooks/useInputHandling.js.map +1 -1
  101. package/dist/hooks/useNavigation.d.ts +1 -1
  102. package/dist/hooks/useNavigation.d.ts.map +1 -1
  103. package/dist/hooks/useNavigation.js +26 -4
  104. package/dist/hooks/useNavigation.js.map +1 -1
  105. package/dist/hooks/usePaneCreation.d.ts +5 -2
  106. package/dist/hooks/usePaneCreation.d.ts.map +1 -1
  107. package/dist/hooks/usePaneCreation.js +123 -23
  108. package/dist/hooks/usePaneCreation.js.map +1 -1
  109. package/dist/hooks/usePaneSync.d.ts +1 -1
  110. package/dist/hooks/usePaneSync.d.ts.map +1 -1
  111. package/dist/hooks/usePaneSync.js +14 -1
  112. package/dist/hooks/usePaneSync.js.map +1 -1
  113. package/dist/hooks/usePanes.d.ts.map +1 -1
  114. package/dist/hooks/usePanes.js +19 -5
  115. package/dist/hooks/usePanes.js.map +1 -1
  116. package/dist/hooks/useServices.d.ts +2 -1
  117. package/dist/hooks/useServices.d.ts.map +1 -1
  118. package/dist/hooks/useServices.js +4 -2
  119. package/dist/hooks/useServices.js.map +1 -1
  120. package/dist/index.js +200 -21
  121. package/dist/index.js.map +1 -1
  122. package/dist/layout/LayoutCalculator.d.ts.map +1 -1
  123. package/dist/layout/LayoutCalculator.js +4 -1
  124. package/dist/layout/LayoutCalculator.js.map +1 -1
  125. package/dist/layout/SpacerManager.d.ts.map +1 -1
  126. package/dist/layout/SpacerManager.js +2 -1
  127. package/dist/layout/SpacerManager.js.map +1 -1
  128. package/dist/services/PaneEventService.d.ts.map +1 -1
  129. package/dist/services/PaneEventService.js +2 -5
  130. package/dist/services/PaneEventService.js.map +1 -1
  131. package/dist/services/PaneWorkerManager.d.ts.map +1 -1
  132. package/dist/services/PaneWorkerManager.js +2 -14
  133. package/dist/services/PaneWorkerManager.js.map +1 -1
  134. package/dist/services/PopupManager.d.ts +14 -2
  135. package/dist/services/PopupManager.d.ts.map +1 -1
  136. package/dist/services/PopupManager.js +162 -24
  137. package/dist/services/PopupManager.js.map +1 -1
  138. package/dist/services/TmuxHookManager.d.ts.map +1 -1
  139. package/dist/services/TmuxHookManager.js +4 -2
  140. package/dist/services/TmuxHookManager.js.map +1 -1
  141. package/dist/services/TmuxService.d.ts +9 -0
  142. package/dist/services/TmuxService.d.ts.map +1 -1
  143. package/dist/services/TmuxService.js +18 -2
  144. package/dist/services/TmuxService.js.map +1 -1
  145. package/dist/types.d.ts +11 -3
  146. package/dist/types.d.ts.map +1 -1
  147. package/dist/utils/agentDetection.d.ts +15 -8
  148. package/dist/utils/agentDetection.d.ts.map +1 -1
  149. package/dist/utils/agentDetection.js +49 -73
  150. package/dist/utils/agentDetection.js.map +1 -1
  151. package/dist/utils/agentLaunch.d.ts +60 -2
  152. package/dist/utils/agentLaunch.d.ts.map +1 -1
  153. package/dist/utils/agentLaunch.js +490 -41
  154. package/dist/utils/agentLaunch.js.map +1 -1
  155. package/dist/utils/agentPromptDispatch.d.ts +33 -0
  156. package/dist/utils/agentPromptDispatch.d.ts.map +1 -0
  157. package/dist/utils/agentPromptDispatch.js +99 -0
  158. package/dist/utils/agentPromptDispatch.js.map +1 -0
  159. package/dist/utils/asciiArt.d.ts.map +1 -1
  160. package/dist/utils/asciiArt.js +6 -7
  161. package/dist/utils/asciiArt.js.map +1 -1
  162. package/dist/utils/attachAgent.d.ts +25 -0
  163. package/dist/utils/attachAgent.d.ts.map +1 -0
  164. package/dist/utils/attachAgent.js +139 -0
  165. package/dist/utils/attachAgent.js.map +1 -0
  166. package/dist/utils/conflictResolutionPane.d.ts +2 -1
  167. package/dist/utils/conflictResolutionPane.d.ts.map +1 -1
  168. package/dist/utils/conflictResolutionPane.js +48 -53
  169. package/dist/utils/conflictResolutionPane.js.map +1 -1
  170. package/dist/utils/controlPaneRecovery.d.ts +2 -0
  171. package/dist/utils/controlPaneRecovery.d.ts.map +1 -0
  172. package/dist/utils/controlPaneRecovery.js +156 -0
  173. package/dist/utils/controlPaneRecovery.js.map +1 -0
  174. package/dist/utils/devSource.d.ts +7 -0
  175. package/dist/utils/devSource.d.ts.map +1 -0
  176. package/dist/utils/devSource.js +19 -0
  177. package/dist/utils/devSource.js.map +1 -0
  178. package/dist/utils/devWatchCommand.d.ts +8 -0
  179. package/dist/utils/devWatchCommand.d.ts.map +1 -0
  180. package/dist/utils/devWatchCommand.js +14 -0
  181. package/dist/utils/devWatchCommand.js.map +1 -0
  182. package/dist/utils/geminiTrust.d.ts +8 -0
  183. package/dist/utils/geminiTrust.d.ts.map +1 -0
  184. package/dist/utils/geminiTrust.js +67 -0
  185. package/dist/utils/geminiTrust.js.map +1 -0
  186. package/dist/utils/generated-agents-doc.d.ts +1 -1
  187. package/dist/utils/generated-agents-doc.js +3 -3
  188. package/dist/utils/hooksDocs.d.ts +2 -9
  189. package/dist/utils/hooksDocs.d.ts.map +1 -1
  190. package/dist/utils/hooksDocs.js +26 -6
  191. package/dist/utils/hooksDocs.js.map +1 -1
  192. package/dist/utils/layoutManager.d.ts +5 -1
  193. package/dist/utils/layoutManager.d.ts.map +1 -1
  194. package/dist/utils/layoutManager.js +103 -26
  195. package/dist/utils/layoutManager.js.map +1 -1
  196. package/dist/utils/paneCreation.d.ts +8 -2
  197. package/dist/utils/paneCreation.d.ts.map +1 -1
  198. package/dist/utils/paneCreation.js +82 -105
  199. package/dist/utils/paneCreation.js.map +1 -1
  200. package/dist/utils/paneGrouping.d.ts.map +1 -1
  201. package/dist/utils/paneGrouping.js +30 -0
  202. package/dist/utils/paneGrouping.js.map +1 -1
  203. package/dist/utils/projectActions.d.ts +5 -0
  204. package/dist/utils/projectActions.d.ts.map +1 -1
  205. package/dist/utils/projectActions.js +15 -4
  206. package/dist/utils/projectActions.js.map +1 -1
  207. package/dist/utils/reopenWorktree.d.ts +1 -1
  208. package/dist/utils/reopenWorktree.d.ts.map +1 -1
  209. package/dist/utils/reopenWorktree.js +23 -31
  210. package/dist/utils/reopenWorktree.js.map +1 -1
  211. package/dist/utils/runtimePaths.d.ts +2 -0
  212. package/dist/utils/runtimePaths.d.ts.map +1 -0
  213. package/dist/utils/runtimePaths.js +8 -0
  214. package/dist/utils/runtimePaths.js.map +1 -0
  215. package/dist/utils/settingsManager.d.ts +3 -0
  216. package/dist/utils/settingsManager.d.ts.map +1 -1
  217. package/dist/utils/settingsManager.js +200 -9
  218. package/dist/utils/settingsManager.js.map +1 -1
  219. package/dist/utils/systemCheck.d.ts.map +1 -1
  220. package/dist/utils/systemCheck.js +0 -13
  221. package/dist/utils/systemCheck.js.map +1 -1
  222. package/dist/utils/tmux.d.ts +5 -1
  223. package/dist/utils/tmux.d.ts.map +1 -1
  224. package/dist/utils/tmux.js +23 -5
  225. package/dist/utils/tmux.js.map +1 -1
  226. package/dist/utils/tmuxHookCommands.d.ts +14 -0
  227. package/dist/utils/tmuxHookCommands.d.ts.map +1 -0
  228. package/dist/utils/tmuxHookCommands.js +30 -0
  229. package/dist/utils/tmuxHookCommands.js.map +1 -0
  230. package/dist/utils/welcomePane.d.ts +2 -1
  231. package/dist/utils/welcomePane.d.ts.map +1 -1
  232. package/dist/utils/welcomePane.js +3 -2
  233. package/dist/utils/welcomePane.js.map +1 -1
  234. package/dist/utils/welcomePaneManager.js +1 -1
  235. package/dist/utils/welcomePaneManager.js.map +1 -1
  236. package/dist/workers/PaneWorker.js.map +1 -1
  237. package/dist/workers/WorkerMessages.d.ts +2 -1
  238. package/dist/workers/WorkerMessages.d.ts.map +1 -1
  239. package/dist/workers/WorkerMessages.js.map +1 -1
  240. package/package.json +11 -6
@@ -0,0 +1,156 @@
1
+ import { spawnSync } from 'child_process';
2
+ import fs from 'fs/promises';
3
+ import path from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import { SIDEBAR_WIDTH } from './layoutManager.js';
6
+ import { atomicWriteJson } from './atomicWrite.js';
7
+ function runTmux(args) {
8
+ const result = spawnSync('tmux', args, {
9
+ encoding: 'utf-8',
10
+ stdio: 'pipe',
11
+ });
12
+ return {
13
+ ok: result.status === 0,
14
+ stdout: (result.stdout || '').trim(),
15
+ };
16
+ }
17
+ function getSessionOption(sessionName, optionName) {
18
+ const result = runTmux(['show-options', '-v', '-t', sessionName, optionName]);
19
+ if (!result.ok || !result.stdout) {
20
+ return undefined;
21
+ }
22
+ return result.stdout;
23
+ }
24
+ async function readConfig(configPath) {
25
+ try {
26
+ const raw = await fs.readFile(configPath, 'utf-8');
27
+ const parsed = JSON.parse(raw);
28
+ if (Array.isArray(parsed) || !parsed || typeof parsed !== 'object') {
29
+ return null;
30
+ }
31
+ return parsed;
32
+ }
33
+ catch {
34
+ return null;
35
+ }
36
+ }
37
+ function parsePaneRows(output) {
38
+ if (!output)
39
+ return [];
40
+ return output
41
+ .split('\n')
42
+ .map((line) => line.trim())
43
+ .filter(Boolean)
44
+ .map((line) => {
45
+ const [paneId, paneTitle] = line.split('\t');
46
+ return {
47
+ paneId,
48
+ paneTitle: paneTitle || '',
49
+ };
50
+ })
51
+ .filter((pane) => pane.paneId.startsWith('%'));
52
+ }
53
+ function resolveDistIndexPath() {
54
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'index.js');
55
+ }
56
+ async function recoverControlPaneIfNeeded() {
57
+ let decodedSession = '';
58
+ if (process.env.DMUX_RECOVERY_SESSION_B64) {
59
+ try {
60
+ decodedSession = Buffer.from(process.env.DMUX_RECOVERY_SESSION_B64, 'base64').toString('utf-8');
61
+ }
62
+ catch {
63
+ decodedSession = '';
64
+ }
65
+ }
66
+ const resolvedSessionFromTmux = runTmux(['display-message', '-p', '#S']);
67
+ const sessionName = decodedSession
68
+ || process.env.DMUX_RECOVERY_SESSION
69
+ || (resolvedSessionFromTmux.ok ? resolvedSessionFromTmux.stdout : '')
70
+ || '';
71
+ const exitedPaneIdRaw = process.env.DMUX_RECOVERY_EXITED_PANE || '';
72
+ const exitedPaneId = exitedPaneIdRaw.startsWith('#{') ? '' : exitedPaneIdRaw;
73
+ if (!sessionName) {
74
+ return;
75
+ }
76
+ const configPath = getSessionOption(sessionName, '@dmux_config_path');
77
+ if (!configPath) {
78
+ return;
79
+ }
80
+ const config = await readConfig(configPath);
81
+ if (!config) {
82
+ return;
83
+ }
84
+ const controlPaneId = typeof config.controlPaneId === 'string'
85
+ ? config.controlPaneId
86
+ : '';
87
+ if (!controlPaneId) {
88
+ return;
89
+ }
90
+ const paneList = runTmux([
91
+ 'list-panes',
92
+ '-t',
93
+ sessionName,
94
+ '-F',
95
+ '#{pane_id}\t#{pane_title}',
96
+ ]);
97
+ if (!paneList.ok) {
98
+ return;
99
+ }
100
+ const panes = parsePaneRows(paneList.stdout);
101
+ if (panes.length === 0) {
102
+ return;
103
+ }
104
+ const controlStillExists = panes.some((pane) => pane.paneId === controlPaneId);
105
+ if (controlStillExists) {
106
+ return;
107
+ }
108
+ // Only recover from this hook when the exited pane is the tracked control pane.
109
+ if (exitedPaneId && exitedPaneId !== controlPaneId) {
110
+ return;
111
+ }
112
+ // If dmux already exists in another pane, just update config ownership.
113
+ const existingDmuxPane = panes.find((pane) => pane.paneTitle === 'dmux');
114
+ if (existingDmuxPane) {
115
+ config.controlPaneId = existingDmuxPane.paneId;
116
+ config.controlPaneSize = SIDEBAR_WIDTH;
117
+ config.lastUpdated = new Date().toISOString();
118
+ await atomicWriteJson(configPath, config);
119
+ return;
120
+ }
121
+ const projectRootFromOption = getSessionOption(sessionName, '@dmux_project_root');
122
+ const projectRoot = projectRootFromOption
123
+ || (typeof config.projectRoot === 'string' ? config.projectRoot : '')
124
+ || path.dirname(path.dirname(configPath));
125
+ const anchorPaneId = panes[0]?.paneId;
126
+ if (!anchorPaneId) {
127
+ return;
128
+ }
129
+ // Recreate a left sidebar pane and launch dmux there.
130
+ const splitResult = runTmux([
131
+ 'split-window',
132
+ '-b',
133
+ '-h',
134
+ '-t',
135
+ anchorPaneId,
136
+ '-l',
137
+ String(SIDEBAR_WIDTH),
138
+ '-c',
139
+ projectRoot,
140
+ '-P',
141
+ '-F',
142
+ '#{pane_id}',
143
+ ]);
144
+ if (!splitResult.ok || !splitResult.stdout) {
145
+ return;
146
+ }
147
+ const newControlPaneId = splitResult.stdout.trim();
148
+ runTmux(['select-pane', '-t', newControlPaneId, '-T', 'dmux']);
149
+ runTmux(['send-keys', '-t', newControlPaneId, `node "${resolveDistIndexPath()}"`, 'Enter']);
150
+ config.controlPaneId = newControlPaneId;
151
+ config.controlPaneSize = SIDEBAR_WIDTH;
152
+ config.lastUpdated = new Date().toISOString();
153
+ await atomicWriteJson(configPath, config);
154
+ }
155
+ void recoverControlPaneIfNeeded();
156
+ //# sourceMappingURL=controlPaneRecovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controlPaneRecovery.js","sourceRoot":"","sources":["../../src/utils/controlPaneRecovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAoBnD,SAAS,OAAO,CAAC,IAAc;IAC7B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE;QACrC,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,MAAM;KACd,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QACvB,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;KACrC,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,WAAmB,EAAE,UAAkB;IAC/D,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,C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C,UAAU,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,KAAK,0BAA0B,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface DevSourceResolution {
2
+ nextSourcePath: string;
3
+ toggledToRoot: boolean;
4
+ }
5
+ export declare function isActiveDevSourcePath(paneWorktreePath?: string, activeSourcePath?: string): boolean;
6
+ export declare function resolveNextDevSourcePath(paneWorktreePath: string, activeSourcePath: string, projectRoot: string): DevSourceResolution;
7
+ //# sourceMappingURL=devSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devSource.d.ts","sourceRoot":"","sources":["../../src/utils/devSource.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;CACvB;AAED,wBAAgB,qBAAqB,CACnC,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAGT;AAED,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,MAAM,GAClB,mBAAmB,CAYrB"}
@@ -0,0 +1,19 @@
1
+ import path from "path";
2
+ export function isActiveDevSourcePath(paneWorktreePath, activeSourcePath) {
3
+ if (!paneWorktreePath || !activeSourcePath)
4
+ return false;
5
+ return path.resolve(paneWorktreePath) === path.resolve(activeSourcePath);
6
+ }
7
+ export function resolveNextDevSourcePath(paneWorktreePath, activeSourcePath, projectRoot) {
8
+ if (isActiveDevSourcePath(paneWorktreePath, activeSourcePath)) {
9
+ return {
10
+ nextSourcePath: projectRoot,
11
+ toggledToRoot: true,
12
+ };
13
+ }
14
+ return {
15
+ nextSourcePath: paneWorktreePath,
16
+ toggledToRoot: false,
17
+ };
18
+ }
19
+ //# sourceMappingURL=devSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devSource.js","sourceRoot":"","sources":["../../src/utils/devSource.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAOvB,MAAM,UAAU,qBAAqB,CACnC,gBAAyB,EACzB,gBAAyB;IAEzB,IAAI,CAAC,gBAAgB,IAAI,CAAC,gBAAgB;QAAE,OAAO,KAAK,CAAA;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAC1E,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,gBAAwB,EACxB,gBAAwB,EACxB,WAAmB;IAEnB,IAAI,qBAAqB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,CAAC;QAC9D,OAAO;YACL,cAAc,EAAE,WAAW;YAC3B,aAAa,EAAE,IAAI;SACpB,CAAA;IACH,CAAC;IAED,OAAO;QACL,cAAc,EAAE,gBAAgB;QAChC,aAAa,EAAE,KAAK;KACrB,CAAA;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Build a shell-safe command for restarting dmux dev watch from a source path.
3
+ * For respawned tmux panes, we append an interactive shell so the pane stays open
4
+ * after dmux exits intentionally.
5
+ */
6
+ export declare function buildDevWatchCommand(sourcePath: string): string;
7
+ export declare function buildDevWatchRespawnCommand(sourcePath: string): string;
8
+ //# sourceMappingURL=devWatchCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devWatchCommand.d.ts","sourceRoot":"","sources":["../../src/utils/devWatchCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Build a shell-safe command for restarting dmux dev watch from a source path.
3
+ * For respawned tmux panes, we append an interactive shell so the pane stays open
4
+ * after dmux exits intentionally.
5
+ */
6
+ const escapeForDoubleQuotedShell = (value) => value.replace(/([\\$"`])/g, "\\$1");
7
+ export function buildDevWatchCommand(sourcePath) {
8
+ const escapedPath = escapeForDoubleQuotedShell(sourcePath);
9
+ return `cd "${escapedPath}" && pnpm dev:watch`;
10
+ }
11
+ export function buildDevWatchRespawnCommand(sourcePath) {
12
+ return `${buildDevWatchCommand(sourcePath)}; exec "\${SHELL:-/bin/zsh}" -l`;
13
+ }
14
+ //# sourceMappingURL=devWatchCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devWatchCommand.js","sourceRoot":"","sources":["../../src/utils/devWatchCommand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,0BAA0B,GAAG,CAAC,KAAa,EAAU,EAAE,CAC3D,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAEtC,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,MAAM,WAAW,GAAG,0BAA0B,CAAC,UAAU,CAAC,CAAC;IAC3D,OAAO,OAAO,WAAW,qBAAqB,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,UAAkB;IAC5D,OAAO,GAAG,oBAAoB,CAAC,UAAU,CAAC,iCAAiC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Ensure Gemini treats the given workspace path as trusted.
3
+ *
4
+ * Gemini blocks interactive startup prompts in untrusted folders, which
5
+ * prevents dmux initial prompt bootstrap from running in fresh worktrees.
6
+ */
7
+ export declare function ensureGeminiFolderTrusted(workspacePath: string): void;
8
+ //# sourceMappingURL=geminiTrust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geminiTrust.d.ts","sourceRoot":"","sources":["../../src/utils/geminiTrust.ts"],"names":[],"mappings":"AAgDA;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAwBrE"}
@@ -0,0 +1,67 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { atomicWriteJsonSync } from './atomicWrite.js';
4
+ const TRUSTED_LEVEL = 'TRUST_FOLDER';
5
+ const DEFAULT_GEMINI_DIR = '.gemini';
6
+ const TRUSTED_FOLDERS_FILENAME = 'trustedFolders.json';
7
+ function getTrustedFoldersPath() {
8
+ const overridePath = process.env.GEMINI_CLI_TRUSTED_FOLDERS_PATH;
9
+ if (overridePath && overridePath.trim().length > 0) {
10
+ return overridePath;
11
+ }
12
+ const home = process.env.HOME || '';
13
+ if (!home) {
14
+ return '';
15
+ }
16
+ return path.join(home, DEFAULT_GEMINI_DIR, TRUSTED_FOLDERS_FILENAME);
17
+ }
18
+ function readTrustedFoldersConfig(filePath) {
19
+ if (!filePath || !fs.existsSync(filePath)) {
20
+ return {};
21
+ }
22
+ try {
23
+ const raw = fs.readFileSync(filePath, 'utf-8');
24
+ const parsed = JSON.parse(raw);
25
+ if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
26
+ const trustedFolders = {};
27
+ for (const [key, value] of Object.entries(parsed)) {
28
+ if (typeof value === 'string') {
29
+ trustedFolders[key] = value;
30
+ }
31
+ }
32
+ return trustedFolders;
33
+ }
34
+ }
35
+ catch {
36
+ // Fall through to empty config on parse/read errors.
37
+ }
38
+ return {};
39
+ }
40
+ /**
41
+ * Ensure Gemini treats the given workspace path as trusted.
42
+ *
43
+ * Gemini blocks interactive startup prompts in untrusted folders, which
44
+ * prevents dmux initial prompt bootstrap from running in fresh worktrees.
45
+ */
46
+ export function ensureGeminiFolderTrusted(workspacePath) {
47
+ const trustedFoldersPath = getTrustedFoldersPath();
48
+ if (!trustedFoldersPath || !workspacePath) {
49
+ return;
50
+ }
51
+ const resolvedWorkspacePath = path.resolve(workspacePath);
52
+ const trustedFolders = readTrustedFoldersConfig(trustedFoldersPath);
53
+ if (trustedFolders[resolvedWorkspacePath] === TRUSTED_LEVEL) {
54
+ return;
55
+ }
56
+ trustedFolders[resolvedWorkspacePath] = TRUSTED_LEVEL;
57
+ const trustedFoldersDir = path.dirname(trustedFoldersPath);
58
+ fs.mkdirSync(trustedFoldersDir, { recursive: true });
59
+ atomicWriteJsonSync(trustedFoldersPath, trustedFolders, true);
60
+ try {
61
+ fs.chmodSync(trustedFoldersPath, 0o600);
62
+ }
63
+ catch {
64
+ // Ignore chmod failures on environments that do not support POSIX permissions.
65
+ }
66
+ }
67
+ //# sourceMappingURL=geminiTrust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geminiTrust.js","sourceRoot":"","sources":["../../src/utils/geminiTrust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,aAAa,GAAG,cAAc,CAAC;AACrC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AACrC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAIvD,SAAS,qBAAqB;IAC5B,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;IACjE,IAAI,YAAY,IAAI,YAAY,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnD,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,wBAAwB,CAAC,QAAgB;IAChD,IAAI,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1C,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI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AAE,IAAI,EAAE,CAAC,CAAC;IACrD,mBAAmB,CAAC,kBAAkB,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAE9D,IAAI,CAAC;QACH,EAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,+EAA+E;IACjF,CAAC;AACH,CAAC"}
@@ -2,5 +2,5 @@
2
2
  * Auto-generated AGENTS.md content
3
3
  * DO NOT EDIT MANUALLY - run 'pnpm generate:hooks-docs' to regenerate
4
4
  */
5
- export declare const AGENTS_MD = "# dmux Hooks System - Agent Reference\n\n**Auto-generated documentation for AI agents**\n\nThis document contains everything an AI agent needs to create, modify, and understand dmux hooks. It is automatically generated from the dmux source code and embedded in the binary.\n\n## What You're Working On\n\nYou are editing hooks for **dmux**, a tmux pane manager that creates AI-powered development workflows. Each pane runs in its own git worktree with an AI agent (Claude Code or opencode).\n\n## Your Goal\n\nCreate executable bash scripts in `.dmux-hooks/` that run automatically at key lifecycle events.\n\n## Quick Start\n\n1. **Create a hook file**: `touch .dmux-hooks/worktree_created`\n2. **Make it executable**: `chmod +x .dmux-hooks/worktree_created`\n3. **Add shebang**: Start with `#!/bin/bash`\n4. **Use environment variables**: Access `$DMUX_ROOT`, `$DMUX_WORKTREE_PATH`, etc.\n5. **Test it**: Set env vars manually and run the script\n\n## Hook Execution Model\n\n- **Non-blocking**: Hooks run in background (detached processes)\n- **Silent failures**: Hook errors are logged but don't stop dmux\n- **Environment-based**: All context passed via environment variables\n- **Version controlled**: Hooks in `.dmux-hooks/` are shared with team\n- **Priority resolution**: `.dmux-hooks/` \u2192 `.dmux/hooks/` \u2192 `~/.dmux/hooks/`\n\n## Available Hooks\n\n### Pane Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `before_pane_create` | Before pane creation | Validation, notifications, pre-flight checks |\n| `pane_created` | After pane, before worktree | Configure tmux settings, prepare environment |\n| `worktree_created` | After full setup | Install deps, copy configs, setup git |\n| `before_pane_close` | Before closing | Save state, backup uncommitted work |\n| `pane_closed` | After closed | Cleanup resources, analytics, notifications |\n\n### Worktree Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `before_worktree_remove` | Before worktree removal | Archive worktree, save artifacts |\n| `worktree_removed` | After worktree removed | Cleanup external references |\n\n### Merge Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `pre_merge` | Before merge operation | Run final tests, create backups |\n| `post_merge` | After successful merge | Deploy, close issues, notify team |\n\n### Interactive Hooks (with HTTP callbacks)\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `run_test` | When tests triggered | Run test suite, report status via HTTP |\n| `run_dev` | When dev server triggered | Start dev server, create tunnel, report URL |\n\n\n## Environment Variables\n\n### Always Available\n```bash\nDMUX_ROOT=\"/path/to/project\" # Project root directory\nDMUX_SERVER_PORT=\"3142\" # HTTP server port\n```\n\n### Pane Context (most hooks)\n```bash\nDMUX_PANE_ID=\"dmux-1234567890\" # dmux pane identifier\nDMUX_SLUG=\"fix-auth-bug\" # Branch/worktree name\nDMUX_PROMPT=\"Fix authentication bug\" # User's prompt\nDMUX_AGENT=\"claude\" # Agent type (claude|opencode)\nDMUX_TMUX_PANE_ID=\"%38\" # tmux pane ID\n```\n\n### Worktree Context\n```bash\nDMUX_WORKTREE_PATH=\"/path/.dmux/worktrees/fix-auth-bug\"\nDMUX_BRANCH=\"fix-auth-bug\" # Same as slug\n```\n\n### Merge Context\n```bash\nDMUX_TARGET_BRANCH=\"main\" # Branch being merged into\n```\n\n## HTTP Callback API\n\nInteractive hooks (`run_test` and `run_dev`) can update dmux UI via HTTP.\n\n### Update Test Status\n```bash\ncurl -X PUT \"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\", \"output\": \"optional test output\"}'\n\n# Status values: \"running\" | \"passed\" | \"failed\"\n```\n\n### Update Dev Server\n```bash\ncurl -X PUT \"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\", \"url\": \"http://localhost:3000\"}'\n\n# Status values: \"running\" | \"stopped\"\n# url: Can be localhost or tunnel URL (ngrok, cloudflared, etc.)\n```\n\n## Common Patterns\n\n### Pattern 1: Install Dependencies\n```bash\n#!/bin/bash\n# .dmux-hooks/worktree_created\n\ncd \"$DMUX_WORKTREE_PATH\"\n\nif [ -f \"pnpm-lock.yaml\" ]; then\n pnpm install --prefer-offline &\nelif [ -f \"package-lock.json\" ]; then\n npm install &\nelif [ -f \"yarn.lock\" ]; then\n yarn install &\nelif [ -f \"Gemfile\" ]; then\n bundle install &\nelif [ -f \"requirements.txt\" ]; then\n pip install -r requirements.txt &\nelif [ -f \"Cargo.toml\" ]; then\n cargo build &\nfi\n```\n\n### Pattern 2: Copy Configuration\n```bash\n#!/bin/bash\n# .dmux-hooks/worktree_created\n\n# Copy environment file\nif [ -f \"$DMUX_ROOT/.env.local\" ]; then\n cp \"$DMUX_ROOT/.env.local\" \"$DMUX_WORKTREE_PATH/.env.local\"\nfi\n\n# Copy other config files\nfor file in .env.development .npmrc .yarnrc; do\n if [ -f \"$DMUX_ROOT/$file\" ]; then\n cp \"$DMUX_ROOT/$file\" \"$DMUX_WORKTREE_PATH/$file\"\n fi\ndone\n```\n\n### Pattern 3: Run Tests with Status Updates\n```bash\n#!/bin/bash\n# .dmux-hooks/run_test\n\nset -e\ncd \"$DMUX_WORKTREE_PATH\"\nAPI=\"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test\"\n\n# Update: starting\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\"}' > /dev/null\n\n# Run tests and capture output\nOUTPUT_FILE=\"/tmp/dmux-test-$DMUX_PANE_ID.txt\"\nif pnpm test > \"$OUTPUT_FILE\" 2>&1; then\n STATUS=\"passed\"\nelse\n STATUS=\"failed\"\nfi\n\n# Get output (truncate if too long)\nOUTPUT=$(head -c 5000 \"$OUTPUT_FILE\")\n\n# Update: complete\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d \"$(jq -n --arg status \"$STATUS\" --arg output \"$OUTPUT\" '{status: $status, output: $output}')\" > /dev/null\n\nrm -f \"$OUTPUT_FILE\"\n```\n\n### Pattern 4: Dev Server with Tunnel\n```bash\n#!/bin/bash\n# .dmux-hooks/run_dev\n\nset -e\ncd \"$DMUX_WORKTREE_PATH\"\nAPI=\"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev\"\n\n# Start dev server in background\nLOG_FILE=\"/tmp/dmux-dev-$DMUX_PANE_ID.log\"\npnpm dev > \"$LOG_FILE\" 2>&1 &\nDEV_PID=$!\n\n# Wait for server to start\nsleep 5\n\n# Detect port from logs\nPORT=$(grep -oP 'localhost:Kd+' \"$LOG_FILE\" | head -1)\n[ -z \"$PORT\" ] && PORT=3000\n\n# Optional: Create tunnel with cloudflared\nif command -v cloudflared &> /dev/null; then\n TUNNEL=$(cloudflared tunnel --url \"http://localhost:$PORT\" 2>&1 | grep -oP 'https://[a-z0-9-]+.trycloudflare.com' | head -1)\n URL=\"${TUNNEL:-http://localhost:$PORT}\"\nelse\n URL=\"http://localhost:$PORT\"\nfi\n\n# Report status\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d \"{\"status\": \"running\", \"url\": \"$URL\"}\" > /dev/null\n\necho \"[Hook] Dev server running at $URL (PID: $DEV_PID)\"\n```\n\n### Pattern 5: Post-Merge Deployment\n```bash\n#!/bin/bash\n# .dmux-hooks/post_merge\n\nset -e\ncd \"$DMUX_ROOT\"\n\n# Only deploy from main/master\nif [ \"$DMUX_TARGET_BRANCH\" != \"main\" ] && [ \"$DMUX_TARGET_BRANCH\" != \"master\" ]; then\n exit 0\nfi\n\n# Push to remote\ngit push origin \"$DMUX_TARGET_BRANCH\"\n\n# Trigger deployment (example: Vercel)\nif [ -n \"$VERCEL_TOKEN\" ]; then\n curl -s -X POST \"https://api.vercel.com/v1/deployments\" -H \"Authorization: Bearer $VERCEL_TOKEN\" -H \"Content-Type: application/json\" -d '{\"name\": \"my-project\"}' > /dev/null\nfi\n\n# Close GitHub issue if prompt contains #123\nISSUE=$(echo \"$DMUX_PROMPT\" | grep -oP '#Kd+' | head -1)\nif [ -n \"$ISSUE\" ] && command -v gh &> /dev/null; then\n gh issue close \"$ISSUE\" -c \"Resolved in $DMUX_SLUG, merged to $DMUX_TARGET_BRANCH\" 2>/dev/null || true\nfi\n```\n\n## Best Practices\n\n1. **Always start with shebang**: `#!/bin/bash`\n2. **Set error handling**: `set -e` (exit on error)\n3. **Make executable**: `chmod +x .dmux-hooks/hook_name`\n4. **Background long operations**: Append `&` to avoid blocking\n5. **Check for required tools**: `command -v tool &> /dev/null`\n6. **Log for debugging**: `echo \"[Hook] message\" >> \"$DMUX_ROOT/.dmux/hooks.log\"`\n7. **Handle missing vars gracefully**: `[ -z \"$VAR\" ] && exit 0`\n8. **Use silent curl**: `curl -s` to avoid noise in logs\n9. **Clean up temp files**: Remove files in `/tmp/`\n10. **Test before committing**: Run hooks manually with mock env vars\n\n## Testing Hooks\n\n### Manual Testing\n```bash\n# 1. Set environment variables\nexport DMUX_ROOT=\"$(pwd)\"\nexport DMUX_PANE_ID=\"test-pane\"\nexport DMUX_SLUG=\"test-branch\"\nexport DMUX_WORKTREE_PATH=\"$(pwd)\"\nexport DMUX_SERVER_PORT=\"3142\"\nexport DMUX_AGENT=\"claude\"\nexport DMUX_PROMPT=\"Test prompt\"\n\n# 2. Run hook directly\n./.dmux-hooks/worktree_created\n\n# 3. Check exit code\necho $? # Should be 0 for success\n```\n\n### Syntax Check\n```bash\n# Check for syntax errors without running\nbash -n ./.dmux-hooks/worktree_created\n```\n\n### Shellcheck (if available)\n```bash\nshellcheck ./.dmux-hooks/worktree_created\n```\n\n## Project Context Analysis\n\nBefore creating hooks, analyze these files in the project:\n\n### Package Manager Detection\n```bash\n# Check which package manager is used\nif [ -f \"pnpm-lock.yaml\" ]; then\n # Use: pnpm install, pnpm test, pnpm dev\nelif [ -f \"package-lock.json\" ]; then\n # Use: npm install, npm test, npm run dev\nelif [ -f \"yarn.lock\" ]; then\n # Use: yarn install, yarn test, yarn dev\nfi\n```\n\n### Test Command Discovery\n```bash\n# Read package.json to find test command\ncat package.json | grep '\"test\"'\n# Or with jq:\njq -r '.scripts.test' package.json\n```\n\n### Dev Command Discovery\n```bash\n# Read package.json to find dev command\ncat package.json | grep '\"dev\"'\n# Or with jq:\njq -r '.scripts.dev' package.json\n```\n\n### Environment Variables\n```bash\n# Check for .env files to copy\nls -la | grep '.env'\n```\n\n### Build System\n```bash\n# Detect build system\nif [ -f \"vite.config.ts\" ]; then\n # Vite project\nelif [ -f \"next.config.js\" ]; then\n # Next.js project\nelif [ -f \"nuxt.config.ts\" ]; then\n # Nuxt project\nfi\n```\n\n## Common Mistakes to Avoid\n\n\u274C **Blocking operations**: `sleep 60` (blocks dmux)\n\u2705 **Background long tasks**: `slow_operation &`\n\n\u274C **Hardcoded paths**: `/Users/me/project`\n\u2705 **Use variables**: `\"$DMUX_ROOT\"`\n\n\u274C **Assuming tools exist**: `pnpm install`\n\u2705 **Check first**: `command -v pnpm && pnpm install`\n\n\u274C **No error handling**: Script fails silently\n\u2705 **Set error mode**: `set -e` or check exit codes\n\n\u274C **Forgetting executable bit**: Hook won't run\n\u2705 **Make executable**: `chmod +x`\n\n\u274C **Noisy output**: Clutters dmux logs\n\u2705 **Silent operations**: `curl -s`, `> /dev/null 2>&1`\n\n\u274C **Not testing**: Deploy and hope\n\u2705 **Test manually**: Run with mock env vars first\n\n## Debugging\n\nIf a hook isn't working:\n\n1. **Check if file exists**: `ls -la .dmux-hooks/`\n2. **Check permissions**: Should show `x` in `rwxr-xr-x`\n3. **Check syntax**: `bash -n .dmux-hooks/hook_name`\n4. **Test manually**: Set env vars and run\n5. **Check logs**: dmux logs to stderr with `[Hooks]` prefix\n6. **Simplify**: Remove complex parts, test basic version\n7. **Check tool availability**: `command -v required_tool`\n\n### Debug Mode\n```bash\n#!/bin/bash\n# Add to top of hook for debugging\nset -x # Print each command before executing\nset -e # Exit on error\n\n# Your hook logic here\n```\n\n## Summary Checklist\n\nWhen creating a new hook:\n\n- [ ] Create file in `.dmux-hooks/`\n- [ ] Add shebang: `#!/bin/bash`\n- [ ] Make executable: `chmod +x`\n- [ ] Add `set -e` for error handling\n- [ ] Use environment variables (never hardcode paths)\n- [ ] Background long operations with `&`\n- [ ] Check for required tools before using\n- [ ] Test manually with mock env vars\n- [ ] Add comments explaining what it does\n- [ ] Commit to version control\n\n## Getting Help\n\n- **Full documentation**: See `HOOKS.md` in project root\n- **Claude-specific tips**: See `CLAUDE.md` in `.dmux-hooks/`\n- **Examples**: Check `.dmux-hooks/examples/` directory\n- **dmux API**: See `API.md` for REST endpoints\n\n---\n\n*This documentation was auto-generated from dmux source code.*\n*Version: 2026-02-21*\n";
5
+ export declare const AGENTS_MD = "# dmux Hooks System - Agent Reference\n\n**Auto-generated documentation for AI agents**\n\nThis document contains everything an AI agent needs to create, modify, and understand dmux hooks. It is automatically generated from the dmux source code and embedded in the binary.\n\n## What You're Working On\n\nYou are editing hooks for **dmux**, a tmux pane manager that creates AI-powered development workflows. Each pane runs in its own git worktree with an AI agent.\n\n## Your Goal\n\nCreate executable bash scripts in `.dmux-hooks/` that run automatically at key lifecycle events.\n\n## Quick Start\n\n1. **Create a hook file**: `touch .dmux-hooks/worktree_created`\n2. **Make it executable**: `chmod +x .dmux-hooks/worktree_created`\n3. **Add shebang**: Start with `#!/bin/bash`\n4. **Use environment variables**: Access `$DMUX_ROOT`, `$DMUX_WORKTREE_PATH`, etc.\n5. **Test it**: Set env vars manually and run the script\n\n## Hook Execution Model\n\n- **Non-blocking**: Hooks run in background (detached processes)\n- **Silent failures**: Hook errors are logged but don't stop dmux\n- **Environment-based**: All context passed via environment variables\n- **Version controlled**: Hooks in `.dmux-hooks/` are shared with team\n- **Priority resolution**: `.dmux-hooks/` \u2192 `.dmux/hooks/` \u2192 `~/.dmux/hooks/`\n\n## Available Hooks\n\n### Pane Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `before_pane_create` | Before pane creation | Validation, notifications, pre-flight checks |\n| `pane_created` | After pane, before worktree | Configure tmux settings, prepare environment |\n| `worktree_created` | After full setup | Install deps, copy configs, setup git |\n| `before_pane_close` | Before closing | Save state, backup uncommitted work |\n| `pane_closed` | After closed | Cleanup resources, analytics, notifications |\n\n### Worktree Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `before_worktree_remove` | Before worktree removal | Archive worktree, save artifacts |\n| `worktree_removed` | After worktree removed | Cleanup external references |\n\n### Merge Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `pre_merge` | Before merge operation | Run final tests, create backups |\n| `post_merge` | After successful merge | Deploy, close issues, notify team |\n\n### Interactive Hooks (with HTTP callbacks)\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `run_test` | When tests triggered | Run test suite, report status via HTTP |\n| `run_dev` | When dev server triggered | Start dev server, create tunnel, report URL |\n\n\n## Environment Variables\n\n### Always Available\n```bash\nDMUX_ROOT=\"/path/to/project\" # Project root directory\nDMUX_SERVER_PORT=\"3142\" # HTTP server port\n```\n\n### Pane Context (most hooks)\n```bash\nDMUX_PANE_ID=\"dmux-1234567890\" # dmux pane identifier\nDMUX_SLUG=\"fix-auth-bug\" # Branch/worktree name\nDMUX_PROMPT=\"Fix authentication bug\" # User's prompt\nDMUX_AGENT=\"claude\" # Agent type (registry id, e.g. claude, codex, opencode)\nDMUX_TMUX_PANE_ID=\"%38\" # tmux pane ID\n```\n\n### Worktree Context\n```bash\nDMUX_WORKTREE_PATH=\"/path/.dmux/worktrees/fix-auth-bug\"\nDMUX_BRANCH=\"fix-auth-bug\" # Same as slug\n```\n\n### Merge Context\n```bash\nDMUX_TARGET_BRANCH=\"main\" # Branch being merged into\n```\n\n## HTTP Callback API\n\nInteractive hooks (`run_test` and `run_dev`) can update dmux UI via HTTP.\n\n### Update Test Status\n```bash\ncurl -X PUT \"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\", \"output\": \"optional test output\"}'\n\n# Status values: \"running\" | \"passed\" | \"failed\"\n```\n\n### Update Dev Server\n```bash\ncurl -X PUT \"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\", \"url\": \"http://localhost:3000\"}'\n\n# Status values: \"running\" | \"stopped\"\n# url: Can be localhost or tunnel URL (ngrok, cloudflared, etc.)\n```\n\n## Common Patterns\n\n### Pattern 1: Install Dependencies\n```bash\n#!/bin/bash\n# .dmux-hooks/worktree_created\n\ncd \"$DMUX_WORKTREE_PATH\"\n\nif [ -f \"pnpm-lock.yaml\" ]; then\n pnpm install --prefer-offline &\nelif [ -f \"package-lock.json\" ]; then\n npm install &\nelif [ -f \"yarn.lock\" ]; then\n yarn install &\nelif [ -f \"Gemfile\" ]; then\n bundle install &\nelif [ -f \"requirements.txt\" ]; then\n pip install -r requirements.txt &\nelif [ -f \"Cargo.toml\" ]; then\n cargo build &\nfi\n```\n\n### Pattern 2: Copy Configuration\n```bash\n#!/bin/bash\n# .dmux-hooks/worktree_created\n\n# Copy environment file\nif [ -f \"$DMUX_ROOT/.env.local\" ]; then\n cp \"$DMUX_ROOT/.env.local\" \"$DMUX_WORKTREE_PATH/.env.local\"\nfi\n\n# Copy other config files\nfor file in .env.development .npmrc .yarnrc; do\n if [ -f \"$DMUX_ROOT/$file\" ]; then\n cp \"$DMUX_ROOT/$file\" \"$DMUX_WORKTREE_PATH/$file\"\n fi\ndone\n```\n\n### Pattern 3: Run Tests with Status Updates\n```bash\n#!/bin/bash\n# .dmux-hooks/run_test\n\nset -e\ncd \"$DMUX_WORKTREE_PATH\"\nAPI=\"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test\"\n\n# Update: starting\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\"}' > /dev/null\n\n# Run tests and capture output\nOUTPUT_FILE=\"/tmp/dmux-test-$DMUX_PANE_ID.txt\"\nif pnpm test > \"$OUTPUT_FILE\" 2>&1; then\n STATUS=\"passed\"\nelse\n STATUS=\"failed\"\nfi\n\n# Get output (truncate if too long)\nOUTPUT=$(head -c 5000 \"$OUTPUT_FILE\")\n\n# Update: complete\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d \"$(jq -n --arg status \"$STATUS\" --arg output \"$OUTPUT\" '{status: $status, output: $output}')\" > /dev/null\n\nrm -f \"$OUTPUT_FILE\"\n```\n\n### Pattern 4: Dev Server with Tunnel\n```bash\n#!/bin/bash\n# .dmux-hooks/run_dev\n\nset -e\ncd \"$DMUX_WORKTREE_PATH\"\nAPI=\"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev\"\n\n# Start dev server in background\nLOG_FILE=\"/tmp/dmux-dev-$DMUX_PANE_ID.log\"\npnpm dev > \"$LOG_FILE\" 2>&1 &\nDEV_PID=$!\n\n# Wait for server to start\nsleep 5\n\n# Detect port from logs\nPORT=$(grep -oP 'localhost:Kd+' \"$LOG_FILE\" | head -1)\n[ -z \"$PORT\" ] && PORT=3000\n\n# Optional: Create tunnel with cloudflared\nif command -v cloudflared &> /dev/null; then\n TUNNEL=$(cloudflared tunnel --url \"http://localhost:$PORT\" 2>&1 | grep -oP 'https://[a-z0-9-]+.trycloudflare.com' | head -1)\n URL=\"${TUNNEL:-http://localhost:$PORT}\"\nelse\n URL=\"http://localhost:$PORT\"\nfi\n\n# Report status\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d \"{\"status\": \"running\", \"url\": \"$URL\"}\" > /dev/null\n\necho \"[Hook] Dev server running at $URL (PID: $DEV_PID)\"\n```\n\n### Pattern 5: Post-Merge Deployment\n```bash\n#!/bin/bash\n# .dmux-hooks/post_merge\n\nset -e\ncd \"$DMUX_ROOT\"\n\n# Only deploy from main/master\nif [ \"$DMUX_TARGET_BRANCH\" != \"main\" ] && [ \"$DMUX_TARGET_BRANCH\" != \"master\" ]; then\n exit 0\nfi\n\n# Push to remote\ngit push origin \"$DMUX_TARGET_BRANCH\"\n\n# Trigger deployment (example: Vercel)\nif [ -n \"$VERCEL_TOKEN\" ]; then\n curl -s -X POST \"https://api.vercel.com/v1/deployments\" -H \"Authorization: Bearer $VERCEL_TOKEN\" -H \"Content-Type: application/json\" -d '{\"name\": \"my-project\"}' > /dev/null\nfi\n\n# Close GitHub issue if prompt contains #123\nISSUE=$(echo \"$DMUX_PROMPT\" | grep -oP '#Kd+' | head -1)\nif [ -n \"$ISSUE\" ] && command -v gh &> /dev/null; then\n gh issue close \"$ISSUE\" -c \"Resolved in $DMUX_SLUG, merged to $DMUX_TARGET_BRANCH\" 2>/dev/null || true\nfi\n```\n\n## Best Practices\n\n1. **Always start with shebang**: `#!/bin/bash`\n2. **Set error handling**: `set -e` (exit on error)\n3. **Make executable**: `chmod +x .dmux-hooks/hook_name`\n4. **Background long operations**: Append `&` to avoid blocking\n5. **Check for required tools**: `command -v tool &> /dev/null`\n6. **Log for debugging**: `echo \"[Hook] message\" >> \"$DMUX_ROOT/.dmux/hooks.log\"`\n7. **Handle missing vars gracefully**: `[ -z \"$VAR\" ] && exit 0`\n8. **Use silent curl**: `curl -s` to avoid noise in logs\n9. **Clean up temp files**: Remove files in `/tmp/`\n10. **Test before committing**: Run hooks manually with mock env vars\n\n## Testing Hooks\n\n### Manual Testing\n```bash\n# 1. Set environment variables\nexport DMUX_ROOT=\"$(pwd)\"\nexport DMUX_PANE_ID=\"test-pane\"\nexport DMUX_SLUG=\"test-branch\"\nexport DMUX_WORKTREE_PATH=\"$(pwd)\"\nexport DMUX_SERVER_PORT=\"3142\"\nexport DMUX_AGENT=\"claude\"\nexport DMUX_PROMPT=\"Test prompt\"\n\n# 2. Run hook directly\n./.dmux-hooks/worktree_created\n\n# 3. Check exit code\necho $? # Should be 0 for success\n```\n\n### Syntax Check\n```bash\n# Check for syntax errors without running\nbash -n ./.dmux-hooks/worktree_created\n```\n\n### Shellcheck (if available)\n```bash\nshellcheck ./.dmux-hooks/worktree_created\n```\n\n## Project Context Analysis\n\nBefore creating hooks, analyze these files in the project:\n\n### Package Manager Detection\n```bash\n# Check which package manager is used\nif [ -f \"pnpm-lock.yaml\" ]; then\n # Use: pnpm install, pnpm test, pnpm dev\nelif [ -f \"package-lock.json\" ]; then\n # Use: npm install, npm test, npm run dev\nelif [ -f \"yarn.lock\" ]; then\n # Use: yarn install, yarn test, yarn dev\nfi\n```\n\n### Test Command Discovery\n```bash\n# Read package.json to find test command\ncat package.json | grep '\"test\"'\n# Or with jq:\njq -r '.scripts.test' package.json\n```\n\n### Dev Command Discovery\n```bash\n# Read package.json to find dev command\ncat package.json | grep '\"dev\"'\n# Or with jq:\njq -r '.scripts.dev' package.json\n```\n\n### Environment Variables\n```bash\n# Check for .env files to copy\nls -la | grep '.env'\n```\n\n### Build System\n```bash\n# Detect build system\nif [ -f \"vite.config.ts\" ]; then\n # Vite project\nelif [ -f \"next.config.js\" ]; then\n # Next.js project\nelif [ -f \"nuxt.config.ts\" ]; then\n # Nuxt project\nfi\n```\n\n## Common Mistakes to Avoid\n\n\u274C **Blocking operations**: `sleep 60` (blocks dmux)\n\u2705 **Background long tasks**: `slow_operation &`\n\n\u274C **Hardcoded paths**: `/Users/me/project`\n\u2705 **Use variables**: `\"$DMUX_ROOT\"`\n\n\u274C **Assuming tools exist**: `pnpm install`\n\u2705 **Check first**: `command -v pnpm && pnpm install`\n\n\u274C **No error handling**: Script fails silently\n\u2705 **Set error mode**: `set -e` or check exit codes\n\n\u274C **Forgetting executable bit**: Hook won't run\n\u2705 **Make executable**: `chmod +x`\n\n\u274C **Noisy output**: Clutters dmux logs\n\u2705 **Silent operations**: `curl -s`, `> /dev/null 2>&1`\n\n\u274C **Not testing**: Deploy and hope\n\u2705 **Test manually**: Run with mock env vars first\n\n## Debugging\n\nIf a hook isn't working:\n\n1. **Check if file exists**: `ls -la .dmux-hooks/`\n2. **Check permissions**: Should show `x` in `rwxr-xr-x`\n3. **Check syntax**: `bash -n .dmux-hooks/hook_name`\n4. **Test manually**: Set env vars and run\n5. **Check logs**: dmux logs to stderr with `[Hooks]` prefix\n6. **Simplify**: Remove complex parts, test basic version\n7. **Check tool availability**: `command -v required_tool`\n\n### Debug Mode\n```bash\n#!/bin/bash\n# Add to top of hook for debugging\nset -x # Print each command before executing\nset -e # Exit on error\n\n# Your hook logic here\n```\n\n## Summary Checklist\n\nWhen creating a new hook:\n\n- [ ] Create file in `.dmux-hooks/`\n- [ ] Add shebang: `#!/bin/bash`\n- [ ] Make executable: `chmod +x`\n- [ ] Add `set -e` for error handling\n- [ ] Use environment variables (never hardcode paths)\n- [ ] Background long operations with `&`\n- [ ] Check for required tools before using\n- [ ] Test manually with mock env vars\n- [ ] Add comments explaining what it does\n- [ ] Commit to version control\n\n## Getting Help\n\n- **Full documentation**: See `HOOKS.md` in project root\n- **Claude-specific tips**: See `CLAUDE.md` in `.dmux-hooks/`\n- **Examples**: Check `.dmux-hooks/examples/` directory\n- **dmux API**: See `API.md` for REST endpoints\n\n---\n\n*This documentation was auto-generated from dmux source code.*\n*Version: 2026-02-25*\n";
6
6
  //# sourceMappingURL=generated-agents-doc.d.ts.map
@@ -10,7 +10,7 @@ This document contains everything an AI agent needs to create, modify, and under
10
10
 
11
11
  ## What You're Working On
12
12
 
13
- You are editing hooks for **dmux**, a tmux pane manager that creates AI-powered development workflows. Each pane runs in its own git worktree with an AI agent (Claude Code or opencode).
13
+ You are editing hooks for **dmux**, a tmux pane manager that creates AI-powered development workflows. Each pane runs in its own git worktree with an AI agent.
14
14
 
15
15
  ## Your Goal
16
16
 
@@ -79,7 +79,7 @@ DMUX_SERVER_PORT="3142" # HTTP server port
79
79
  DMUX_PANE_ID="dmux-1234567890" # dmux pane identifier
80
80
  DMUX_SLUG="fix-auth-bug" # Branch/worktree name
81
81
  DMUX_PROMPT="Fix authentication bug" # User's prompt
82
- DMUX_AGENT="claude" # Agent type (claude|opencode)
82
+ DMUX_AGENT="claude" # Agent type (registry id, e.g. claude, codex, opencode)
83
83
  DMUX_TMUX_PANE_ID="%38" # tmux pane ID
84
84
  \`\`\`
85
85
 
@@ -425,6 +425,6 @@ When creating a new hook:
425
425
  ---
426
426
 
427
427
  *This documentation was auto-generated from dmux source code.*
428
- *Version: 2026-02-21*
428
+ *Version: 2026-02-25*
429
429
  `;
430
430
  //# sourceMappingURL=generated-agents-doc.js.map
@@ -1,15 +1,8 @@
1
- /**
2
- * Embedded Hooks Documentation
3
- *
4
- * This file contains all documentation that gets written to .dmux-hooks/
5
- * when the directory is initialized. The AGENTS_MD content is auto-generated
6
- * and imported from generated-agents-doc.ts
7
- */
8
1
  /**
9
2
  * Main documentation - gets written as both AGENTS.md and CLAUDE.md
10
3
  * Different agents look for different filenames, but content is identical
11
4
  */
12
- export declare const HOOKS_DOCUMENTATION = "# dmux Hooks System - Agent Reference\n\n**Auto-generated documentation for AI agents**\n\nThis document contains everything an AI agent needs to create, modify, and understand dmux hooks. It is automatically generated from the dmux source code and embedded in the binary.\n\n## What You're Working On\n\nYou are editing hooks for **dmux**, a tmux pane manager that creates AI-powered development workflows. Each pane runs in its own git worktree with an AI agent (Claude Code or opencode).\n\n## Your Goal\n\nCreate executable bash scripts in `.dmux-hooks/` that run automatically at key lifecycle events.\n\n## Quick Start\n\n1. **Create a hook file**: `touch .dmux-hooks/worktree_created`\n2. **Make it executable**: `chmod +x .dmux-hooks/worktree_created`\n3. **Add shebang**: Start with `#!/bin/bash`\n4. **Use environment variables**: Access `$DMUX_ROOT`, `$DMUX_WORKTREE_PATH`, etc.\n5. **Test it**: Set env vars manually and run the script\n\n## Hook Execution Model\n\n- **Non-blocking**: Hooks run in background (detached processes)\n- **Silent failures**: Hook errors are logged but don't stop dmux\n- **Environment-based**: All context passed via environment variables\n- **Version controlled**: Hooks in `.dmux-hooks/` are shared with team\n- **Priority resolution**: `.dmux-hooks/` \u2192 `.dmux/hooks/` \u2192 `~/.dmux/hooks/`\n\n## Available Hooks\n\n### Pane Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `before_pane_create` | Before pane creation | Validation, notifications, pre-flight checks |\n| `pane_created` | After pane, before worktree | Configure tmux settings, prepare environment |\n| `worktree_created` | After full setup | Install deps, copy configs, setup git |\n| `before_pane_close` | Before closing | Save state, backup uncommitted work |\n| `pane_closed` | After closed | Cleanup resources, analytics, notifications |\n\n### Worktree Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `before_worktree_remove` | Before worktree removal | Archive worktree, save artifacts |\n| `worktree_removed` | After worktree removed | Cleanup external references |\n\n### Merge Lifecycle Hooks\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `pre_merge` | Before merge operation | Run final tests, create backups |\n| `post_merge` | After successful merge | Deploy, close issues, notify team |\n\n### Interactive Hooks (with HTTP callbacks)\n\n| Hook | When | Common Use Cases |\n|------|------|------------------|\n| `run_test` | When tests triggered | Run test suite, report status via HTTP |\n| `run_dev` | When dev server triggered | Start dev server, create tunnel, report URL |\n\n\n## Environment Variables\n\n### Always Available\n```bash\nDMUX_ROOT=\"/path/to/project\" # Project root directory\nDMUX_SERVER_PORT=\"3142\" # HTTP server port\n```\n\n### Pane Context (most hooks)\n```bash\nDMUX_PANE_ID=\"dmux-1234567890\" # dmux pane identifier\nDMUX_SLUG=\"fix-auth-bug\" # Branch/worktree name\nDMUX_PROMPT=\"Fix authentication bug\" # User's prompt\nDMUX_AGENT=\"claude\" # Agent type (claude|opencode)\nDMUX_TMUX_PANE_ID=\"%38\" # tmux pane ID\n```\n\n### Worktree Context\n```bash\nDMUX_WORKTREE_PATH=\"/path/.dmux/worktrees/fix-auth-bug\"\nDMUX_BRANCH=\"fix-auth-bug\" # Same as slug\n```\n\n### Merge Context\n```bash\nDMUX_TARGET_BRANCH=\"main\" # Branch being merged into\n```\n\n## HTTP Callback API\n\nInteractive hooks (`run_test` and `run_dev`) can update dmux UI via HTTP.\n\n### Update Test Status\n```bash\ncurl -X PUT \"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\", \"output\": \"optional test output\"}'\n\n# Status values: \"running\" | \"passed\" | \"failed\"\n```\n\n### Update Dev Server\n```bash\ncurl -X PUT \"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\", \"url\": \"http://localhost:3000\"}'\n\n# Status values: \"running\" | \"stopped\"\n# url: Can be localhost or tunnel URL (ngrok, cloudflared, etc.)\n```\n\n## Common Patterns\n\n### Pattern 1: Install Dependencies\n```bash\n#!/bin/bash\n# .dmux-hooks/worktree_created\n\ncd \"$DMUX_WORKTREE_PATH\"\n\nif [ -f \"pnpm-lock.yaml\" ]; then\n pnpm install --prefer-offline &\nelif [ -f \"package-lock.json\" ]; then\n npm install &\nelif [ -f \"yarn.lock\" ]; then\n yarn install &\nelif [ -f \"Gemfile\" ]; then\n bundle install &\nelif [ -f \"requirements.txt\" ]; then\n pip install -r requirements.txt &\nelif [ -f \"Cargo.toml\" ]; then\n cargo build &\nfi\n```\n\n### Pattern 2: Copy Configuration\n```bash\n#!/bin/bash\n# .dmux-hooks/worktree_created\n\n# Copy environment file\nif [ -f \"$DMUX_ROOT/.env.local\" ]; then\n cp \"$DMUX_ROOT/.env.local\" \"$DMUX_WORKTREE_PATH/.env.local\"\nfi\n\n# Copy other config files\nfor file in .env.development .npmrc .yarnrc; do\n if [ -f \"$DMUX_ROOT/$file\" ]; then\n cp \"$DMUX_ROOT/$file\" \"$DMUX_WORKTREE_PATH/$file\"\n fi\ndone\n```\n\n### Pattern 3: Run Tests with Status Updates\n```bash\n#!/bin/bash\n# .dmux-hooks/run_test\n\nset -e\ncd \"$DMUX_WORKTREE_PATH\"\nAPI=\"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/test\"\n\n# Update: starting\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d '{\"status\": \"running\"}' > /dev/null\n\n# Run tests and capture output\nOUTPUT_FILE=\"/tmp/dmux-test-$DMUX_PANE_ID.txt\"\nif pnpm test > \"$OUTPUT_FILE\" 2>&1; then\n STATUS=\"passed\"\nelse\n STATUS=\"failed\"\nfi\n\n# Get output (truncate if too long)\nOUTPUT=$(head -c 5000 \"$OUTPUT_FILE\")\n\n# Update: complete\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d \"$(jq -n --arg status \"$STATUS\" --arg output \"$OUTPUT\" '{status: $status, output: $output}')\" > /dev/null\n\nrm -f \"$OUTPUT_FILE\"\n```\n\n### Pattern 4: Dev Server with Tunnel\n```bash\n#!/bin/bash\n# .dmux-hooks/run_dev\n\nset -e\ncd \"$DMUX_WORKTREE_PATH\"\nAPI=\"http://localhost:$DMUX_SERVER_PORT/api/panes/$DMUX_PANE_ID/dev\"\n\n# Start dev server in background\nLOG_FILE=\"/tmp/dmux-dev-$DMUX_PANE_ID.log\"\npnpm dev > \"$LOG_FILE\" 2>&1 &\nDEV_PID=$!\n\n# Wait for server to start\nsleep 5\n\n# Detect port from logs\nPORT=$(grep -oP 'localhost:Kd+' \"$LOG_FILE\" | head -1)\n[ -z \"$PORT\" ] && PORT=3000\n\n# Optional: Create tunnel with cloudflared\nif command -v cloudflared &> /dev/null; then\n TUNNEL=$(cloudflared tunnel --url \"http://localhost:$PORT\" 2>&1 | grep -oP 'https://[a-z0-9-]+.trycloudflare.com' | head -1)\n URL=\"${TUNNEL:-http://localhost:$PORT}\"\nelse\n URL=\"http://localhost:$PORT\"\nfi\n\n# Report status\ncurl -s -X PUT \"$API\" -H \"Content-Type: application/json\" -d \"{\"status\": \"running\", \"url\": \"$URL\"}\" > /dev/null\n\necho \"[Hook] Dev server running at $URL (PID: $DEV_PID)\"\n```\n\n### Pattern 5: Post-Merge Deployment\n```bash\n#!/bin/bash\n# .dmux-hooks/post_merge\n\nset -e\ncd \"$DMUX_ROOT\"\n\n# Only deploy from main/master\nif [ \"$DMUX_TARGET_BRANCH\" != \"main\" ] && [ \"$DMUX_TARGET_BRANCH\" != \"master\" ]; then\n exit 0\nfi\n\n# Push to remote\ngit push origin \"$DMUX_TARGET_BRANCH\"\n\n# Trigger deployment (example: Vercel)\nif [ -n \"$VERCEL_TOKEN\" ]; then\n curl -s -X POST \"https://api.vercel.com/v1/deployments\" -H \"Authorization: Bearer $VERCEL_TOKEN\" -H \"Content-Type: application/json\" -d '{\"name\": \"my-project\"}' > /dev/null\nfi\n\n# Close GitHub issue if prompt contains #123\nISSUE=$(echo \"$DMUX_PROMPT\" | grep -oP '#Kd+' | head -1)\nif [ -n \"$ISSUE\" ] && command -v gh &> /dev/null; then\n gh issue close \"$ISSUE\" -c \"Resolved in $DMUX_SLUG, merged to $DMUX_TARGET_BRANCH\" 2>/dev/null || true\nfi\n```\n\n## Best Practices\n\n1. **Always start with shebang**: `#!/bin/bash`\n2. **Set error handling**: `set -e` (exit on error)\n3. **Make executable**: `chmod +x .dmux-hooks/hook_name`\n4. **Background long operations**: Append `&` to avoid blocking\n5. **Check for required tools**: `command -v tool &> /dev/null`\n6. **Log for debugging**: `echo \"[Hook] message\" >> \"$DMUX_ROOT/.dmux/hooks.log\"`\n7. **Handle missing vars gracefully**: `[ -z \"$VAR\" ] && exit 0`\n8. **Use silent curl**: `curl -s` to avoid noise in logs\n9. **Clean up temp files**: Remove files in `/tmp/`\n10. **Test before committing**: Run hooks manually with mock env vars\n\n## Testing Hooks\n\n### Manual Testing\n```bash\n# 1. Set environment variables\nexport DMUX_ROOT=\"$(pwd)\"\nexport DMUX_PANE_ID=\"test-pane\"\nexport DMUX_SLUG=\"test-branch\"\nexport DMUX_WORKTREE_PATH=\"$(pwd)\"\nexport DMUX_SERVER_PORT=\"3142\"\nexport DMUX_AGENT=\"claude\"\nexport DMUX_PROMPT=\"Test prompt\"\n\n# 2. Run hook directly\n./.dmux-hooks/worktree_created\n\n# 3. Check exit code\necho $? # Should be 0 for success\n```\n\n### Syntax Check\n```bash\n# Check for syntax errors without running\nbash -n ./.dmux-hooks/worktree_created\n```\n\n### Shellcheck (if available)\n```bash\nshellcheck ./.dmux-hooks/worktree_created\n```\n\n## Project Context Analysis\n\nBefore creating hooks, analyze these files in the project:\n\n### Package Manager Detection\n```bash\n# Check which package manager is used\nif [ -f \"pnpm-lock.yaml\" ]; then\n # Use: pnpm install, pnpm test, pnpm dev\nelif [ -f \"package-lock.json\" ]; then\n # Use: npm install, npm test, npm run dev\nelif [ -f \"yarn.lock\" ]; then\n # Use: yarn install, yarn test, yarn dev\nfi\n```\n\n### Test Command Discovery\n```bash\n# Read package.json to find test command\ncat package.json | grep '\"test\"'\n# Or with jq:\njq -r '.scripts.test' package.json\n```\n\n### Dev Command Discovery\n```bash\n# Read package.json to find dev command\ncat package.json | grep '\"dev\"'\n# Or with jq:\njq -r '.scripts.dev' package.json\n```\n\n### Environment Variables\n```bash\n# Check for .env files to copy\nls -la | grep '.env'\n```\n\n### Build System\n```bash\n# Detect build system\nif [ -f \"vite.config.ts\" ]; then\n # Vite project\nelif [ -f \"next.config.js\" ]; then\n # Next.js project\nelif [ -f \"nuxt.config.ts\" ]; then\n # Nuxt project\nfi\n```\n\n## Common Mistakes to Avoid\n\n\u274C **Blocking operations**: `sleep 60` (blocks dmux)\n\u2705 **Background long tasks**: `slow_operation &`\n\n\u274C **Hardcoded paths**: `/Users/me/project`\n\u2705 **Use variables**: `\"$DMUX_ROOT\"`\n\n\u274C **Assuming tools exist**: `pnpm install`\n\u2705 **Check first**: `command -v pnpm && pnpm install`\n\n\u274C **No error handling**: Script fails silently\n\u2705 **Set error mode**: `set -e` or check exit codes\n\n\u274C **Forgetting executable bit**: Hook won't run\n\u2705 **Make executable**: `chmod +x`\n\n\u274C **Noisy output**: Clutters dmux logs\n\u2705 **Silent operations**: `curl -s`, `> /dev/null 2>&1`\n\n\u274C **Not testing**: Deploy and hope\n\u2705 **Test manually**: Run with mock env vars first\n\n## Debugging\n\nIf a hook isn't working:\n\n1. **Check if file exists**: `ls -la .dmux-hooks/`\n2. **Check permissions**: Should show `x` in `rwxr-xr-x`\n3. **Check syntax**: `bash -n .dmux-hooks/hook_name`\n4. **Test manually**: Set env vars and run\n5. **Check logs**: dmux logs to stderr with `[Hooks]` prefix\n6. **Simplify**: Remove complex parts, test basic version\n7. **Check tool availability**: `command -v required_tool`\n\n### Debug Mode\n```bash\n#!/bin/bash\n# Add to top of hook for debugging\nset -x # Print each command before executing\nset -e # Exit on error\n\n# Your hook logic here\n```\n\n## Summary Checklist\n\nWhen creating a new hook:\n\n- [ ] Create file in `.dmux-hooks/`\n- [ ] Add shebang: `#!/bin/bash`\n- [ ] Make executable: `chmod +x`\n- [ ] Add `set -e` for error handling\n- [ ] Use environment variables (never hardcode paths)\n- [ ] Background long operations with `&`\n- [ ] Check for required tools before using\n- [ ] Test manually with mock env vars\n- [ ] Add comments explaining what it does\n- [ ] Commit to version control\n\n## Getting Help\n\n- **Full documentation**: See `HOOKS.md` in project root\n- **Claude-specific tips**: See `CLAUDE.md` in `.dmux-hooks/`\n- **Examples**: Check `.dmux-hooks/examples/` directory\n- **dmux API**: See `API.md` for REST endpoints\n\n---\n\n*This documentation was auto-generated from dmux source code.*\n*Version: 2026-02-21*\n";
5
+ export declare const HOOKS_DOCUMENTATION: string;
13
6
  /**
14
7
  * README for the .dmux-hooks/ directory
15
8
  */
@@ -17,7 +10,7 @@ export declare const HOOKS_README = "# dmux Hooks\n\nThis directory contains hoo
17
10
  /**
18
11
  * Example: worktree_created hook
19
12
  */
20
- export declare const EXAMPLE_WORKTREE_CREATED = "#!/bin/bash\n# Example: worktree_created hook\n#\n# This hook runs after a new worktree is created and the agent is launched.\n# Use it to set up the worktree environment (install deps, copy configs, etc.)\n\nset -e # Exit on error\n\necho \"[Hook] Setting up worktree: $DMUX_SLUG\"\n\ncd \"$DMUX_WORKTREE_PATH\"\n\n# Install dependencies in background (don't block dmux)\nif [ -f \"pnpm-lock.yaml\" ]; then\n echo \"[Hook] Installing dependencies with pnpm...\"\n pnpm install --prefer-offline &\nelif [ -f \"package-lock.json\" ]; then\n echo \"[Hook] Installing dependencies with npm...\"\n npm install &\nelif [ -f \"yarn.lock\" ]; then\n echo \"[Hook] Installing dependencies with yarn...\"\n yarn install &\nfi\n\n# Copy environment file if it exists\nif [ -f \"$DMUX_ROOT/.env.local\" ]; then\n echo \"[Hook] Copying .env.local\"\n cp \"$DMUX_ROOT/.env.local\" \"$DMUX_WORKTREE_PATH/.env.local\"\nfi\n\n# Set custom git config for this worktree\necho \"[Hook] Configuring git\"\ngit config user.name \"dmux-agent/$DMUX_SLUG\"\ngit config user.email \"agent@dmux.local\"\n\n# Create a log entry\necho \"[$(date)] Created worktree: $DMUX_SLUG | Agent: $DMUX_AGENT | Prompt: $DMUX_PROMPT\" \\\n >> \"$DMUX_ROOT/.dmux/worktree_history.log\"\n\necho \"[Hook] Worktree setup complete!\"\n";
13
+ export declare const EXAMPLE_WORKTREE_CREATED = "#!/bin/bash\n# Example: worktree_created hook\n#\n# This hook runs after a new worktree is created and the agent is launched.\n# Use it to set up the worktree environment (install deps, copy configs, etc.)\n\nset -e # Exit on error\n\necho \"[Hook] Setting up worktree: $DMUX_SLUG\"\n\ncd \"$DMUX_WORKTREE_PATH\"\n\n# Install dependencies in background (don't block dmux)\nif [ -f \"pnpm-lock.yaml\" ]; then\n echo \"[Hook] Installing dependencies with pnpm...\"\n pnpm install --prefer-offline &\nelif [ -f \"package-lock.json\" ]; then\n echo \"[Hook] Installing dependencies with npm...\"\n npm install &\nelif [ -f \"yarn.lock\" ]; then\n echo \"[Hook] Installing dependencies with yarn...\"\n yarn install &\nfi\n\n# Copy environment file if it exists\nif [ -f \"$DMUX_ROOT/.env.local\" ]; then\n echo \"[Hook] Copying .env.local\"\n cp \"$DMUX_ROOT/.env.local\" \"$DMUX_WORKTREE_PATH/.env.local\"\nfi\n\n# Keep existing git author identity.\n# Do not set git user.name/user.email in this hook.\n\n# Create a log entry\necho \"[$(date)] Created worktree: $DMUX_SLUG | Agent: $DMUX_AGENT | Prompt: $DMUX_PROMPT\" \\\n >> \"$DMUX_ROOT/.dmux/worktree_history.log\"\n\necho \"[Hook] Worktree setup complete!\"\n";
21
14
  /**
22
15
  * Example: run_dev hook
23
16
  */
@@ -1 +1 @@
1
- {"version":3,"file":"hooksDocs.d.ts","sourceRoot":"","sources":["../../src/utils/hooksDocs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,svYAAY,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,YAAY,03CAqDxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,wxCAwCpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,2+DA8D3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,86CA6D5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,yvEAkE9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC"}
1
+ {"version":3,"file":"hooksDocs.d.ts","sourceRoot":"","sources":["../../src/utils/hooksDocs.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAY,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,YAAY,03CAqDxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,2sCAsCpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,2+DA8D3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,86CA6D5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,yvEAkE9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;CAKzB,CAAC"}
@@ -3,9 +3,31 @@
3
3
  *
4
4
  * This file contains all documentation that gets written to .dmux-hooks/
5
5
  * when the directory is initialized. The AGENTS_MD content is auto-generated
6
- * and imported from generated-agents-doc.ts
6
+ * and imported from generated-agents-doc.ts when available.
7
7
  */
8
- import { AGENTS_MD } from './generated-agents-doc.js';
8
+ const AGENTS_MD_FALLBACK = `# dmux Hooks
9
+
10
+ Full AGENTS.md hook documentation has not been generated in this checkout yet.
11
+
12
+ Run:
13
+
14
+ \`\`\`bash
15
+ pnpm run generate:hooks-docs
16
+ \`\`\`
17
+
18
+ Then restart dmux.
19
+ `;
20
+ let AGENTS_MD;
21
+ const GENERATED_AGENTS_DOC_MODULE = './generated-agents-doc' + '.js';
22
+ try {
23
+ const docsModule = await import(GENERATED_AGENTS_DOC_MODULE);
24
+ AGENTS_MD = typeof docsModule.AGENTS_MD === 'string'
25
+ ? docsModule.AGENTS_MD
26
+ : AGENTS_MD_FALLBACK;
27
+ }
28
+ catch {
29
+ AGENTS_MD = AGENTS_MD_FALLBACK;
30
+ }
9
31
  /**
10
32
  * Main documentation - gets written as both AGENTS.md and CLAUDE.md
11
33
  * Different agents look for different filenames, but content is identical
@@ -101,10 +123,8 @@ if [ -f "$DMUX_ROOT/.env.local" ]; then
101
123
  cp "$DMUX_ROOT/.env.local" "$DMUX_WORKTREE_PATH/.env.local"
102
124
  fi
103
125
 
104
- # Set custom git config for this worktree
105
- echo "[Hook] Configuring git"
106
- git config user.name "dmux-agent/$DMUX_SLUG"
107
- git config user.email "agent@dmux.local"
126
+ # Keep existing git author identity.
127
+ # Do not set git user.name/user.email in this hook.
108
128
 
109
129
  # Create a log entry
110
130
  echo "[\$(date)] Created worktree: $DMUX_SLUG | Agent: $DMUX_AGENT | Prompt: $DMUX_PROMPT" \\
@@ -1 +1 @@
1
- {"version":3,"file":"hooksDocs.js","sourceRoot":"","sources":["../../src/utils/hooksDocs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqD3B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8D9B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6D/B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEjC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,0BAA0B,EAAE,wBAAwB;IACpD,iBAAiB,EAAE,eAAe;IAClC,kBAAkB,EAAE,gBAAgB;IACpC,oBAAoB,EAAE,kBAAkB;CACzC,CAAC"}
1
+ {"version":3,"file":"hooksDocs.js","sourceRoot":"","sources":["../../src/utils/hooksDocs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG;;;;;;;;;;;CAW1B,CAAC;AAEF,IAAI,SAAiB,CAAC;AACtB,MAAM,2BAA2B,GAAG,wBAAwB,GAAG,KAAK,CA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width (after window resize)
32
32
  * 9. Apply layout to tmux
33
33
  */
34
- export declare function recalculateAndApplyLayout(controlPaneId: string, contentPaneIds: string[], terminalWidth: number, terminalHeight: number, config?: LayoutConfig): Promise<void>;
34
+ export declare function recalculateAndApplyLayout(controlPaneId: string, contentPaneIds: string[], terminalWidth: number, terminalHeight: number, config?: LayoutConfig, options?: {
35
+ force?: boolean;
36
+ suppressLogs?: boolean;
37
+ disableSpacer?: boolean;
38
+ }): Promise<void>;
35
39
  /**
36
40
  * Calculates optimal layout configuration based on terminal dimensions
37
41
  * Maintained for backward compatibility - delegates to LayoutCalculator
@@ -1 +1 @@
1
- {"version":3,"file":"layoutManager.d.ts","sourceRoot":"","sources":["../../src/utils/layoutManager.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAI3F;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,eAAO,MAAM,qBAAqB,EAAE,YAKnC,CAAC;AAGF,eAAO,MAAM,aAAa,QAAsC,CAAC;AACjE,eAAO,MAAM,qBAAqB,QAA8C,CAAC;AACjF,eAAO,MAAM,qBAAqB,QAA8C,CAAC;AACjF,eAAO,MAAM,sBAAsB,QAA+C,CAAC;AAGnF,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAKpC;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,CAC7C,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EAAE,EACxB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,YAAoC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAyVf;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,eAAe,EAAE,MAAM,EACvB,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