purplemux 0.2.3 → 0.2.5

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 (474) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +84 -79
  3. package/.next/standalone/.next/prerender-manifest.json +3 -3
  4. package/.next/standalone/.next/required-server-files.json +1 -1
  5. package/.next/standalone/.next/routes-manifest.json +47 -7
  6. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-qfa-x._.js +3 -0
  7. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00nrs0h._.js +3 -0
  8. package/.next/standalone/.next/server/chunks/[root-of-the-server]__014kwh_._.js +3 -0
  9. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02v.lnb._.js +3 -0
  10. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03x8rds._.js +3 -0
  11. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04cr_m8._.js +1 -1
  12. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06j59n1._.js +3 -0
  13. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07gfnob._.js +1 -1
  14. package/.next/standalone/.next/server/chunks/[root-of-the-server]__07xijrd._.js +1 -1
  15. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08tdlcm._.js +1 -1
  16. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09_6_.~._.js +3 -0
  17. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09gkm_6._.js +1 -1
  18. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_uldiw._.js +15 -0
  19. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0a4t.z5._.js +52 -0
  20. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ar~lbk._.js +3 -0
  21. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0bo-su1._.js +1 -1
  22. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c-bb5d._.js +1 -1
  23. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0dvelfj._.js +52 -0
  24. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e.7isl._.js +5 -0
  25. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0gcec.8._.js +3 -0
  26. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0i1m1v9._.js +3 -0
  27. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ihlt6s._.js +1 -1
  28. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kd7wei._.js +3 -0
  29. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0mky_tj._.js +35 -2
  30. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0oiiu_o._.js +3 -0
  31. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0oqgn2h._.js +3 -0
  32. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0qvunc5._.js +1 -1
  33. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0r77-u1._.js +52 -0
  34. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rhb4gk._.js +3 -0
  35. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0vi8p6v._.js +1 -1
  36. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w0wz~a._.js +3 -0
  37. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0w3m-oz._.js +1 -1
  38. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0zh8xur._.js +3 -0
  39. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0~iu3jq._.js +3 -0
  40. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11xw16l._.js +3 -0
  41. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12nr~pb._.js +1 -1
  42. package/.next/standalone/.next/server/chunks/{_0v81st0._.js → _0.pa6m1._.js} +1 -1
  43. package/.next/standalone/.next/server/chunks/_05ib7yu._.js +3 -0
  44. package/.next/standalone/.next/server/chunks/{_0ll-5~7._.js → _09y8.gr._.js} +1 -1
  45. package/.next/standalone/.next/server/chunks/{_0.5a4bu._.js → _0mwq11h._.js} +1 -1
  46. package/.next/standalone/.next/server/chunks/_0y4b49w._.js +3 -0
  47. package/.next/standalone/.next/server/chunks/_0zcb2f0._.js +3 -0
  48. package/.next/standalone/.next/server/chunks/{node_modules_ws_124xx2_._.js → _106a~ya._.js} +2 -2
  49. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_pages-api_00-t8sq.js +1 -1
  50. package/.next/standalone/.next/server/chunks/src_lib_00fhuqb._.js +3 -0
  51. package/.next/standalone/.next/server/chunks/src_lib_0dvlmi4._.js +15 -0
  52. package/.next/standalone/.next/server/chunks/src_lib_0ojl2hg._.js +52 -0
  53. package/.next/standalone/.next/server/chunks/src_lib_layout-store_ts_0fanx7c._.js +1 -1
  54. package/.next/standalone/.next/server/chunks/src_lib_status-manager_ts_003hlhy._.js +1 -13
  55. package/.next/standalone/.next/server/chunks/src_lib_workspace-store_ts_0vqt073._.js +1 -40
  56. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0ap_bxo._.js +3 -0
  57. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0t9ru13._.js +1 -1
  58. package/.next/standalone/.next/server/chunks/ssr/_0-9ezhb._.js +3 -0
  59. package/.next/standalone/.next/server/chunks/ssr/{_101yu0w._.js → _0-kyl7i._.js} +2 -2
  60. package/.next/standalone/.next/server/chunks/ssr/_003~2_g._.js +3 -0
  61. package/.next/standalone/.next/server/chunks/ssr/_00zsk6a._.js +3 -0
  62. package/.next/standalone/.next/server/chunks/ssr/_017c8be._.js +3 -0
  63. package/.next/standalone/.next/server/chunks/ssr/_01eupc5._.js +3 -0
  64. package/.next/standalone/.next/server/chunks/ssr/_05bq96_._.js +1 -1
  65. package/.next/standalone/.next/server/chunks/ssr/{_0c1yivm._.js → _070zc_o._.js} +2 -2
  66. package/.next/standalone/.next/server/chunks/ssr/_07jud1p._.js +1 -1
  67. package/.next/standalone/.next/server/chunks/ssr/_0_sz4y0._.js +3 -0
  68. package/.next/standalone/.next/server/chunks/ssr/_0_uqm-4._.js +3 -0
  69. package/.next/standalone/.next/server/chunks/ssr/{_0ftinmo._.js → _0ed.wmt._.js} +2 -2
  70. package/.next/standalone/.next/server/chunks/ssr/_0egedv6._.js +3 -0
  71. package/.next/standalone/.next/server/chunks/ssr/{_0-ug5tr._.js → _0fota2a._.js} +2 -2
  72. package/.next/standalone/.next/server/chunks/ssr/_0h4kenr._.js +1 -1
  73. package/.next/standalone/.next/server/chunks/ssr/_0ihbr8k._.js +1 -1
  74. package/.next/standalone/.next/server/chunks/ssr/_0lpqhot._.js +3 -0
  75. package/.next/standalone/.next/server/chunks/ssr/_0mltzed._.js +3 -0
  76. package/.next/standalone/.next/server/chunks/ssr/_0nbe6mv._.js +3 -0
  77. package/.next/standalone/.next/server/chunks/ssr/_0pg-q18._.js +1 -1
  78. package/.next/standalone/.next/server/chunks/ssr/_0pp3e5j._.js +1 -1
  79. package/.next/standalone/.next/server/chunks/ssr/_0ttiybw._.js +18 -0
  80. package/.next/standalone/.next/server/chunks/ssr/_0w.1ts8._.js +1 -1
  81. package/.next/standalone/.next/server/chunks/ssr/_0w6jc9p._.js +1 -1
  82. package/.next/standalone/.next/server/chunks/ssr/_0xp3-y6._.js +3 -0
  83. package/.next/standalone/.next/server/chunks/ssr/_0y7o.rg._.js +3 -0
  84. package/.next/standalone/.next/server/chunks/ssr/_0ytb_c0._.js +3 -0
  85. package/.next/standalone/.next/server/chunks/ssr/{_0ozy~xe._.js → _0~hz1fq._.js} +2 -2
  86. package/.next/standalone/.next/server/chunks/ssr/_1289s74._.js +3 -0
  87. package/.next/standalone/.next/server/chunks/ssr/{_02jzd5g._.js → _13gee5r._.js} +2 -2
  88. package/.next/standalone/.next/server/chunks/ssr/messages_de_terminal_json_[json]_cjs_05jirtw._.js +1 -1
  89. package/.next/standalone/.next/server/chunks/ssr/messages_de_webBrowser_json_[json]_cjs_0wfz-ul._.js +1 -1
  90. package/.next/standalone/.next/server/chunks/ssr/messages_en_terminal_json_[json]_cjs_0~ls3g-._.js +1 -1
  91. package/.next/standalone/.next/server/chunks/ssr/messages_en_webBrowser_json_[json]_cjs_0oirdko._.js +1 -1
  92. package/.next/standalone/.next/server/chunks/ssr/messages_es_terminal_json_[json]_cjs_04g2b1_._.js +1 -1
  93. package/.next/standalone/.next/server/chunks/ssr/messages_es_webBrowser_json_[json]_cjs_0w_no_c._.js +1 -1
  94. package/.next/standalone/.next/server/chunks/ssr/messages_fr_terminal_json_[json]_cjs_0uhakya._.js +1 -1
  95. package/.next/standalone/.next/server/chunks/ssr/messages_fr_webBrowser_json_[json]_cjs_00tbjsf._.js +1 -1
  96. package/.next/standalone/.next/server/chunks/ssr/messages_ja_terminal_json_[json]_cjs_0776z4f._.js +1 -1
  97. package/.next/standalone/.next/server/chunks/ssr/messages_ja_webBrowser_json_[json]_cjs_0tp7~.s._.js +1 -1
  98. package/.next/standalone/.next/server/chunks/ssr/messages_ko_terminal_json_[json]_cjs_06611.3._.js +1 -1
  99. package/.next/standalone/.next/server/chunks/ssr/messages_ko_webBrowser_json_[json]_cjs_0ibtysu._.js +1 -1
  100. package/.next/standalone/.next/server/chunks/ssr/messages_pt-BR_terminal_json_[json]_cjs_034yyg9._.js +1 -1
  101. package/.next/standalone/.next/server/chunks/ssr/messages_pt-BR_webBrowser_json_[json]_cjs_0eu9fbw._.js +1 -1
  102. package/.next/standalone/.next/server/chunks/ssr/messages_ru_terminal_json_[json]_cjs_0emk8~n._.js +1 -1
  103. package/.next/standalone/.next/server/chunks/ssr/messages_ru_webBrowser_json_[json]_cjs_113-x8n._.js +1 -1
  104. package/.next/standalone/.next/server/chunks/ssr/messages_tr_terminal_json_[json]_cjs_0xpix8g._.js +1 -1
  105. package/.next/standalone/.next/server/chunks/ssr/messages_tr_webBrowser_json_[json]_cjs_12ziott._.js +1 -1
  106. package/.next/standalone/.next/server/chunks/ssr/messages_zh-CN_terminal_json_[json]_cjs_12vwl8a._.js +1 -1
  107. package/.next/standalone/.next/server/chunks/ssr/messages_zh-CN_webBrowser_json_[json]_cjs_0e5lp-q._.js +1 -1
  108. package/.next/standalone/.next/server/chunks/ssr/messages_zh-TW_terminal_json_[json]_cjs_0spg5z5._.js +1 -1
  109. package/.next/standalone/.next/server/chunks/ssr/messages_zh-TW_webBrowser_json_[json]_cjs_0u_cpuv._.js +1 -1
  110. package/.next/standalone/.next/server/chunks/ssr/node_modules_@base-ui_030gj7p._.js +3 -0
  111. package/.next/standalone/.next/server/chunks/ssr/node_modules_@base-ui_04tdvwp._.js +3 -0
  112. package/.next/standalone/.next/server/chunks/ssr/node_modules_@base-ui_0bdox2f._.js +3 -0
  113. package/.next/standalone/.next/server/chunks/ssr/{src_components_12mrirb._.js → src_components_0_nzv1r._.js} +1 -1
  114. package/.next/standalone/.next/server/chunks/ssr/{src_components_0_aiven._.js → src_components_0bqqfju._.js} +1 -1
  115. package/.next/standalone/.next/server/chunks/ssr/{src_components_0geizrr._.js → src_components_0rqxlj-._.js} +1 -1
  116. package/.next/standalone/.next/server/chunks/ssr/{src_components_11_1i~k._.js → src_components_0s~.n3e._.js} +1 -1
  117. package/.next/standalone/.next/server/chunks/ssr/src_components_features_mobile_mobile-terminal-page_tsx_02chzch._.js +1 -1
  118. package/.next/standalone/.next/server/chunks/ssr/src_components_features_workspace_terminal-page_tsx_0wuq-jl._.js +1 -1
  119. package/.next/standalone/.next/server/chunks/ssr/src_lib_message-namespaces_ts_0wjpvu5._.js +3 -0
  120. package/.next/standalone/.next/server/chunks/ssr/src_lib_workspace-store_ts_00x-rec._.js +10 -0
  121. package/.next/standalone/.next/server/middleware-build-manifest.js +84 -79
  122. package/.next/standalone/.next/server/pages/_app/build-manifest.json +4 -4
  123. package/.next/standalone/.next/server/pages/_app/client-build-manifest.json +1 -1
  124. package/.next/standalone/.next/server/pages/_app.js +2 -2
  125. package/.next/standalone/.next/server/pages/_app.js.nft.json +1 -1
  126. package/.next/standalone/.next/server/pages/api/auth/login.js +2 -2
  127. package/.next/standalone/.next/server/pages/api/auth/login.js.nft.json +1 -1
  128. package/.next/standalone/.next/server/pages/api/auth/preflight.js +2 -2
  129. package/.next/standalone/.next/server/pages/api/auth/preflight.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/pages/api/auth/setup.js +2 -2
  131. package/.next/standalone/.next/server/pages/api/auth/setup.js.nft.json +1 -1
  132. package/.next/standalone/.next/server/pages/api/check-claude.js +5 -1
  133. package/.next/standalone/.next/server/pages/api/check-claude.js.nft.json +1 -1
  134. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/console/pages-manifest.json +3 -0
  135. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/console.js +8 -0
  136. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/console.js.map +5 -0
  137. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/console.js.nft.json +1 -0
  138. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/eval/pages-manifest.json +3 -0
  139. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/eval.js +8 -0
  140. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/eval.js.map +5 -0
  141. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/eval.js.nft.json +1 -0
  142. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/network/pages-manifest.json +3 -0
  143. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/network.js +8 -0
  144. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/network.js.map +5 -0
  145. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/network.js.nft.json +1 -0
  146. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/screenshot/pages-manifest.json +3 -0
  147. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/screenshot.js +8 -0
  148. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/screenshot.js.map +5 -0
  149. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/screenshot.js.nft.json +1 -0
  150. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/url/pages-manifest.json +3 -0
  151. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/url.js +8 -0
  152. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/url.js.map +5 -0
  153. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/browser/url.js.nft.json +1 -0
  154. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/result.js +3 -3
  155. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/result.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/send.js +3 -3
  157. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/send.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/status.js +3 -3
  159. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId]/status.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId].js +3 -3
  161. package/.next/standalone/.next/server/pages/api/cli/tabs/[tabId].js.nft.json +1 -1
  162. package/.next/standalone/.next/server/pages/api/cli/tabs.js +3 -3
  163. package/.next/standalone/.next/server/pages/api/cli/tabs.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/pages/api/cli/workspaces.js +2 -2
  165. package/.next/standalone/.next/server/pages/api/cli/workspaces.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/pages/api/config.js +2 -2
  167. package/.next/standalone/.next/server/pages/api/config.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/pages/api/layout/diff.js +1 -1
  169. package/.next/standalone/.next/server/pages/api/layout/diff.js.nft.json +1 -1
  170. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs/[tabId]/move.js +2 -2
  171. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs/[tabId]/move.js.nft.json +1 -1
  172. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs/[tabId].js +5 -5
  173. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs/[tabId].js.nft.json +1 -1
  174. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs/order.js +2 -2
  175. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs/order.js.nft.json +1 -1
  176. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs.js +5 -5
  177. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId]/tabs.js.nft.json +1 -1
  178. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId].js +2 -2
  179. package/.next/standalone/.next/server/pages/api/layout/pane/[paneId].js.nft.json +1 -1
  180. package/.next/standalone/.next/server/pages/api/layout/pane.js +2 -2
  181. package/.next/standalone/.next/server/pages/api/layout/pane.js.nft.json +1 -1
  182. package/.next/standalone/.next/server/pages/api/layout.js +2 -2
  183. package/.next/standalone/.next/server/pages/api/layout.js.nft.json +1 -1
  184. package/.next/standalone/.next/server/pages/api/message-history.js +2 -2
  185. package/.next/standalone/.next/server/pages/api/message-history.js.nft.json +1 -1
  186. package/.next/standalone/.next/server/pages/api/preflight/runtime.js.nft.json +1 -1
  187. package/.next/standalone/.next/server/pages/api/stats/daily-report/cache.js.nft.json +1 -1
  188. package/.next/standalone/.next/server/pages/api/stats/daily-report/generate.js.nft.json +1 -1
  189. package/.next/standalone/.next/server/pages/api/stats/daily-report/list.js.nft.json +1 -1
  190. package/.next/standalone/.next/server/pages/api/stats/projects.js.nft.json +1 -1
  191. package/.next/standalone/.next/server/pages/api/stats/sessions.js.nft.json +1 -1
  192. package/.next/standalone/.next/server/pages/api/stats/uptime.js.nft.json +1 -1
  193. package/.next/standalone/.next/server/pages/api/status/hook.js +6 -6
  194. package/.next/standalone/.next/server/pages/api/status/hook.js.nft.json +1 -1
  195. package/.next/standalone/.next/server/pages/api/status/statusline.js +6 -6
  196. package/.next/standalone/.next/server/pages/api/status/statusline.js.nft.json +1 -1
  197. package/.next/standalone/.next/server/pages/api/timeline/sessions.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/pages/api/tmux/permission-options.js +3 -2
  199. package/.next/standalone/.next/server/pages/api/tmux/permission-options.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/pages/api/tmux/plan-options.js +3 -2
  201. package/.next/standalone/.next/server/pages/api/tmux/plan-options.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/pages/api/tmux/recover-unknown.js +5 -5
  203. package/.next/standalone/.next/server/pages/api/tmux/recover-unknown.js.nft.json +1 -1
  204. package/.next/standalone/.next/server/pages/api/tmux/reset.js +5 -5
  205. package/.next/standalone/.next/server/pages/api/tmux/reset.js.nft.json +1 -1
  206. package/.next/standalone/.next/server/pages/api/workspace/[workspaceId].js +2 -2
  207. package/.next/standalone/.next/server/pages/api/workspace/[workspaceId].js.nft.json +1 -1
  208. package/.next/standalone/.next/server/pages/api/workspace/active.js +2 -2
  209. package/.next/standalone/.next/server/pages/api/workspace/active.js.nft.json +1 -1
  210. package/.next/standalone/.next/server/pages/api/workspace/group/[groupId].js +2 -2
  211. package/.next/standalone/.next/server/pages/api/workspace/group/[groupId].js.nft.json +1 -1
  212. package/.next/standalone/.next/server/pages/api/workspace/group/reorder.js +2 -2
  213. package/.next/standalone/.next/server/pages/api/workspace/group/reorder.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/pages/api/workspace/group.js +2 -2
  215. package/.next/standalone/.next/server/pages/api/workspace/group.js.nft.json +1 -1
  216. package/.next/standalone/.next/server/pages/api/workspace/reorder.js +2 -2
  217. package/.next/standalone/.next/server/pages/api/workspace/reorder.js.nft.json +1 -1
  218. package/.next/standalone/.next/server/pages/api/workspace/validate.js +2 -2
  219. package/.next/standalone/.next/server/pages/api/workspace/validate.js.nft.json +1 -1
  220. package/.next/standalone/.next/server/pages/api/workspace.js +5 -5
  221. package/.next/standalone/.next/server/pages/api/workspace.js.nft.json +1 -1
  222. package/.next/standalone/.next/server/pages/de/404.html +1 -1
  223. package/.next/standalone/.next/server/pages/de/500.html +1 -1
  224. package/.next/standalone/.next/server/pages/en/404.html +1 -1
  225. package/.next/standalone/.next/server/pages/en/500.html +1 -1
  226. package/.next/standalone/.next/server/pages/es/404.html +1 -1
  227. package/.next/standalone/.next/server/pages/es/500.html +1 -1
  228. package/.next/standalone/.next/server/pages/fr/404.html +1 -1
  229. package/.next/standalone/.next/server/pages/fr/500.html +1 -1
  230. package/.next/standalone/.next/server/pages/index/build-manifest.json +16 -15
  231. package/.next/standalone/.next/server/pages/index/client-build-manifest.json +1 -1
  232. package/.next/standalone/.next/server/pages/index/react-loadable-manifest.json +9 -9
  233. package/.next/standalone/.next/server/pages/index.js +13 -12
  234. package/.next/standalone/.next/server/pages/index.js.nft.json +1 -1
  235. package/.next/standalone/.next/server/pages/ja/404.html +1 -1
  236. package/.next/standalone/.next/server/pages/ja/500.html +1 -1
  237. package/.next/standalone/.next/server/pages/ko/404.html +1 -1
  238. package/.next/standalone/.next/server/pages/ko/500.html +1 -1
  239. package/.next/standalone/.next/server/pages/login/build-manifest.json +9 -8
  240. package/.next/standalone/.next/server/pages/login/client-build-manifest.json +1 -1
  241. package/.next/standalone/.next/server/pages/login.js +8 -7
  242. package/.next/standalone/.next/server/pages/login.js.nft.json +1 -1
  243. package/.next/standalone/.next/server/pages/pt-BR/404.html +1 -1
  244. package/.next/standalone/.next/server/pages/pt-BR/500.html +1 -1
  245. package/.next/standalone/.next/server/pages/reports/build-manifest.json +14 -13
  246. package/.next/standalone/.next/server/pages/reports/client-build-manifest.json +1 -1
  247. package/.next/standalone/.next/server/pages/reports/react-loadable-manifest.json +1 -1
  248. package/.next/standalone/.next/server/pages/reports.js +15 -14
  249. package/.next/standalone/.next/server/pages/reports.js.nft.json +1 -1
  250. package/.next/standalone/.next/server/pages/reset.js.nft.json +1 -1
  251. package/.next/standalone/.next/server/pages/ru/404.html +1 -1
  252. package/.next/standalone/.next/server/pages/ru/500.html +1 -1
  253. package/.next/standalone/.next/server/pages/stats/build-manifest.json +15 -14
  254. package/.next/standalone/.next/server/pages/stats/client-build-manifest.json +1 -1
  255. package/.next/standalone/.next/server/pages/stats/react-loadable-manifest.json +1 -1
  256. package/.next/standalone/.next/server/pages/stats.js +13 -12
  257. package/.next/standalone/.next/server/pages/stats.js.nft.json +1 -1
  258. package/.next/standalone/.next/server/pages/tools-required/build-manifest.json +6 -6
  259. package/.next/standalone/.next/server/pages/tools-required/client-build-manifest.json +1 -1
  260. package/.next/standalone/.next/server/pages/tools-required.js +4 -3
  261. package/.next/standalone/.next/server/pages/tools-required.js.nft.json +1 -1
  262. package/.next/standalone/.next/server/pages/tr/404.html +1 -1
  263. package/.next/standalone/.next/server/pages/tr/500.html +1 -1
  264. package/.next/standalone/.next/server/pages/webview/build-manifest.json +17 -16
  265. package/.next/standalone/.next/server/pages/webview/client-build-manifest.json +1 -1
  266. package/.next/standalone/.next/server/pages/webview/react-loadable-manifest.json +1 -1
  267. package/.next/standalone/.next/server/pages/webview.js +13 -12
  268. package/.next/standalone/.next/server/pages/webview.js.nft.json +1 -1
  269. package/.next/standalone/.next/server/pages/zh-CN/404.html +1 -1
  270. package/.next/standalone/.next/server/pages/zh-CN/500.html +1 -1
  271. package/.next/standalone/.next/server/pages/zh-TW/404.html +1 -1
  272. package/.next/standalone/.next/server/pages/zh-TW/500.html +1 -1
  273. package/.next/standalone/.next/server/pages-manifest.json +5 -0
  274. package/.next/standalone/.next/static/chunks/{11tnyk0iystp1.js → 0--r5y9cw3.0z.js} +1 -1
  275. package/.next/standalone/.next/static/chunks/{0w1ldes9u.mhe.js → 0-8v00lvs9_s0.js} +1 -1
  276. package/.next/standalone/.next/static/chunks/{0oy5nvsojxb2i.js → 0-rskn1p_p.qb.js} +1 -1
  277. package/.next/standalone/.next/static/chunks/{0h7n~i8gk~-a2.js → 0.4j~sc70rsrv.js} +1 -1
  278. package/.next/standalone/.next/static/chunks/{0g0xm7shj062y.js → 001_h.~thz3j3.js} +1 -1
  279. package/.next/standalone/.next/static/chunks/{0ynitrrzdxcnh.js → 00gxls80r--_0.js} +9 -8
  280. package/.next/standalone/.next/static/chunks/{121i8u8byuotx.js → 01rmp.m_ls7z_.js} +1 -1
  281. package/.next/standalone/.next/static/chunks/{0312riii_sl_1.js → 02o84r01jsc.z.js} +1 -1
  282. package/.next/standalone/.next/static/chunks/039-4cgt.dvjg.js +1 -0
  283. package/.next/standalone/.next/static/chunks/03t01d94eyxh2.js +1 -0
  284. package/.next/standalone/.next/static/chunks/04hn532e1vcts.js +1 -0
  285. package/.next/standalone/.next/static/chunks/05o56eq7.f3q2.js +1 -0
  286. package/.next/standalone/.next/static/chunks/{0x.dxrfqc.ix9.js → 0628quqp4ggh9.js} +1 -1
  287. package/.next/standalone/.next/static/chunks/06ak74s111wx-.js +1 -0
  288. package/.next/standalone/.next/static/chunks/07yop4v9xcwb9.js +1 -0
  289. package/.next/standalone/.next/static/chunks/08d6vee5l~1wn.js +1 -0
  290. package/.next/standalone/.next/static/chunks/09o2m0ingey8v.js +1 -0
  291. package/.next/standalone/.next/static/chunks/{0d5b6a8r1tk95.js → 09s7ub8rgh~u-.js} +1 -1
  292. package/.next/standalone/.next/static/chunks/{02su2lz3i24nj.js → 09zxrli-btome.js} +1 -1
  293. package/.next/standalone/.next/static/chunks/0_7~rgbkmfo_p.js +1 -0
  294. package/.next/standalone/.next/static/chunks/0a1xt.enr50l5.js +1 -0
  295. package/.next/standalone/.next/static/chunks/{0-p.9vdmq-_co.js → 0am7rh7xdv5lw.js} +4 -4
  296. package/.next/standalone/.next/static/chunks/{13u3mwvwu3kc..js → 0apqp49tgoz~z.js} +1 -1
  297. package/.next/standalone/.next/static/chunks/{0_67ozmvnvz16.js → 0bx27stclo8g5.js} +1 -1
  298. package/.next/standalone/.next/static/chunks/0ddh4qmi2awdq.js +1 -0
  299. package/.next/standalone/.next/static/chunks/0dwxj97xm70gv.js +1 -0
  300. package/.next/standalone/.next/static/chunks/0f3q6qhpk.i_r.js +1 -0
  301. package/.next/standalone/.next/static/chunks/{07.5h~7~q9~1e.js → 0f_7vuqno92ye.js} +1 -1
  302. package/.next/standalone/.next/static/chunks/0fsldybjx443~.js +1 -0
  303. package/.next/standalone/.next/static/chunks/0gfhd.gsbt9qg.js +1 -0
  304. package/.next/standalone/.next/static/chunks/0hv4~cszgs3im.js +1 -0
  305. package/.next/standalone/.next/static/chunks/0ic.mcu6-9din.js +1 -0
  306. package/.next/standalone/.next/static/chunks/0k4b.~5c4nvtm.js +1 -0
  307. package/.next/standalone/.next/static/chunks/0kqxfunh4731g.js +1 -0
  308. package/.next/standalone/.next/static/chunks/{0fn24h74ta78c.js → 0k~crb4s4z7gy.js} +1 -1
  309. package/.next/standalone/.next/static/chunks/0lrjdru2bjp.x.js +1 -0
  310. package/.next/standalone/.next/static/chunks/0lujhtd04orw5.js +1 -0
  311. package/.next/standalone/.next/static/chunks/0mwkajcworx_-.js +1 -0
  312. package/.next/standalone/.next/static/chunks/0nqofghl.17w_.js +1 -0
  313. package/.next/standalone/.next/static/chunks/0o1lsz827g-q_.js +1 -0
  314. package/.next/standalone/.next/static/chunks/0qqsez8ir1.fs.js +1 -0
  315. package/.next/standalone/.next/static/chunks/{0_htal_j04mkg.js → 0r3lm4_qr3y.a.js} +1 -1
  316. package/.next/standalone/.next/static/chunks/{06vxx-4w.uvj0.js → 0rahh2v7~f4tj.js} +17 -16
  317. package/.next/standalone/.next/static/chunks/{0pxbg4s8a4y54.js → 0rb41e1r1urhx.js} +1 -1
  318. package/.next/standalone/.next/static/chunks/0uii4rziiew3_.js +1 -0
  319. package/.next/standalone/.next/static/chunks/0vtkq~yk_1~gv.js +1 -0
  320. package/.next/standalone/.next/static/chunks/0vx2hhzc46h_7.js +1 -0
  321. package/.next/standalone/.next/static/chunks/0x_.wshvak6zp.js +1 -0
  322. package/.next/standalone/.next/static/chunks/0xa1.t1vj1mw0.js +1 -0
  323. package/.next/standalone/.next/static/chunks/0xpr6vw-p8oxk.js +1 -0
  324. package/.next/standalone/.next/static/chunks/{0uzs3jw4-93ly.js → 0zih6-g65txpb.js} +1 -1
  325. package/.next/standalone/.next/static/chunks/0zn1jt__-t51p.js +1 -0
  326. package/.next/standalone/.next/static/chunks/0zrhxc96zwjuv.js +1 -0
  327. package/.next/standalone/.next/static/chunks/0z~yy1lqrvp_a.js +1 -0
  328. package/.next/standalone/.next/static/chunks/0~cgr_3dpx0vl.js +1 -0
  329. package/.next/standalone/.next/static/chunks/{0te1jnz5.rt.r.js → 0~g0t2q6o3r-7.js} +6 -6
  330. package/.next/standalone/.next/static/chunks/0~vfb0ylk_9au.js +16 -0
  331. package/.next/standalone/.next/static/chunks/109f1pvy3e_vd.js +1 -0
  332. package/.next/standalone/.next/static/chunks/10em078j6cul4.js +1 -0
  333. package/.next/standalone/.next/static/chunks/{0a9t5laucshuf.js → 10todxw2604hk.js} +1 -1
  334. package/.next/standalone/.next/static/chunks/{05zne4hn1v65k.js → 10uz6x-h~dv0..js} +14 -13
  335. package/.next/standalone/.next/static/chunks/{0~nexgc77r_hk.js → 13q-ol3bkz8ft.js} +16 -15
  336. package/.next/standalone/.next/static/chunks/14if5vtky.3sn.js +1 -0
  337. package/.next/standalone/.next/static/chunks/{017n78o_7xb4_.js → 15hd85wggjanq.js} +1 -1
  338. package/.next/standalone/.next/static/chunks/15i_n03eg5uyp.js +1 -0
  339. package/.next/standalone/.next/static/chunks/15sblmrroyskk.js +1 -0
  340. package/.next/standalone/.next/static/chunks/1756nfyulu.9h.css +1 -0
  341. package/.next/standalone/.next/static/chunks/{0j.sfmmqj2xel.js → 17rh_.7tkk2m0.js} +15 -14
  342. package/.next/standalone/.next/static/chunks/turbopack-02..gqxjw9fev.js +1 -0
  343. package/.next/standalone/.next/static/chunks/turbopack-05luogg2yney~.js +1 -0
  344. package/.next/standalone/.next/static/chunks/turbopack-092b2t67-z3ds.js +1 -0
  345. package/.next/standalone/.next/static/chunks/turbopack-0eue2xixdnbd..js +1 -0
  346. package/.next/standalone/.next/static/chunks/{turbopack-15bv~a4hbvh29.js → turbopack-0i6l53-j6t6zg.js} +1 -1
  347. package/.next/standalone/.next/static/chunks/{turbopack-0d-xk62f1t05v.js → turbopack-0ser1ty-sh2jk.js} +1 -1
  348. package/.next/standalone/.next/static/chunks/{turbopack-0zcblahe.hdqd.js → turbopack-0zouy.~ram.7g.js} +1 -1
  349. package/.next/standalone/.next/static/{X7BRO7ORR4bKFt1LXzGU8 → onsm_2jNZvyggHqM9yibn}/_buildManifest.js +11 -6
  350. package/.next/standalone/messages/de/terminal.json +4 -0
  351. package/.next/standalone/messages/de/webBrowser.json +5 -1
  352. package/.next/standalone/messages/en/terminal.json +4 -0
  353. package/.next/standalone/messages/en/webBrowser.json +5 -1
  354. package/.next/standalone/messages/es/terminal.json +4 -0
  355. package/.next/standalone/messages/es/webBrowser.json +5 -1
  356. package/.next/standalone/messages/fr/terminal.json +4 -0
  357. package/.next/standalone/messages/fr/webBrowser.json +5 -1
  358. package/.next/standalone/messages/ja/terminal.json +4 -0
  359. package/.next/standalone/messages/ja/webBrowser.json +5 -1
  360. package/.next/standalone/messages/ko/terminal.json +4 -0
  361. package/.next/standalone/messages/ko/webBrowser.json +5 -1
  362. package/.next/standalone/messages/pt-BR/terminal.json +4 -0
  363. package/.next/standalone/messages/pt-BR/webBrowser.json +5 -1
  364. package/.next/standalone/messages/ru/terminal.json +4 -0
  365. package/.next/standalone/messages/ru/webBrowser.json +5 -1
  366. package/.next/standalone/messages/tr/terminal.json +4 -0
  367. package/.next/standalone/messages/tr/webBrowser.json +5 -1
  368. package/.next/standalone/messages/zh-CN/terminal.json +4 -0
  369. package/.next/standalone/messages/zh-CN/webBrowser.json +5 -1
  370. package/.next/standalone/messages/zh-TW/terminal.json +4 -0
  371. package/.next/standalone/messages/zh-TW/webBrowser.json +5 -1
  372. package/.next/standalone/package.json +5 -2
  373. package/.next/standalone/server.js +1 -1
  374. package/.next/standalone/src/config/tmux.conf +17 -7
  375. package/.next/standalone/src/lib/providers/claude/index.ts +44 -0
  376. package/.next/standalone/src/pages/api/layout/pane/[paneId]/tabs/index.ts +13 -6
  377. package/README.de.md +5 -4
  378. package/README.es.md +5 -4
  379. package/README.fr.md +5 -4
  380. package/README.ja.md +5 -4
  381. package/README.ko.md +5 -4
  382. package/README.md +5 -4
  383. package/README.pt-BR.md +5 -4
  384. package/README.ru.md +5 -4
  385. package/README.tr.md +5 -4
  386. package/README.zh-CN.md +5 -4
  387. package/README.zh-TW.md +5 -4
  388. package/bin/cli.js +95 -0
  389. package/dist/server.js +974 -852
  390. package/package.json +5 -2
  391. package/src/config/tmux.conf +17 -7
  392. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01.~37j._.js +0 -3
  393. package/.next/standalone/.next/server/chunks/[root-of-the-server]__016s4a9._.js +0 -3
  394. package/.next/standalone/.next/server/chunks/[root-of-the-server]__02.9a5j._.js +0 -3
  395. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03l15.f._.js +0 -3
  396. package/.next/standalone/.next/server/chunks/[root-of-the-server]__05ij_ys._.js +0 -42
  397. package/.next/standalone/.next/server/chunks/[root-of-the-server]__06h3gzy._.js +0 -3
  398. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_fu3k.._.js +0 -3
  399. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0_imm_0._.js +0 -3
  400. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0abp0lo._.js +0 -3
  401. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0auutl5._.js +0 -5
  402. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d-inw8._.js +0 -3
  403. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g8mjyh._.js +0 -3
  404. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0lk7ru8._.js +0 -3
  405. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0l~_wd0._.js +0 -3
  406. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ovn6yp._.js +0 -3
  407. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0un_g-o._.js +0 -3
  408. package/.next/standalone/.next/server/chunks/[root-of-the-server]__12ksl6n._.js +0 -42
  409. package/.next/standalone/.next/server/chunks/_03-duro._.js +0 -3
  410. package/.next/standalone/.next/server/chunks/_07097f~._.js +0 -3
  411. package/.next/standalone/.next/server/chunks/_0z7d6.z._.js +0 -3
  412. package/.next/standalone/.next/server/chunks/src_lib_0p.xsqi._.js +0 -3
  413. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0da5cj~._.js +0 -3
  414. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12b2-y_._.js +0 -3
  415. package/.next/standalone/.next/server/chunks/ssr/_016o9_-._.js +0 -3
  416. package/.next/standalone/.next/server/chunks/ssr/_04iqb-o._.js +0 -3
  417. package/.next/standalone/.next/server/chunks/ssr/_04q3_kj._.js +0 -3
  418. package/.next/standalone/.next/server/chunks/ssr/_0a_u5qm._.js +0 -3
  419. package/.next/standalone/.next/server/chunks/ssr/_0d58w1~._.js +0 -3
  420. package/.next/standalone/.next/server/chunks/ssr/_0nib_x8._.js +0 -3
  421. package/.next/standalone/.next/server/chunks/ssr/_0nuztht._.js +0 -18
  422. package/.next/standalone/.next/server/chunks/ssr/_0oca87b._.js +0 -3
  423. package/.next/standalone/.next/server/chunks/ssr/_0ovjjn5._.js +0 -3
  424. package/.next/standalone/.next/server/chunks/ssr/_0pk4~_0._.js +0 -3
  425. package/.next/standalone/.next/server/chunks/ssr/_0qt-m3l._.js +0 -3
  426. package/.next/standalone/.next/server/chunks/ssr/_0sm8slq._.js +0 -3
  427. package/.next/standalone/.next/server/chunks/ssr/_10s2f96._.js +0 -3
  428. package/.next/standalone/.next/server/chunks/ssr/_13c-b~p._.js +0 -3
  429. package/.next/standalone/.next/server/chunks/ssr/_13lrp9_._.js +0 -3
  430. package/.next/standalone/.next/static/chunks/0-7en.d6a3jki.js +0 -1
  431. package/.next/standalone/.next/static/chunks/0-pm5wxsyxs3e.js +0 -1
  432. package/.next/standalone/.next/static/chunks/01ul8lmr04ls3.js +0 -1
  433. package/.next/standalone/.next/static/chunks/05b7zy0n0vhms.js +0 -1
  434. package/.next/standalone/.next/static/chunks/05kshd9vdrl4o.js +0 -1
  435. package/.next/standalone/.next/static/chunks/05w~qu2zpvh2f.js +0 -1
  436. package/.next/standalone/.next/static/chunks/08f708~_7uy_i.js +0 -1
  437. package/.next/standalone/.next/static/chunks/0af.3khnmptnl.js +0 -1
  438. package/.next/standalone/.next/static/chunks/0cvx059r5hgj1.js +0 -1
  439. package/.next/standalone/.next/static/chunks/0dp178b-0_ltl.js +0 -1
  440. package/.next/standalone/.next/static/chunks/0ebjicjua7yl-.js +0 -1
  441. package/.next/standalone/.next/static/chunks/0gn-f6_m696k0.js +0 -1
  442. package/.next/standalone/.next/static/chunks/0kaufevqdhsld.js +0 -1
  443. package/.next/standalone/.next/static/chunks/0n2k1al4sr_qq.css +0 -1
  444. package/.next/standalone/.next/static/chunks/0n4fv8.loh_0x.js +0 -1
  445. package/.next/standalone/.next/static/chunks/0nn618je7_7ec.js +0 -16
  446. package/.next/standalone/.next/static/chunks/0pv9~yath4mjh.js +0 -1
  447. package/.next/standalone/.next/static/chunks/0q0yh17_ncipj.js +0 -1
  448. package/.next/standalone/.next/static/chunks/0qkrdmhiv-0d3.js +0 -1
  449. package/.next/standalone/.next/static/chunks/0r9z55-r31en8.js +0 -1
  450. package/.next/standalone/.next/static/chunks/0ra09kjja5rf..js +0 -1
  451. package/.next/standalone/.next/static/chunks/0sc7tkg1gojr..js +0 -1
  452. package/.next/standalone/.next/static/chunks/0u.snf3d~5nvq.js +0 -1
  453. package/.next/standalone/.next/static/chunks/0u9yrtrs1bktp.js +0 -1
  454. package/.next/standalone/.next/static/chunks/0v.l~.~v98c2c.js +0 -1
  455. package/.next/standalone/.next/static/chunks/0wu~4k-l8otuy.js +0 -1
  456. package/.next/standalone/.next/static/chunks/0wvu-lowt9uem.js +0 -1
  457. package/.next/standalone/.next/static/chunks/0x7cvsf..ezd..js +0 -1
  458. package/.next/standalone/.next/static/chunks/0yb~gw6ukzdmo.js +0 -1
  459. package/.next/standalone/.next/static/chunks/0yg3hj1g~k1ip.js +0 -1
  460. package/.next/standalone/.next/static/chunks/0z_~g~mb.kjs1.js +0 -1
  461. package/.next/standalone/.next/static/chunks/0~c6h8j7ut2ca.js +0 -1
  462. package/.next/standalone/.next/static/chunks/0~lnp45fxxtgz.js +0 -1
  463. package/.next/standalone/.next/static/chunks/0~ts_4hi7.u_0.js +0 -1
  464. package/.next/standalone/.next/static/chunks/13_l03e3sab-g.js +0 -1
  465. package/.next/standalone/.next/static/chunks/156~ejmpjxu8e.js +0 -1
  466. package/.next/standalone/.next/static/chunks/15m4y6otktj8z.js +0 -1
  467. package/.next/standalone/.next/static/chunks/16bag6z7n~ffw.js +0 -1
  468. package/.next/standalone/.next/static/chunks/17ebdp-_o5o30.js +0 -1
  469. package/.next/standalone/.next/static/chunks/turbopack-0nn9kx.dkgwqs.js +0 -1
  470. package/.next/standalone/.next/static/chunks/turbopack-0rb3q18bhb2hu.js +0 -1
  471. package/.next/standalone/.next/static/chunks/turbopack-0~wmco6ifn20m.js +0 -1
  472. package/.next/standalone/.next/static/chunks/turbopack-1469mxaruw82d.js +0 -1
  473. /package/.next/standalone/.next/static/{X7BRO7ORR4bKFt1LXzGU8 → onsm_2jNZvyggHqM9yibn}/_clientMiddlewareManifest.js +0 -0
  474. /package/.next/standalone/.next/static/{X7BRO7ORR4bKFt1LXzGU8 → onsm_2jNZvyggHqM9yibn}/_ssgManifest.js +0 -0
@@ -0,0 +1,52 @@
1
+ module.exports=[688947,(e,t,a)=>{t.exports=e.x("stream",()=>require("stream"))},406461,(e,t,a)=>{t.exports=e.x("zlib",()=>require("zlib"))},254799,(e,t,a)=>{t.exports=e.x("crypto",()=>require("crypto"))},524836,(e,t,a)=>{t.exports=e.x("https",()=>require("https"))},921517,(e,t,a)=>{t.exports=e.x("http",()=>require("http"))},504446,(e,t,a)=>{t.exports=e.x("net",()=>require("net"))},755004,(e,t,a)=>{t.exports=e.x("tls",()=>require("tls"))},792509,(e,t,a)=>{t.exports=e.x("url",()=>require("url"))},500874,(e,t,a)=>{t.exports=e.x("buffer",()=>require("buffer"))},427699,(e,t,a)=>{t.exports=e.x("events",()=>require("events"))},270406,(e,t,a)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,a)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,a)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,a)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,a)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,a)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,a)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,a)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,a=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(a)),e.s(["PRISTINE_ENV",0,a],965898);let r=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),i=["LC_"],s=e=>r.has(e)||i.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,r]of Object.entries(a))void 0!==r&&s(t)&&(e[t]=r);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>a.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},25146,e=>{"use strict";var t=e.i(130146),a=e.i(814747),r=e.i(446786);let i=a.default.join(r.default.homedir(),".purplemux","logs"),s=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let a of e.split(",")){let[e,r]=a.split("=").map(e=>e.trim());e&&r&&(t[e]=r)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[s,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:a.default.join(i,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??s,t}])},44014,e=>{"use strict";let t,a;var r=e.i(666680);e.s(["nanoid",0,function(e=21){var i;i=e|=0,!t||t.length<i?(t=Buffer.allocUnsafe(128*i),r.webcrypto.getRandomValues(t),a=0):a+i>t.length&&(r.webcrypto.getRandomValues(t),a=0),a+=i;let s="";for(let r=a-e;r<a;r++)s+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[r]];return s}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),a=e.i(924868),r=e.i(224361),i=e.i(814747),s=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let c=(0,o.createLogger)("terminal"),p=(0,r.promisify)(t.execFile),d="purple",m=i.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),w=async()=>{try{let{stdout:e}=await p("tmux",["-L",d,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},f=async(e,t,a,r)=>{let i=(0,l.buildShellLaunchCommand)();await p("tmux",["-u","-L",d,"-f",m,"new-session","-d","-s",e,"-x",String(t),"-y",String(a),i],{timeout:5e3,cwd:r||n.PRISTINE_ENV.HOME||"/"}),await v(),c.debug(`tmux session created: ${e} (cols: ${t}, rows: ${a})`)},y=e=>new Promise(t=>setTimeout(t,e)),h=async e=>{if(!await k(e))return;c.debug(`killSession start: ${e}`);let t=await S(e);if(t)try{c.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await p("tmux",["-L",d,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await k(e))return void c.debug(`killSession done (SIGTERM): ${e}`);await y(200)}if(c.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{c.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await p("tmux",["-L",d,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await k(e))return void c.debug(`killSession done (SIGKILL): ${e}`);await y(200)}c.warn(`tmux session still alive after kill: ${e}`)},g=async e=>{let t=n.PRISTINE_ENV.HOME||"/";if(!e)return t;let r=e;for(;;){try{if((await a.default.stat(r)).isDirectory())return r}catch{}let e=i.default.dirname(r);if(e===r)return t;r=e}},k=async e=>{try{return await p("tmux",["-L",d,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},x=async()=>{},b=async()=>{await x();let e=await w();e.length>0&&e.forEach(e=>{c.debug(`existing tmux session found: ${e}`)})},I=async e=>{if(u)try{return await a.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await p("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),a=t.split("\n").find(e=>e.startsWith("n/"));return a?a.slice(1):null}catch{return null}},L=async e=>{let t=await S(e);if(t){let e=await I(t);if(e)return e}try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},S=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),a=parseInt(t.trim(),10);return Number.isNaN(a)?null:a}catch{return null}},v=async()=>{try{await p("tmux",["-L",d,"source-file",m],{timeout:5e3})}catch{}},_=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},$=async()=>{try{let{stdout:e}=await p("tmux",["-L",d,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let a of e.trim().split("\n")){if(!a)continue;let[e,r,i,s,n]=a.split(" ");if(e&&r){let a=parseInt(s,10),l=parseInt(n,10);t.set(e,{command:r,path:i||"",pid:Number.isNaN(a)?0:a,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},P=new Set(["bash","zsh","fish","sh","dash"]),N=async e=>{let t=await _(e);return t?{isSafe:P.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},T=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},E=async e=>{await p("tmux",["-L",d,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},W=async(e,t)=>{await E(e),await p("tmux",["-L",d,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},C=async(e,t)=>{await E(e),await p("tmux",["-L",d,"send-keys","-t",e,t],{timeout:5e3})},A=async(e,t)=>{await E(e),await p("tmux",["-L",d,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await p("tmux",["-L",d,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await p("tmux",["-L",d,"send-keys","-t",e,"Enter"],{timeout:5e3})},D=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[a,r,i,s,n,l]=t.trim().split(" ");return{cwd:a||null,command:r||null,pid:i&&parseInt(i,10)||null,width:s&&parseInt(s,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},F=new Set(["node","python","python3","ruby","perl","deno","bun"]),M=async()=>{try{await p("tmux",["-L",d,"kill-server"],{timeout:5e3}),c.debug("tmux server killed")}catch{}},O=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},j=async(e,t)=>{try{let{stdout:a}=await p("tmux",["-L",d,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return a}catch{return null}},R=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let r of(await a.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(r,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await p("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},G=async e=>{let t=[],a=[e];for(;a.length>0;){let e=await R(a);if(0===e.length)break;t.push(...e),a=e}return t},q=async e=>{try{let t=new Set(e),{stdout:a}=await p("ss",["-tlnp"],{timeout:5e3}),r=new Set;for(let e of a.split("\n")){let a=e.match(/pid=(\d+)/g);if(!a||!a.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let i=e.match(/:(\d+)\s/);i&&r.add(parseInt(i[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},H=async e=>{let t=await G(e);if(0===t.length)return[];if(u)return q(t);try{let{stdout:e}=await p("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),a=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&a.add(parseInt(e[1],10))}return[...a].sort((e,t)=>e-t)}catch{return[]}},U=async e=>{let t=await S(e);if(!t)return null;try{let{stdout:e}=await p("pgrep",["-n","-P",String(t)],{timeout:5e3}),a=e.trim();if(!a)return null;let{stdout:r}=await p("ps",["-o","args=","-p",a],{timeout:5e3}),s=r.trim();if(!s)return null;let n=s.split(/\s+/);if(0===n.length)return s;if(n[0]=i.default.basename(n[0]),F.has(n[0])&&n.length>1){let e=i.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,P,"applyConfig",0,v,"capturePaneContent",0,O,"capturePaneContentWithHistory",0,j,"checkTerminalProcess",0,N,"createSession",0,f,"defaultSessionName",0,()=>`pt-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}`,"exitCopyMode",0,E,"getAllPanesInfo",0,$,"getLastCommand",0,U,"getListeningPorts",0,H,"getPaneCurrentCommand",0,_,"getPaneDetailInfo",0,D,"getPaneTitle",0,T,"getSessionCwd",0,L,"getSessionPanePid",0,S,"hasSession",0,k,"killServer",0,M,"killSession",0,h,"listSessions",0,w,"resolveExistingDir",0,g,"scanSessions",0,b,"sendBracketedPaste",0,A,"sendKeys",0,W,"sendRawKeys",0,C,"workspaceSessionName",0,(e,t,a)=>`pt-${e}-${t}-${a}`],459015)},160874,e=>{"use strict";var t=e.i(924868),a=e.i(814747),r=e.i(25146),i=e.i(825265);(0,r.createLogger)("claude-prompt");let s=e=>a.default.join((0,i.resolveLayoutDir)(e),"claude-prompt.md"),n=async e=>{let r=s(e.id);await t.default.mkdir(a.default.dirname(r),{recursive:!0});let i=`# purplemux context
2
+
3
+ You are running inside a purplemux workspace tab.
4
+
5
+ - **Workspace ID**: \`${e.id}\`
6
+
7
+ Use \`purplemux workspaces\` if you need the workspace name or directories.
8
+
9
+ ## purplemux CLI
10
+
11
+ The \`purplemux\` CLI lets you inspect and control other tabs in this workspace.
12
+ It reads port and token from \`~/.purplemux/{port,cli-token}\` automatically,
13
+ so no environment setup is needed.
14
+
15
+ ### Commands
16
+
17
+ \`\`\`bash
18
+ purplemux workspaces # list all workspaces
19
+ purplemux tab list -w ${e.id} # list tabs in this workspace
20
+ purplemux tab create -w ${e.id} [-n NAME] [-t TYPE] # create a tab (type: terminal | claude-code | web-browser | diff)
21
+ purplemux tab send -w ${e.id} TAB_ID CONTENT... # send input to a tab
22
+ purplemux tab status -w ${e.id} TAB_ID # tab status
23
+ purplemux tab result -w ${e.id} TAB_ID # capture current pane content
24
+ purplemux tab close -w ${e.id} TAB_ID # close a tab
25
+ \`\`\`
26
+
27
+ For the full HTTP API reference (including endpoint paths and payloads),
28
+ run:
29
+
30
+ \`\`\`bash
31
+ purplemux api-guide
32
+ \`\`\`
33
+
34
+ ### When to use
35
+
36
+ - Delegate work to another tab when a task benefits from isolation
37
+ (long-running builds, different project context, parallel exploration).
38
+ - Poll \`status\` and read \`result\` to verify delegated work.
39
+ - Prefer small, scoped tabs over cramming everything into one session.
40
+
41
+ ### Tab type notes
42
+
43
+ - **\`web-browser\` tabs**: Electron webviews, not tmux. The \`alive\` field in
44
+ \`tab list\` / \`tab status\` is always \`false\` for these — that is the normal
45
+ value, not a sign the tab is dead. Do not gate actions on \`alive\`. Use the
46
+ browser-specific HTTP endpoints (\`/browser/url\`, \`/browser/screenshot\`, …;
47
+ see \`purplemux api-guide\`) directly.
48
+ - **\`terminal\` / \`claude-code\` tabs**: run inside tmux, so \`alive\` is a valid
49
+ liveness signal.
50
+ `;try{if(await t.default.readFile(r,"utf-8")===i)return r}catch{}return await t.default.writeFile(r,i,"utf-8"),r};e.s(["getClaudePromptPath",0,s,"writeClaudePromptFile",0,n])},322429,e=>{"use strict";var t=e.i(924868),a=e.i(814747),r=e.i(446786),i=e.i(44014),s=e.i(459015),n=e.i(25146),l=e.i(666126),o=e.i(825265),u=e.i(804767),c=e.i(160874);let p=(0,n.createLogger)("workspace"),d="Workspace ",m=a.default.join(r.default.homedir(),".purplemux"),w=a.default.join(m,"workspaces.json"),f=a.default.join(m,"layout.json"),y=a.default.join(m,"tabs.json"),h=globalThis;h.__purplemuxWorkspaceLock||(h.__purplemuxWorkspaceLock=Promise.resolve());let g=async e=>{let t,a=new Promise(e=>{t=e}),r=h.__purplemuxWorkspaceLock;h.__purplemuxWorkspaceLock=a,await r;try{return await e()}finally{t()}},k=()=>({workspaces:[],groups:[],sidebarCollapsed:!1,sidebarWidth:240,updatedAt:new Date().toISOString()}),x=e=>(e.groups||(e.groups=[]),e.groups),b=async()=>{let e;try{e=await t.default.readFile(w,"utf-8")}catch{return null}try{let t=JSON.parse(e);for(let e of t.workspaces)!e.directories&&e.directory&&(e.directories=[e.directory],delete e.directory),delete e.order;for(let e of(Array.isArray(t.groups)||(t.groups=[]),t.groups))delete e.order;let a=new Set(t.groups.map(e=>e.id));for(let e of t.workspaces)e.groupId&&!a.has(e.groupId)&&(e.groupId=null);return t}catch{p.warn("Failed to parse workspaces.json, starting empty");try{await t.default.copyFile(w,w.replace(/\.json$/,".json.bak"))}catch{}return null}},I=async e=>{let a;a=x(e),e.workspaces=((e,t)=>{let a=new Set(t.map(e=>e.id)),r=new Map,i=[];for(let t of e){let e=t.groupId??null;if(e&&a.has(e)){let a=r.get(e)??[];a.push(t),r.set(e,a)}else i.push(t)}let s=[];for(let e of t){let t=r.get(e.id);t&&s.push(...t)}return s.push(...i),s})(e.workspaces,a);let{workspaces:r,groups:i,activeWorkspaceId:s,sidebarCollapsed:n,sidebarWidth:o}=e,u=JSON.stringify({workspaces:r,groups:i??[],activeWorkspaceId:s,sidebarCollapsed:n,sidebarWidth:o});if(h.__purplemuxWorkspacesContentCache===u)return;e.updatedAt=new Date().toISOString();let c=w+".tmp";try{await t.default.writeFile(c,JSON.stringify(e,null,2),{mode:384}),await t.default.rename(c,w)}catch(e){throw await t.default.unlink(c).catch(()=>{}),e}h.__purplemuxWorkspacesContentCache=u,(0,l.broadcastSync)({type:"workspace"})},L=async()=>{let e=await (0,o.readLayoutFile)(f);if(!e)return null;let a="ws-default";await t.default.mkdir((0,o.resolveLayoutDir)(a),{recursive:!0}),await (0,o.writeLayoutFile)(e,(0,o.resolveLayoutFile)(a));let i={workspaces:[{id:a,name:"default",directories:[r.default.homedir()]}],sidebarCollapsed:!1,sidebarWidth:240,updatedAt:e.updatedAt||new Date().toISOString()};return await I(i),p.info("Phase 4 layout.json → Workspace 'default' migration complete"),i},S=async()=>{try{let e=await t.default.readFile(y,"utf-8"),a=JSON.parse(e);if(!Array.isArray(a.tabs)||0===a.tabs.length)return null;let r=`pane-${(0,i.nanoid)(6)}`,s={root:{type:"pane",id:r,tabs:a.tabs,activeTabId:a.activeTabId??null},activePaneId:r,updatedAt:new Date().toISOString()},n=f+".tmp";try{await t.default.writeFile(n,JSON.stringify(s,null,2),{mode:384}),await t.default.rename(n,f)}catch(e){throw await t.default.unlink(n).catch(()=>{}),e}return p.info("tabs.json → layout.json migration complete"),await L()}catch{return null}},v=async()=>{await t.default.mkdir(a.default.join(m,"workspaces"),{recursive:!0});let e=await b();if(!e&&(await t.default.access(f).then(()=>!0).catch(()=>!1)?e=await L():await t.default.access(y).then(()=>!0).catch(()=>!1)&&(e=await S())),!e){let t=k();await I(t),e=t,p.info("Initial workspaces.json created")}if(0===e.workspaces.length)return;let r=await (0,s.listSessions)();for(let t of e.workspaces){let e=(0,o.resolveLayoutFile)(t.id),a=await (0,o.readLayoutFile)(e);if(!a){p.warn(`Workspace '${t.name}': layout.json corrupted, reset to default pane`),a=await (0,o.createDefaultLayout)(t.id,t.directories[0]),await (0,o.writeLayoutFile)(a,e);continue}let i=(0,u.collectAllTabs)(a.root).map(e=>e.sessionName),s=`pt-${t.id}-`,n=r.filter(e=>i.includes(e)||e.startsWith(s));try{await (0,o.crossCheckLayout)(a,n,t.id,t.directories[0])&&await (0,o.writeLayoutFile)(a,e)}catch(e){p.error(`Workspace '${t.name}': tmux consistency check failed: ${e instanceof Error?e.message:e}`)}}},_=async()=>{let e=await b();return e?{workspaces:e.workspaces,groups:e.groups??[],activeWorkspaceId:e.activeWorkspaceId,sidebarCollapsed:e.sidebarCollapsed,sidebarWidth:e.sidebarWidth}:{workspaces:[],groups:[],sidebarCollapsed:!1,sidebarWidth:220}},$=async()=>{let e=await b();return e?.activeWorkspaceId&&e.workspaces.some(t=>t.id===e.activeWorkspaceId)?e.activeWorkspaceId:e?.workspaces[0]?.id??null},P=async e=>{let t=await b();return t?.workspaces.find(t=>t.id===e)},N=async(e,a,r)=>g(async()=>{let s;try{s=await t.default.stat(e)}catch{throw Error("Directory does not exist")}if(!s.isDirectory())throw Error("Please enter a directory path, not a file");let n=await b()??k(),l=`ws-${(0,i.nanoid)(6)}`,u=a?.trim()||(e=>{let t=0;for(let a of e)if(a.name.startsWith(d)){let e=parseInt(a.name.slice(d.length),10);e>t&&(t=e)}return`${d}${t+1}`})(n.workspaces),m=await (0,o.createDefaultLayout)(l,e,r);await t.default.mkdir((0,o.resolveLayoutDir)(l),{recursive:!0}),await (0,o.writeLayoutFile)(m,(0,o.resolveLayoutFile)(l));let w={id:l,name:u,directories:[e]};return n.workspaces.push(w),await I(n),await (0,c.writeClaudePromptFile)(w),p.debug(`Created: ${l} (${u}, ${e})`),w}),T=async e=>g(async()=>{let t=await b()??k(),a=t.workspaces.findIndex(t=>t.id===e);if(-1===a)return!1;let r=t.workspaces[a],i=await (0,o.readLayoutFile)((0,o.resolveLayoutFile)(e));if(i)for(let e of(0,u.collectAllTabs)(i.root))try{await (0,s.killSession)(e.sessionName)}catch{}try{await (0,o.removeLayoutFile)(e)}catch{}return t.workspaces.splice(a,1),await I(t),p.info(`Deleted: ${e} (${r.name})`),!0}),E=async(e,t)=>g(async()=>{let a=await b();if(!a)return null;let r=a.workspaces.find(t=>t.id===e);return r?(r.name=t,await I(a),await (0,c.writeClaudePromptFile)(r),p.debug(`Renamed: ${e} → "${t}"`),{...r}):null}),W=async e=>g(async()=>{let t=await b()??k();void 0!==e.activeWorkspaceId&&(t.activeWorkspaceId=e.activeWorkspaceId),void 0!==e.sidebarCollapsed&&(t.sidebarCollapsed=e.sidebarCollapsed),void 0!==e.sidebarWidth&&(t.sidebarWidth=e.sidebarWidth),await I(t)}),C=async(e,t)=>g(async()=>{let a=await b();if(!a)return;let r=a.workspaces.find(t=>t.id===e);r&&JSON.stringify(r.directories)!==JSON.stringify(t)&&(r.directories=t,await I(a),await (0,c.writeClaudePromptFile)(r))}),A=async e=>g(async()=>{let t=await b()??k(),a=new Map(t.workspaces.map(e=>[e.id,e])),r=new Set((t.groups??[]).map(e=>e.id)),i=[];for(let t of e){let e=a.get(t.id);if(!e)return!1;void 0!==t.groupId&&(e.groupId=t.groupId&&r.has(t.groupId)?t.groupId:null),i.push(e)}return i.length===t.workspaces.length&&(t.workspaces=i,await I(t),!0)}),D=async e=>g(async()=>{let t=await b()??k(),a=x(t),r=e.trim()||`Group ${a.length+1}`,s={id:`grp-${(0,i.nanoid)(6)}`,name:r,collapsed:!1};return a.push(s),await I(t),p.debug(`Group created: ${s.id} (${s.name})`),s}),F=async(e,t)=>g(async()=>{let a=await b();if(!a)return null;let r=(a.groups??[]).find(t=>t.id===e);if(!r)return null;let i=t.trim();return i?(r.name=i,await I(a),{...r}):r}),M=async(e,t)=>g(async()=>{let a=await b();if(!a)return!1;let r=(a.groups??[]).find(t=>t.id===e);return!!r&&(r.collapsed===t||(r.collapsed=t,await I(a),!0))}),O=async e=>g(async()=>{let t=await b();if(!t)return!1;let a=x(t),r=a.findIndex(t=>t.id===e);if(-1===r)return!1;for(let a of t.workspaces)a.groupId===e&&(a.groupId=null);return a.splice(r,1),await I(t),p.info(`Group ungrouped: ${e}`),!0}),j=async e=>g(async()=>{let t=await b();if(!t)return!1;let a=x(t),r=new Map(a.map(e=>[e.id,e])),i=[];for(let t of e){let e=r.get(t);if(!e)return!1;i.push(e)}return i.length===a.length&&(t.groups=i,await I(t),!0)}),R=async(e,t)=>g(async()=>{let a=await b();if(!a)return!1;let r=a.workspaces.find(t=>t.id===e);if(!r)return!1;let i=new Set((a.groups??[]).map(e=>e.id)),s=t&&i.has(t)?t:null;return(r.groupId??null)===s||(r.groupId=s,await I(a),!0)}),G=async e=>{try{if(!(await t.default.stat(e)).isDirectory())return{valid:!1,error:"Please enter a directory path, not a file"}}catch{return{valid:!1,error:"Directory does not exist"}}return{valid:!0,suggestedName:a.default.basename(e)}};e.s(["createGroup",0,D,"createWorkspace",0,N,"deleteWorkspace",0,T,"getActiveWorkspaceId",0,$,"getWorkspaceById",0,P,"getWorkspaces",0,_,"initWorkspaceStore",0,v,"renameGroup",0,F,"renameWorkspace",0,E,"reorderGroups",0,j,"reorderWorkspaces",0,A,"setGroupCollapsed",0,M,"setWorkspaceGroup",0,R,"ungroupGroup",0,O,"updateActive",0,W,"updateWorkspaceDirectories",0,C,"validateDirectory",0,G],322429)}];
51
+
52
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0a4t.z5._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[522734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},871911,e=>{"use strict";var t=e.i(254799),r=e.i(522734),a=e.i(814747),i=e.i(446786);let s=a.default.join(i.default.homedir(),".purplemux","cli-token"),n=globalThis;e.s(["verifyCliToken",0,e=>{let i=e.headers["x-pmux-token"];var o="string"==typeof i?i:void 0;if(!o)return!1;let l=(()=>{if(n.__ptCliToken)return n.__ptCliToken;let e=(()=>{try{return r.default.readFileSync(s,"utf-8").trim()||null}catch{return null}})();if(e)return n.__ptCliToken=e,e;let i=(0,t.randomBytes)(32).toString("hex");n.__ptCliToken=i;try{r.default.mkdirSync(a.default.dirname(s),{recursive:!0}),r.default.writeFileSync(s,i,{mode:384})}catch{}return i})();return o.length===l.length&&(0,t.timingSafeEqual)(Buffer.from(o),Buffer.from(l))}])},200523,e=>{"use strict";var t=e.i(825265),r=e.i(804767),a=e.i(322429),i=e.i(871911);let s=async(e,i)=>{if(!await (0,a.getWorkspaceById)(e))return null;let s=await (0,t.getLayout)(e);for(let t of(0,r.collectPanes)(s.root)){let r=t.tabs.find(e=>e.id===i);if(r)return{workspaceId:e,paneId:t.id,tab:r}}return null},n=async e=>{let a=await (0,t.getLayout)(e);return(0,r.getFirstPaneId)(a.root)||null},o=async(e,t,r,a)=>{if(e.method!==r){t.setHeader("Allow",r),t.status(405).json({error:"Method not allowed"});return}if(!(0,i.verifyCliToken)(e))return void t.status(403).json({error:"Forbidden"});let n=e.query.tabId,o="string"==typeof e.query.workspaceId?e.query.workspaceId:void 0;if(!o)return void t.status(400).json({error:"workspaceId is required"});let l=await s(o,n);if(!l)return void t.status(404).json({error:"Tab not found"});if("web-browser"!==l.tab.panelType)return void t.status(400).json({error:"Tab is not a web-browser panel"});let u=globalThis.__ptBrowserBridge??null;u?await a({tabId:n,bridge:u}):t.status(503).json({error:"Browser bridge unavailable (Electron-only feature)"})};e.s(["findTab",0,s,"resolveFirstPaneId",0,n,"withBrowserTab",0,o],200523)},605226,e=>{"use strict";var t=e.i(926747),r=e.i(190406),a=e.i(244898),i=e.i(262950),s=e.i(200523);let n=async(e,t)=>{await (0,s.withBrowserTab)(e,t,"POST",async({tabId:r,bridge:a})=>{let{expression:i}=e.body??{};if(!i||"string"!=typeof i)return void t.status(400).json({error:"expression is required"});try{let e=await a.evaluate(r,i);t.status(200).json({tabId:r,value:e})}catch(r){let e=r instanceof Error?r.message:"evaluation failed";t.status(409).json({error:e})}})};e.s(["default",0,n],184050);var o=e.i(184050),l=e.i(7031),u=e.i(181927),d=e.i(846432);let p=(0,i.hoist)(o,"default"),c=(0,i.hoist)(o,"config"),f=new a.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/cli/tabs/[tabId]/browser/eval",pathname:"/api/cli/tabs/[tabId]/browser/eval",bundlePath:"",filename:""},userland:o,distDir:".next",relativeProjectDir:""});async function v(e,r,a){a.requestMeta&&(0,d.setRequestMeta)(e,a.requestMeta),f.isDev&&(0,d.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let i="/api/cli/tabs/[tabId]/browser/eval";i=i.replace(/\/index$/,"")||"/";let s=await f.prepare(e,r,{srcPage:i});if(!s){r.statusCode=400,r.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve());return}let{query:n,params:o,prerenderManifest:p,routerServerContext:c}=s;try{let t,a=e.method||"GET",s=(0,l.getTracer)(),d=s.getActiveScopeSpan(),v=!!(null==c?void 0:c.isWrappedByNextServer),b=f.instrumentationOnRequestError.bind(f),w=async l=>f.render(e,r,{query:{...n,...o},params:o,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:p.preview,propagateError:!1,dev:f.isDev,page:"/api/cli/tabs/[tabId]/browser/eval",internalRevalidate:null==c?void 0:c.revalidate,onError:(...t)=>b(e,...t)}).finally(()=>{if(!l)return;l.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=s.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${a} ${n}`;l.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),l.updateName(e),t&&t!==l&&(t.setAttribute("http.route",n),t.updateName(e))}else l.updateName(`${a} ${i}`)});v&&d?await w(d):(t=s.getActiveScopeSpan(),await s.withPropagatedContext(e.headers,()=>s.trace(u.BaseServerSpan.handleRequest,{spanName:`${a} ${i}`,kind:l.SpanKind.SERVER,attributes:{"http.method":a,"http.target":e.url}},w),void 0,!v))}catch(e){if(f.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==a.waitUntil||a.waitUntil.call(a,Promise.resolve())}}e.s(["config",0,c,"default",0,p,"handler",0,v],605226)},981532,e=>{e.v(e=>Promise.resolve().then(()=>e(322429)))},322522,e=>{e.v(e=>Promise.resolve().then(()=>e(459015)))},245061,e=>{e.v(t=>Promise.all(["server/chunks/src_lib_tab-title_ts_0onatvs._.js"].map(t=>e.l(t))).then(()=>t(785128)))}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0ar~lbk._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,r)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,r=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(r)),e.s(["PRISTINE_ENV",0,r],965898);let a=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),i=["LC_"],s=e=>a.has(e)||i.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,a]of Object.entries(r))void 0!==a&&s(t)&&(e[t]=a);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>r.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},25146,e=>{"use strict";var t=e.i(130146),r=e.i(814747),a=e.i(446786);let i=r.default.join(a.default.homedir(),".purplemux","logs"),s=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let r of e.split(",")){let[e,a]=r.split("=").map(e=>e.trim());e&&a&&(t[e]=a)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[s,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:r.default.join(i,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??s,t}])},44014,e=>{"use strict";let t,r;var a=e.i(666680);e.s(["nanoid",0,function(e=21){var i;i=e|=0,!t||t.length<i?(t=Buffer.allocUnsafe(128*i),a.webcrypto.getRandomValues(t),r=0):r+i>t.length&&(a.webcrypto.getRandomValues(t),r=0),r+=i;let s="";for(let a=r-e;a<r;a++)s+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[a]];return s}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),r=e.i(924868),a=e.i(224361),i=e.i(814747),s=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let p=(0,o.createLogger)("terminal"),c=(0,a.promisify)(t.execFile),m="purple",d=i.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),h=async()=>{try{let{stdout:e}=await c("tmux",["-L",m,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},f=async(e,t,r,a)=>{let i=(0,l.buildShellLaunchCommand)();await c("tmux",["-u","-L",m,"-f",d,"new-session","-d","-s",e,"-x",String(t),"-y",String(r),i],{timeout:5e3,cwd:a||n.PRISTINE_ENV.HOME||"/"}),await E(),p.debug(`tmux session created: ${e} (cols: ${t}, rows: ${r})`)},g=e=>new Promise(t=>setTimeout(t,e)),y=async e=>{if(!await w(e))return;p.debug(`killSession start: ${e}`);let t=await L(e);if(t)try{p.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await c("tmux",["-L",m,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await w(e))return void p.debug(`killSession done (SIGTERM): ${e}`);await g(200)}if(p.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{p.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await c("tmux",["-L",m,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await w(e))return void p.debug(`killSession done (SIGKILL): ${e}`);await g(200)}p.warn(`tmux session still alive after kill: ${e}`)},w=async e=>{try{return await c("tmux",["-L",m,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},x=async()=>{},S=async()=>{await x();let e=await h();e.length>0&&e.forEach(e=>{p.debug(`existing tmux session found: ${e}`)})},_=async e=>{if(u)try{return await r.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await c("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),r=t.split("\n").find(e=>e.startsWith("n/"));return r?r.slice(1):null}catch{return null}},v=async e=>{let t=await L(e);if(t){let e=await _(t);if(e)return e}try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},L=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),r=parseInt(t.trim(),10);return Number.isNaN(r)?null:r}catch{return null}},E=async()=>{try{await c("tmux",["-L",m,"source-file",d],{timeout:5e3})}catch{}},I=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},P=async()=>{try{let{stdout:e}=await c("tmux",["-L",m,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let r of e.trim().split("\n")){if(!r)continue;let[e,a,i,s,n]=r.split(" ");if(e&&a){let r=parseInt(s,10),l=parseInt(n,10);t.set(e,{command:a,path:i||"",pid:Number.isNaN(r)?0:r,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},b=new Set(["bash","zsh","fish","sh","dash"]),N=async e=>{let t=await I(e);return t?{isSafe:b.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},$=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},R=async e=>{await c("tmux",["-L",m,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},M=async(e,t)=>{await R(e),await c("tmux",["-L",m,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},T=async(e,t)=>{await R(e),await c("tmux",["-L",m,"send-keys","-t",e,t],{timeout:5e3})},k=async(e,t)=>{await R(e),await c("tmux",["-L",m,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await c("tmux",["-L",m,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await c("tmux",["-L",m,"send-keys","-t",e,"Enter"],{timeout:5e3})},C=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[r,a,i,s,n,l]=t.trim().split(" ");return{cwd:r||null,command:a||null,pid:i&&parseInt(i,10)||null,width:s&&parseInt(s,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},A=new Set(["node","python","python3","ruby","perl","deno","bun"]),j=async()=>{try{await c("tmux",["-L",m,"kill-server"],{timeout:5e3}),p.debug("tmux server killed")}catch{}},q=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},H=async(e,t)=>{try{let{stdout:r}=await c("tmux",["-L",m,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return r}catch{return null}},O=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let a of(await r.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(a,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await c("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},D=async e=>{let t=[],r=[e];for(;r.length>0;){let e=await O(r);if(0===e.length)break;t.push(...e),r=e}return t},G=async e=>{try{let t=new Set(e),{stdout:r}=await c("ss",["-tlnp"],{timeout:5e3}),a=new Set;for(let e of r.split("\n")){let r=e.match(/pid=(\d+)/g);if(!r||!r.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let i=e.match(/:(\d+)\s/);i&&a.add(parseInt(i[1],10))}return[...a].sort((e,t)=>e-t)}catch{return[]}},U=async e=>{let t=await D(e);if(0===t.length)return[];if(u)return G(t);try{let{stdout:e}=await c("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),r=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&r.add(parseInt(e[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},F=async e=>{let t=await L(e);if(!t)return null;try{let{stdout:e}=await c("pgrep",["-n","-P",String(t)],{timeout:5e3}),r=e.trim();if(!r)return null;let{stdout:a}=await c("ps",["-o","args=","-p",r],{timeout:5e3}),s=a.trim();if(!s)return null;let n=s.split(/\s+/);if(0===n.length)return s;if(n[0]=i.default.basename(n[0]),A.has(n[0])&&n.length>1){let e=i.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,b,"applyConfig",0,E,"capturePaneContent",0,q,"capturePaneContentWithHistory",0,H,"checkTerminalProcess",0,N,"createSession",0,f,"defaultSessionName",0,()=>`pt-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}`,"exitCopyMode",0,R,"getAllPanesInfo",0,P,"getLastCommand",0,F,"getListeningPorts",0,U,"getPaneCurrentCommand",0,I,"getPaneDetailInfo",0,C,"getPaneTitle",0,$,"getSessionCwd",0,v,"getSessionPanePid",0,L,"hasSession",0,w,"killServer",0,j,"killSession",0,y,"listSessions",0,h,"scanSessions",0,S,"sendBracketedPaste",0,k,"sendKeys",0,M,"sendRawKeys",0,T,"workspaceSessionName",0,(e,t,r)=>`pt-${e}-${t}-${r}`],459015)},240760,e=>{"use strict";var t=e.i(926747),r=e.i(190406),a=e.i(244898),i=e.i(262950),s=e.i(233405),n=e.i(224361),l=e.i(459015);let o=(0,n.promisify)(s.execFile),u=e=>e.split("\x1e").map(e=>e.trim()).filter(Boolean).map(e=>{let[t,r,a,i,s,...n]=e.split("\x1f"),l=r.trim()?r.trim().split(/\s+/):[];return{hash:t,shortHash:t.slice(0,7),parents:l,author:a,email:i,timestamp:1e3*parseInt(s,10),subject:n.join("\x1f"),isMerge:l.length>1}}),p=async(e,t=50,r=0)=>{let a=["-C",e,"log",`-${t}`];r>0&&a.push(`--skip=${r}`),a.push("--format=%H\x1f%P\x1f%an\x1f%ae\x1f%at\x1f%s\x1e");let i=o("git",a,{timeout:5e3,maxBuffer:2097152});if(r>0){let{stdout:e}=await i;return{head:"",branch:"",upstreamHash:null,commits:u(e)}}let[s,n,l,p]=await Promise.all([i,o("git",["-C",e,"rev-parse","HEAD"],{timeout:5e3}).then(e=>e.stdout.trim()).catch(()=>""),o("git",["-C",e,"rev-parse","--abbrev-ref","HEAD"],{timeout:5e3}).then(e=>e.stdout.trim()).catch(()=>""),o("git",["-C",e,"rev-parse","@{upstream}"],{timeout:5e3}).then(e=>e.stdout.trim()).catch(()=>null)]);return{head:n,branch:l,upstreamHash:p,commits:u(s.stdout)}};var c=e.i(25146);let m=(0,n.promisify)(s.execFile),d=(0,c.createLogger)("git-log"),h=async(e,t)=>{if("GET"!==e.method)return t.setHeader("Allow","GET"),t.status(405).json({error:"Method not allowed"});let r=e.query.session,a=parseInt(e.query.limit,10),i=Math.min(Number.isFinite(a)&&a>0?a:50,500),s=parseInt(e.query.skip,10),n=Number.isFinite(s)&&s>0?s:0;if(!r)return t.status(400).json({error:"session parameter required"});if(!await (0,l.hasSession)(r))return t.status(404).json({error:"Session not found"});let o=await (0,l.getSessionCwd)(r);if(!o)return t.status(500).json({error:"Failed to get CWD"});try{await m("git",["-C",o,"rev-parse","--is-inside-work-tree"],{timeout:5e3})}catch{return t.status(200).json({isGitRepo:!1,commits:[]})}try{let e=await p(o,i,n);return t.status(200).json({isGitRepo:!0,...e})}catch(e){return d.error(`git log failed: ${e instanceof Error?e.message:e}`),t.status(500).json({error:"Failed to get commit log"})}};e.s(["default",0,h],819069);var f=e.i(819069),g=e.i(7031),y=e.i(181927),w=e.i(846432);let x=(0,i.hoist)(f,"default"),S=(0,i.hoist)(f,"config"),_=new a.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/layout/git-log",pathname:"/api/layout/git-log",bundlePath:"",filename:""},userland:f,distDir:".next",relativeProjectDir:""});async function v(e,r,a){a.requestMeta&&(0,w.setRequestMeta)(e,a.requestMeta),_.isDev&&(0,w.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let i="/api/layout/git-log";i=i.replace(/\/index$/,"")||"/";let s=await _.prepare(e,r,{srcPage:i});if(!s){r.statusCode=400,r.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve());return}let{query:n,params:l,prerenderManifest:o,routerServerContext:u}=s;try{let t,a=e.method||"GET",s=(0,g.getTracer)(),p=s.getActiveScopeSpan(),c=!!(null==u?void 0:u.isWrappedByNextServer),m=_.instrumentationOnRequestError.bind(_),d=async p=>_.render(e,r,{query:{...n,...l},params:l,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:_.isDev,page:"/api/layout/git-log",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>m(e,...t)}).finally(()=>{if(!p)return;p.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=s.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==y.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${a} ${n}`;p.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),p.updateName(e),t&&t!==p&&(t.setAttribute("http.route",n),t.updateName(e))}else p.updateName(`${a} ${i}`)});c&&p?await d(p):(t=s.getActiveScopeSpan(),await s.withPropagatedContext(e.headers,()=>s.trace(y.BaseServerSpan.handleRequest,{spanName:`${a} ${i}`,kind:g.SpanKind.SERVER,attributes:{"http.method":a,"http.target":e.url}},d),void 0,!c))}catch(e){if(_.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==a.waitUntil||a.waitUntil.call(a,Promise.resolve())}}e.s(["config",0,S,"default",0,x,"handler",0,v],240760)}];
1
+ module.exports=[270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,r)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,r=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(r)),e.s(["PRISTINE_ENV",0,r],965898);let a=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),i=["LC_"],s=e=>a.has(e)||i.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,a]of Object.entries(r))void 0!==a&&s(t)&&(e[t]=a);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>r.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},25146,e=>{"use strict";var t=e.i(130146),r=e.i(814747),a=e.i(446786);let i=r.default.join(a.default.homedir(),".purplemux","logs"),s=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let r of e.split(",")){let[e,a]=r.split("=").map(e=>e.trim());e&&a&&(t[e]=a)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[s,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:r.default.join(i,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??s,t}])},44014,e=>{"use strict";let t,r;var a=e.i(666680);e.s(["nanoid",0,function(e=21){var i;i=e|=0,!t||t.length<i?(t=Buffer.allocUnsafe(128*i),a.webcrypto.getRandomValues(t),r=0):r+i>t.length&&(a.webcrypto.getRandomValues(t),r=0),r+=i;let s="";for(let a=r-e;a<r;a++)s+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[a]];return s}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),r=e.i(924868),a=e.i(224361),i=e.i(814747),s=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let p=(0,o.createLogger)("terminal"),c=(0,a.promisify)(t.execFile),m="purple",d=i.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),f=async()=>{try{let{stdout:e}=await c("tmux",["-L",m,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},h=async(e,t,r,a)=>{let i=(0,l.buildShellLaunchCommand)();await c("tmux",["-u","-L",m,"-f",d,"new-session","-d","-s",e,"-x",String(t),"-y",String(r),i],{timeout:5e3,cwd:a||n.PRISTINE_ENV.HOME||"/"}),await I(),p.debug(`tmux session created: ${e} (cols: ${t}, rows: ${r})`)},g=e=>new Promise(t=>setTimeout(t,e)),y=async e=>{if(!await x(e))return;p.debug(`killSession start: ${e}`);let t=await E(e);if(t)try{p.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await c("tmux",["-L",m,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await x(e))return void p.debug(`killSession done (SIGTERM): ${e}`);await g(200)}if(p.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{p.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await c("tmux",["-L",m,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await x(e))return void p.debug(`killSession done (SIGKILL): ${e}`);await g(200)}p.warn(`tmux session still alive after kill: ${e}`)},w=async e=>{let t=n.PRISTINE_ENV.HOME||"/";if(!e)return t;let a=e;for(;;){try{if((await r.default.stat(a)).isDirectory())return a}catch{}let e=i.default.dirname(a);if(e===a)return t;a=e}},x=async e=>{try{return await c("tmux",["-L",m,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},S=async()=>{},_=async()=>{await S();let e=await f();e.length>0&&e.forEach(e=>{p.debug(`existing tmux session found: ${e}`)})},v=async e=>{if(u)try{return await r.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await c("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),r=t.split("\n").find(e=>e.startsWith("n/"));return r?r.slice(1):null}catch{return null}},L=async e=>{let t=await E(e);if(t){let e=await v(t);if(e)return e}try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},E=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),r=parseInt(t.trim(),10);return Number.isNaN(r)?null:r}catch{return null}},I=async()=>{try{await c("tmux",["-L",m,"source-file",d],{timeout:5e3})}catch{}},P=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},N=async()=>{try{let{stdout:e}=await c("tmux",["-L",m,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let r of e.trim().split("\n")){if(!r)continue;let[e,a,i,s,n]=r.split(" ");if(e&&a){let r=parseInt(s,10),l=parseInt(n,10);t.set(e,{command:a,path:i||"",pid:Number.isNaN(r)?0:r,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},b=new Set(["bash","zsh","fish","sh","dash"]),R=async e=>{let t=await P(e);return t?{isSafe:b.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},$=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},M=async e=>{await c("tmux",["-L",m,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},T=async(e,t)=>{await M(e),await c("tmux",["-L",m,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},k=async(e,t)=>{await M(e),await c("tmux",["-L",m,"send-keys","-t",e,t],{timeout:5e3})},C=async(e,t)=>{await M(e),await c("tmux",["-L",m,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await c("tmux",["-L",m,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await c("tmux",["-L",m,"send-keys","-t",e,"Enter"],{timeout:5e3})},A=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[r,a,i,s,n,l]=t.trim().split(" ");return{cwd:r||null,command:a||null,pid:i&&parseInt(i,10)||null,width:s&&parseInt(s,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},j=new Set(["node","python","python3","ruby","perl","deno","bun"]),q=async()=>{try{await c("tmux",["-L",m,"kill-server"],{timeout:5e3}),p.debug("tmux server killed")}catch{}},H=async e=>{try{let{stdout:t}=await c("tmux",["-L",m,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},O=async(e,t)=>{try{let{stdout:r}=await c("tmux",["-L",m,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return r}catch{return null}},D=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let a of(await r.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(a,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await c("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},G=async e=>{let t=[],r=[e];for(;r.length>0;){let e=await D(r);if(0===e.length)break;t.push(...e),r=e}return t},U=async e=>{try{let t=new Set(e),{stdout:r}=await c("ss",["-tlnp"],{timeout:5e3}),a=new Set;for(let e of r.split("\n")){let r=e.match(/pid=(\d+)/g);if(!r||!r.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let i=e.match(/:(\d+)\s/);i&&a.add(parseInt(i[1],10))}return[...a].sort((e,t)=>e-t)}catch{return[]}},F=async e=>{let t=await G(e);if(0===t.length)return[];if(u)return U(t);try{let{stdout:e}=await c("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),r=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&r.add(parseInt(e[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},K=async e=>{let t=await E(e);if(!t)return null;try{let{stdout:e}=await c("pgrep",["-n","-P",String(t)],{timeout:5e3}),r=e.trim();if(!r)return null;let{stdout:a}=await c("ps",["-o","args=","-p",r],{timeout:5e3}),s=a.trim();if(!s)return null;let n=s.split(/\s+/);if(0===n.length)return s;if(n[0]=i.default.basename(n[0]),j.has(n[0])&&n.length>1){let e=i.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,b,"applyConfig",0,I,"capturePaneContent",0,H,"capturePaneContentWithHistory",0,O,"checkTerminalProcess",0,R,"createSession",0,h,"defaultSessionName",0,()=>`pt-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}`,"exitCopyMode",0,M,"getAllPanesInfo",0,N,"getLastCommand",0,K,"getListeningPorts",0,F,"getPaneCurrentCommand",0,P,"getPaneDetailInfo",0,A,"getPaneTitle",0,$,"getSessionCwd",0,L,"getSessionPanePid",0,E,"hasSession",0,x,"killServer",0,q,"killSession",0,y,"listSessions",0,f,"resolveExistingDir",0,w,"scanSessions",0,_,"sendBracketedPaste",0,C,"sendKeys",0,T,"sendRawKeys",0,k,"workspaceSessionName",0,(e,t,r)=>`pt-${e}-${t}-${r}`],459015)},240760,e=>{"use strict";var t=e.i(926747),r=e.i(190406),a=e.i(244898),i=e.i(262950),s=e.i(233405),n=e.i(224361),l=e.i(459015);let o=(0,n.promisify)(s.execFile),u=e=>e.split("\x1e").map(e=>e.trim()).filter(Boolean).map(e=>{let[t,r,a,i,s,...n]=e.split("\x1f"),l=r.trim()?r.trim().split(/\s+/):[];return{hash:t,shortHash:t.slice(0,7),parents:l,author:a,email:i,timestamp:1e3*parseInt(s,10),subject:n.join("\x1f"),isMerge:l.length>1}}),p=async(e,t=50,r=0)=>{let a=["-C",e,"log",`-${t}`];r>0&&a.push(`--skip=${r}`),a.push("--format=%H\x1f%P\x1f%an\x1f%ae\x1f%at\x1f%s\x1e");let i=o("git",a,{timeout:5e3,maxBuffer:2097152});if(r>0){let{stdout:e}=await i;return{head:"",branch:"",upstreamHash:null,commits:u(e)}}let[s,n,l,p]=await Promise.all([i,o("git",["-C",e,"rev-parse","HEAD"],{timeout:5e3}).then(e=>e.stdout.trim()).catch(()=>""),o("git",["-C",e,"rev-parse","--abbrev-ref","HEAD"],{timeout:5e3}).then(e=>e.stdout.trim()).catch(()=>""),o("git",["-C",e,"rev-parse","@{upstream}"],{timeout:5e3}).then(e=>e.stdout.trim()).catch(()=>null)]);return{head:n,branch:l,upstreamHash:p,commits:u(s.stdout)}};var c=e.i(25146);let m=(0,n.promisify)(s.execFile),d=(0,c.createLogger)("git-log"),f=async(e,t)=>{if("GET"!==e.method)return t.setHeader("Allow","GET"),t.status(405).json({error:"Method not allowed"});let r=e.query.session,a=parseInt(e.query.limit,10),i=Math.min(Number.isFinite(a)&&a>0?a:50,500),s=parseInt(e.query.skip,10),n=Number.isFinite(s)&&s>0?s:0;if(!r)return t.status(400).json({error:"session parameter required"});if(!await (0,l.hasSession)(r))return t.status(404).json({error:"Session not found"});let o=await (0,l.getSessionCwd)(r);if(!o)return t.status(500).json({error:"Failed to get CWD"});try{await m("git",["-C",o,"rev-parse","--is-inside-work-tree"],{timeout:5e3})}catch{return t.status(200).json({isGitRepo:!1,commits:[]})}try{let e=await p(o,i,n);return t.status(200).json({isGitRepo:!0,...e})}catch(e){return d.error(`git log failed: ${e instanceof Error?e.message:e}`),t.status(500).json({error:"Failed to get commit log"})}};e.s(["default",0,f],819069);var h=e.i(819069),g=e.i(7031),y=e.i(181927),w=e.i(846432);let x=(0,i.hoist)(h,"default"),S=(0,i.hoist)(h,"config"),_=new a.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/layout/git-log",pathname:"/api/layout/git-log",bundlePath:"",filename:""},userland:h,distDir:".next",relativeProjectDir:""});async function v(e,r,a){a.requestMeta&&(0,w.setRequestMeta)(e,a.requestMeta),_.isDev&&(0,w.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let i="/api/layout/git-log";i=i.replace(/\/index$/,"")||"/";let s=await _.prepare(e,r,{srcPage:i});if(!s){r.statusCode=400,r.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve());return}let{query:n,params:l,prerenderManifest:o,routerServerContext:u}=s;try{let t,a=e.method||"GET",s=(0,g.getTracer)(),p=s.getActiveScopeSpan(),c=!!(null==u?void 0:u.isWrappedByNextServer),m=_.instrumentationOnRequestError.bind(_),d=async p=>_.render(e,r,{query:{...n,...l},params:l,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:_.isDev,page:"/api/layout/git-log",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>m(e,...t)}).finally(()=>{if(!p)return;p.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=s.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==y.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${a} ${n}`;p.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),p.updateName(e),t&&t!==p&&(t.setAttribute("http.route",n),t.updateName(e))}else p.updateName(`${a} ${i}`)});c&&p?await d(p):(t=s.getActiveScopeSpan(),await s.withPropagatedContext(e.headers,()=>s.trace(y.BaseServerSpan.handleRequest,{spanName:`${a} ${i}`,kind:g.SpanKind.SERVER,attributes:{"http.method":a,"http.target":e.url}},d),void 0,!c))}catch(e){if(_.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==a.waitUntil||a.waitUntil.call(a,Promise.resolve())}}e.s(["config",0,S,"default",0,x,"handler",0,v],240760)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0bo-su1._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,r)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,r=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(r)),e.s(["PRISTINE_ENV",0,r],965898);let s=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),a=["LC_"],i=e=>s.has(e)||a.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,s]of Object.entries(r))void 0!==s&&i(t)&&(e[t]=s);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>r.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},25146,e=>{"use strict";var t=e.i(130146),r=e.i(814747),s=e.i(446786);let a=r.default.join(s.default.homedir(),".purplemux","logs"),i=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let r of e.split(",")){let[e,s]=r.split("=").map(e=>e.trim());e&&s&&(t[e]=s)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[i,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:r.default.join(a,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??i,t}])},44014,e=>{"use strict";let t,r;var s=e.i(666680);e.s(["nanoid",0,function(e=21){var a;a=e|=0,!t||t.length<a?(t=Buffer.allocUnsafe(128*a),s.webcrypto.getRandomValues(t),r=0):r+a>t.length&&(s.webcrypto.getRandomValues(t),r=0),r+=a;let i="";for(let s=r-e;s<r;s++)i+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[s]];return i}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),r=e.i(924868),s=e.i(224361),a=e.i(814747),i=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let d=(0,o.createLogger)("terminal"),p=(0,s.promisify)(t.execFile),c="purple",m=a.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),h=async()=>{try{let{stdout:e}=await p("tmux",["-L",c,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},f=async(e,t,r,s)=>{let a=(0,l.buildShellLaunchCommand)();await p("tmux",["-u","-L",c,"-f",m,"new-session","-d","-s",e,"-x",String(t),"-y",String(r),a],{timeout:5e3,cwd:s||n.PRISTINE_ENV.HOME||"/"}),await k(),d.debug(`tmux session created: ${e} (cols: ${t}, rows: ${r})`)},w=e=>new Promise(t=>setTimeout(t,e)),y=async e=>{if(!await g(e))return;d.debug(`killSession start: ${e}`);let t=await L(e);if(t)try{d.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await p("tmux",["-L",c,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await g(e))return void d.debug(`killSession done (SIGTERM): ${e}`);await w(200)}if(d.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{d.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await p("tmux",["-L",c,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await g(e))return void d.debug(`killSession done (SIGKILL): ${e}`);await w(200)}d.warn(`tmux session still alive after kill: ${e}`)},g=async e=>{try{return await p("tmux",["-L",c,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},S=async()=>{},x=async()=>{await S();let e=await h();e.length>0&&e.forEach(e=>{d.debug(`existing tmux session found: ${e}`)})},_=async e=>{if(u)try{return await r.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await p("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),r=t.split("\n").find(e=>e.startsWith("n/"));return r?r.slice(1):null}catch{return null}},v=async e=>{let t=await L(e);if(t){let e=await _(t);if(e)return e}try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},L=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),r=parseInt(t.trim(),10);return Number.isNaN(r)?null:r}catch{return null}},k=async()=>{try{await p("tmux",["-L",c,"source-file",m],{timeout:5e3})}catch{}},b=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},E=async()=>{try{let{stdout:e}=await p("tmux",["-L",c,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let r of e.trim().split("\n")){if(!r)continue;let[e,s,a,i,n]=r.split(" ");if(e&&s){let r=parseInt(i,10),l=parseInt(n,10);t.set(e,{command:s,path:a||"",pid:Number.isNaN(r)?0:r,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},P=new Set(["bash","zsh","fish","sh","dash"]),I=async e=>{let t=await b(e);return t?{isSafe:P.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},N=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},$=async e=>{await p("tmux",["-L",c,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},R=async(e,t)=>{await $(e),await p("tmux",["-L",c,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},T=async(e,t)=>{await $(e),await p("tmux",["-L",c,"send-keys","-t",e,t],{timeout:5e3})},M=async(e,t)=>{await $(e),await p("tmux",["-L",c,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await p("tmux",["-L",c,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await p("tmux",["-L",c,"send-keys","-t",e,"Enter"],{timeout:5e3})},j=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[r,s,a,i,n,l]=t.trim().split(" ");return{cwd:r||null,command:s||null,pid:a&&parseInt(a,10)||null,width:i&&parseInt(i,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},A=new Set(["node","python","python3","ruby","perl","deno","bun"]),C=async()=>{try{await p("tmux",["-L",c,"kill-server"],{timeout:5e3}),d.debug("tmux server killed")}catch{}},O=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},q=async(e,t)=>{try{let{stdout:r}=await p("tmux",["-L",c,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return r}catch{return null}},D=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let s of(await r.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(s,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await p("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},H=async e=>{let t=[],r=[e];for(;r.length>0;){let e=await D(r);if(0===e.length)break;t.push(...e),r=e}return t},U=async e=>{try{let t=new Set(e),{stdout:r}=await p("ss",["-tlnp"],{timeout:5e3}),s=new Set;for(let e of r.split("\n")){let r=e.match(/pid=(\d+)/g);if(!r||!r.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let a=e.match(/:(\d+)\s/);a&&s.add(parseInt(a[1],10))}return[...s].sort((e,t)=>e-t)}catch{return[]}},G=async e=>{let t=await H(e);if(0===t.length)return[];if(u)return U(t);try{let{stdout:e}=await p("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),r=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&r.add(parseInt(e[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},K=async e=>{let t=await L(e);if(!t)return null;try{let{stdout:e}=await p("pgrep",["-n","-P",String(t)],{timeout:5e3}),r=e.trim();if(!r)return null;let{stdout:s}=await p("ps",["-o","args=","-p",r],{timeout:5e3}),i=s.trim();if(!i)return null;let n=i.split(/\s+/);if(0===n.length)return i;if(n[0]=a.default.basename(n[0]),A.has(n[0])&&n.length>1){let e=a.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,P,"applyConfig",0,k,"capturePaneContent",0,O,"capturePaneContentWithHistory",0,q,"checkTerminalProcess",0,I,"createSession",0,f,"defaultSessionName",0,()=>`pt-${(0,i.nanoid)(6)}-${(0,i.nanoid)(6)}-${(0,i.nanoid)(6)}`,"exitCopyMode",0,$,"getAllPanesInfo",0,E,"getLastCommand",0,K,"getListeningPorts",0,G,"getPaneCurrentCommand",0,b,"getPaneDetailInfo",0,j,"getPaneTitle",0,N,"getSessionCwd",0,v,"getSessionPanePid",0,L,"hasSession",0,g,"killServer",0,C,"killSession",0,y,"listSessions",0,h,"scanSessions",0,x,"sendBracketedPaste",0,M,"sendKeys",0,R,"sendRawKeys",0,T,"workspaceSessionName",0,(e,t,r)=>`pt-${e}-${t}-${r}`],459015)},426427,e=>{"use strict";var t=e.i(926747),r=e.i(190406),s=e.i(244898),a=e.i(262950),i=e.i(233405),n=e.i(224361),l=e.i(459015),o=e.i(25146);let u=(0,n.promisify)(i.execFile),d=(0,o.createLogger)("git-sync"),p=async(e,t)=>{try{let{stdout:r,stderr:s}=await u("git",["-C",e,...t],{timeout:3e4,maxBuffer:2097152});return{ok:!0,stdout:r,stderr:s,killed:!1}}catch(e){return{ok:!1,stdout:e.stdout??"",stderr:e.stderr??e.message??"",killed:!!e.killed}}},c=e=>{if(e.killed)return"timeout";let t=(e.stderr+"\n"+e.stdout).toLowerCase();return t.includes("no upstream")||t.includes("no tracking information")?"no-upstream":t.includes("authentication failed")||t.includes("permission denied")||t.includes("could not read from remote")||t.includes("invalid credentials")?"auth":t.includes("would be overwritten by merge")||t.includes("would be overwritten by checkout")||t.includes("commit your changes or stash them")?"local-changes":t.includes("divergent")||t.includes("not possible to fast-forward")||t.includes("non-fast-forward")?e.stderr.toLowerCase().includes("push")?"rejected":"diverged":t.includes("rejected")||t.includes("updates were rejected")?"rejected":"unknown"},m=async e=>{let t=await p(e,["rev-list","--left-right","--count","HEAD...@{upstream}"]);if(!t.ok)return{ahead:0,behind:0};let r=t.stdout.trim().split(/\s+/);return{ahead:parseInt(r[0],10)||0,behind:parseInt(r[1],10)||0}},h=e=>({name:e,ok:!1,skipped:!0,stdout:"",stderr:""}),f=async(e,t)=>{if("POST"!==e.method)return t.setHeader("Allow","POST"),t.status(405).json({error:"Method not allowed"});let r=e.query.session;if(!r)return t.status(400).json({error:"session parameter required"});if(!await (0,l.hasSession)(r))return t.status(404).json({error:"Session not found"});let s=await (0,l.getSessionCwd)(r);if(!s)return t.status(500).json({error:"Failed to get CWD"});if(!(await p(s,["rev-parse","--is-inside-work-tree"])).ok)return t.status(400).json({error:"Not a git repository"});let a=await p(s,["rev-parse","--abbrev-ref","--symbolic-full-name","@{upstream}"]),i=a.ok?a.stdout.trim():null;if(!i){let e=await p(s,["rev-parse","--abbrev-ref","HEAD"]),r=e.ok?e.stdout.trim():"HEAD";return t.status(200).json({ok:!1,steps:[],summary:{pulled:0,pushed:0},upstream:null,branch:r,errorKind:"no-upstream"})}let n=[],o=await p(s,["fetch","--prune"]);if(n.push({name:"fetch",ok:o.ok,skipped:!1,stdout:o.stdout,stderr:o.stderr}),!o.ok)return d.warn(`fetch failed: ${o.stderr}`),n.push(h("pull")),n.push(h("push")),t.status(200).json({ok:!1,steps:n,summary:{pulled:0,pushed:0},upstream:i,errorKind:c(o)});let{behind:u}=await m(s),f=0;if(u>0){let e=await p(s,["pull","--ff-only"]);if(n.push({name:"pull",ok:e.ok,skipped:!1,stdout:e.stdout,stderr:e.stderr}),!e.ok)return d.warn(`pull failed: ${e.stderr}`),n.push(h("push")),t.status(200).json({ok:!1,steps:n,summary:{pulled:0,pushed:0},upstream:i,errorKind:c(e)});f=u}else n.push(h("pull"));let{ahead:w}=await m(s),y=0;if(w>0){let e=await p(s,["push"]);if(n.push({name:"push",ok:e.ok,skipped:!1,stdout:e.stdout,stderr:e.stderr}),!e.ok)return d.warn(`push failed: ${e.stderr}`),t.status(200).json({ok:!1,steps:n,summary:{pulled:f,pushed:0},upstream:i,errorKind:c(e)});y=w}else n.push(h("push"));return t.status(200).json({ok:!0,steps:n,summary:{pulled:f,pushed:y},upstream:i})};e.s(["default",0,f],362781);var w=e.i(362781),y=e.i(7031),g=e.i(181927),S=e.i(846432);let x=(0,a.hoist)(w,"default"),_=(0,a.hoist)(w,"config"),v=new s.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/git/sync",pathname:"/api/git/sync",bundlePath:"",filename:""},userland:w,distDir:".next",relativeProjectDir:""});async function L(e,r,s){s.requestMeta&&(0,S.setRequestMeta)(e,s.requestMeta),v.isDev&&(0,S.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/git/sync";a=a.replace(/\/index$/,"")||"/";let i=await v.prepare(e,r,{srcPage:a});if(!i){r.statusCode=400,r.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve());return}let{query:n,params:l,prerenderManifest:o,routerServerContext:u}=i;try{let t,s=e.method||"GET",i=(0,y.getTracer)(),d=i.getActiveScopeSpan(),p=!!(null==u?void 0:u.isWrappedByNextServer),c=v.instrumentationOnRequestError.bind(v),m=async d=>v.render(e,r,{query:{...n,...l},params:l,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:v.isDev,page:"/api/git/sync",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>c(e,...t)}).finally(()=>{if(!d)return;d.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=i.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==g.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${s} ${n}`;d.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),d.updateName(e),t&&t!==d&&(t.setAttribute("http.route",n),t.updateName(e))}else d.updateName(`${s} ${a}`)});p&&d?await m(d):(t=i.getActiveScopeSpan(),await i.withPropagatedContext(e.headers,()=>i.trace(g.BaseServerSpan.handleRequest,{spanName:`${s} ${a}`,kind:y.SpanKind.SERVER,attributes:{"http.method":s,"http.target":e.url}},m),void 0,!p))}catch(e){if(v.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==s.waitUntil||s.waitUntil.call(s,Promise.resolve())}}e.s(["config",0,_,"default",0,x,"handler",0,L],426427)}];
1
+ module.exports=[270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,r)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,r=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(r)),e.s(["PRISTINE_ENV",0,r],965898);let s=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),a=["LC_"],i=e=>s.has(e)||a.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,s]of Object.entries(r))void 0!==s&&i(t)&&(e[t]=s);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>r.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},25146,e=>{"use strict";var t=e.i(130146),r=e.i(814747),s=e.i(446786);let a=r.default.join(s.default.homedir(),".purplemux","logs"),i=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let r of e.split(",")){let[e,s]=r.split("=").map(e=>e.trim());e&&s&&(t[e]=s)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[i,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:r.default.join(a,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??i,t}])},44014,e=>{"use strict";let t,r;var s=e.i(666680);e.s(["nanoid",0,function(e=21){var a;a=e|=0,!t||t.length<a?(t=Buffer.allocUnsafe(128*a),s.webcrypto.getRandomValues(t),r=0):r+a>t.length&&(s.webcrypto.getRandomValues(t),r=0),r+=a;let i="";for(let s=r-e;s<r;s++)i+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[s]];return i}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),r=e.i(924868),s=e.i(224361),a=e.i(814747),i=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let d=(0,o.createLogger)("terminal"),p=(0,s.promisify)(t.execFile),c="purple",m=a.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),f=async()=>{try{let{stdout:e}=await p("tmux",["-L",c,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},h=async(e,t,r,s)=>{let a=(0,l.buildShellLaunchCommand)();await p("tmux",["-u","-L",c,"-f",m,"new-session","-d","-s",e,"-x",String(t),"-y",String(r),a],{timeout:5e3,cwd:s||n.PRISTINE_ENV.HOME||"/"}),await E(),d.debug(`tmux session created: ${e} (cols: ${t}, rows: ${r})`)},w=e=>new Promise(t=>setTimeout(t,e)),y=async e=>{if(!await S(e))return;d.debug(`killSession start: ${e}`);let t=await k(e);if(t)try{d.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await p("tmux",["-L",c,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await S(e))return void d.debug(`killSession done (SIGTERM): ${e}`);await w(200)}if(d.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{d.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await p("tmux",["-L",c,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await S(e))return void d.debug(`killSession done (SIGKILL): ${e}`);await w(200)}d.warn(`tmux session still alive after kill: ${e}`)},g=async e=>{let t=n.PRISTINE_ENV.HOME||"/";if(!e)return t;let s=e;for(;;){try{if((await r.default.stat(s)).isDirectory())return s}catch{}let e=a.default.dirname(s);if(e===s)return t;s=e}},S=async e=>{try{return await p("tmux",["-L",c,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},x=async()=>{},_=async()=>{await x();let e=await f();e.length>0&&e.forEach(e=>{d.debug(`existing tmux session found: ${e}`)})},v=async e=>{if(u)try{return await r.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await p("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),r=t.split("\n").find(e=>e.startsWith("n/"));return r?r.slice(1):null}catch{return null}},L=async e=>{let t=await k(e);if(t){let e=await v(t);if(e)return e}try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},k=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),r=parseInt(t.trim(),10);return Number.isNaN(r)?null:r}catch{return null}},E=async()=>{try{await p("tmux",["-L",c,"source-file",m],{timeout:5e3})}catch{}},b=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},I=async()=>{try{let{stdout:e}=await p("tmux",["-L",c,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let r of e.trim().split("\n")){if(!r)continue;let[e,s,a,i,n]=r.split(" ");if(e&&s){let r=parseInt(i,10),l=parseInt(n,10);t.set(e,{command:s,path:a||"",pid:Number.isNaN(r)?0:r,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},P=new Set(["bash","zsh","fish","sh","dash"]),N=async e=>{let t=await b(e);return t?{isSafe:P.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},$=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},R=async e=>{await p("tmux",["-L",c,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},T=async(e,t)=>{await R(e),await p("tmux",["-L",c,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},M=async(e,t)=>{await R(e),await p("tmux",["-L",c,"send-keys","-t",e,t],{timeout:5e3})},j=async(e,t)=>{await R(e),await p("tmux",["-L",c,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await p("tmux",["-L",c,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await p("tmux",["-L",c,"send-keys","-t",e,"Enter"],{timeout:5e3})},A=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[r,s,a,i,n,l]=t.trim().split(" ");return{cwd:r||null,command:s||null,pid:a&&parseInt(a,10)||null,width:i&&parseInt(i,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},C=new Set(["node","python","python3","ruby","perl","deno","bun"]),O=async()=>{try{await p("tmux",["-L",c,"kill-server"],{timeout:5e3}),d.debug("tmux server killed")}catch{}},q=async e=>{try{let{stdout:t}=await p("tmux",["-L",c,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},D=async(e,t)=>{try{let{stdout:r}=await p("tmux",["-L",c,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return r}catch{return null}},H=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let s of(await r.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(s,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await p("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},U=async e=>{let t=[],r=[e];for(;r.length>0;){let e=await H(r);if(0===e.length)break;t.push(...e),r=e}return t},G=async e=>{try{let t=new Set(e),{stdout:r}=await p("ss",["-tlnp"],{timeout:5e3}),s=new Set;for(let e of r.split("\n")){let r=e.match(/pid=(\d+)/g);if(!r||!r.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let a=e.match(/:(\d+)\s/);a&&s.add(parseInt(a[1],10))}return[...s].sort((e,t)=>e-t)}catch{return[]}},K=async e=>{let t=await U(e);if(0===t.length)return[];if(u)return G(t);try{let{stdout:e}=await p("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),r=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&r.add(parseInt(e[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},F=async e=>{let t=await k(e);if(!t)return null;try{let{stdout:e}=await p("pgrep",["-n","-P",String(t)],{timeout:5e3}),r=e.trim();if(!r)return null;let{stdout:s}=await p("ps",["-o","args=","-p",r],{timeout:5e3}),i=s.trim();if(!i)return null;let n=i.split(/\s+/);if(0===n.length)return i;if(n[0]=a.default.basename(n[0]),C.has(n[0])&&n.length>1){let e=a.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,P,"applyConfig",0,E,"capturePaneContent",0,q,"capturePaneContentWithHistory",0,D,"checkTerminalProcess",0,N,"createSession",0,h,"defaultSessionName",0,()=>`pt-${(0,i.nanoid)(6)}-${(0,i.nanoid)(6)}-${(0,i.nanoid)(6)}`,"exitCopyMode",0,R,"getAllPanesInfo",0,I,"getLastCommand",0,F,"getListeningPorts",0,K,"getPaneCurrentCommand",0,b,"getPaneDetailInfo",0,A,"getPaneTitle",0,$,"getSessionCwd",0,L,"getSessionPanePid",0,k,"hasSession",0,S,"killServer",0,O,"killSession",0,y,"listSessions",0,f,"resolveExistingDir",0,g,"scanSessions",0,_,"sendBracketedPaste",0,j,"sendKeys",0,T,"sendRawKeys",0,M,"workspaceSessionName",0,(e,t,r)=>`pt-${e}-${t}-${r}`],459015)},426427,e=>{"use strict";var t=e.i(926747),r=e.i(190406),s=e.i(244898),a=e.i(262950),i=e.i(233405),n=e.i(224361),l=e.i(459015),o=e.i(25146);let u=(0,n.promisify)(i.execFile),d=(0,o.createLogger)("git-sync"),p=async(e,t)=>{try{let{stdout:r,stderr:s}=await u("git",["-C",e,...t],{timeout:3e4,maxBuffer:2097152});return{ok:!0,stdout:r,stderr:s,killed:!1}}catch(e){return{ok:!1,stdout:e.stdout??"",stderr:e.stderr??e.message??"",killed:!!e.killed}}},c=e=>{if(e.killed)return"timeout";let t=(e.stderr+"\n"+e.stdout).toLowerCase();return t.includes("no upstream")||t.includes("no tracking information")?"no-upstream":t.includes("authentication failed")||t.includes("permission denied")||t.includes("could not read from remote")||t.includes("invalid credentials")?"auth":t.includes("would be overwritten by merge")||t.includes("would be overwritten by checkout")||t.includes("commit your changes or stash them")?"local-changes":t.includes("divergent")||t.includes("not possible to fast-forward")||t.includes("non-fast-forward")?e.stderr.toLowerCase().includes("push")?"rejected":"diverged":t.includes("rejected")||t.includes("updates were rejected")?"rejected":"unknown"},m=async e=>{let t=await p(e,["rev-list","--left-right","--count","HEAD...@{upstream}"]);if(!t.ok)return{ahead:0,behind:0};let r=t.stdout.trim().split(/\s+/);return{ahead:parseInt(r[0],10)||0,behind:parseInt(r[1],10)||0}},f=e=>({name:e,ok:!1,skipped:!0,stdout:"",stderr:""}),h=async(e,t)=>{if("POST"!==e.method)return t.setHeader("Allow","POST"),t.status(405).json({error:"Method not allowed"});let r=e.query.session;if(!r)return t.status(400).json({error:"session parameter required"});if(!await (0,l.hasSession)(r))return t.status(404).json({error:"Session not found"});let s=await (0,l.getSessionCwd)(r);if(!s)return t.status(500).json({error:"Failed to get CWD"});if(!(await p(s,["rev-parse","--is-inside-work-tree"])).ok)return t.status(400).json({error:"Not a git repository"});let a=await p(s,["rev-parse","--abbrev-ref","--symbolic-full-name","@{upstream}"]),i=a.ok?a.stdout.trim():null;if(!i){let e=await p(s,["rev-parse","--abbrev-ref","HEAD"]),r=e.ok?e.stdout.trim():"HEAD";return t.status(200).json({ok:!1,steps:[],summary:{pulled:0,pushed:0},upstream:null,branch:r,errorKind:"no-upstream"})}let n=[],o=await p(s,["fetch","--prune"]);if(n.push({name:"fetch",ok:o.ok,skipped:!1,stdout:o.stdout,stderr:o.stderr}),!o.ok)return d.warn(`fetch failed: ${o.stderr}`),n.push(f("pull")),n.push(f("push")),t.status(200).json({ok:!1,steps:n,summary:{pulled:0,pushed:0},upstream:i,errorKind:c(o)});let{behind:u}=await m(s),h=0;if(u>0){let e=await p(s,["pull","--ff-only"]);if(n.push({name:"pull",ok:e.ok,skipped:!1,stdout:e.stdout,stderr:e.stderr}),!e.ok)return d.warn(`pull failed: ${e.stderr}`),n.push(f("push")),t.status(200).json({ok:!1,steps:n,summary:{pulled:0,pushed:0},upstream:i,errorKind:c(e)});h=u}else n.push(f("pull"));let{ahead:w}=await m(s),y=0;if(w>0){let e=await p(s,["push"]);if(n.push({name:"push",ok:e.ok,skipped:!1,stdout:e.stdout,stderr:e.stderr}),!e.ok)return d.warn(`push failed: ${e.stderr}`),t.status(200).json({ok:!1,steps:n,summary:{pulled:h,pushed:0},upstream:i,errorKind:c(e)});y=w}else n.push(f("push"));return t.status(200).json({ok:!0,steps:n,summary:{pulled:h,pushed:y},upstream:i})};e.s(["default",0,h],362781);var w=e.i(362781),y=e.i(7031),g=e.i(181927),S=e.i(846432);let x=(0,a.hoist)(w,"default"),_=(0,a.hoist)(w,"config"),v=new s.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/git/sync",pathname:"/api/git/sync",bundlePath:"",filename:""},userland:w,distDir:".next",relativeProjectDir:""});async function L(e,r,s){s.requestMeta&&(0,S.setRequestMeta)(e,s.requestMeta),v.isDev&&(0,S.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/git/sync";a=a.replace(/\/index$/,"")||"/";let i=await v.prepare(e,r,{srcPage:a});if(!i){r.statusCode=400,r.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve());return}let{query:n,params:l,prerenderManifest:o,routerServerContext:u}=i;try{let t,s=e.method||"GET",i=(0,y.getTracer)(),d=i.getActiveScopeSpan(),p=!!(null==u?void 0:u.isWrappedByNextServer),c=v.instrumentationOnRequestError.bind(v),m=async d=>v.render(e,r,{query:{...n,...l},params:l,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:v.isDev,page:"/api/git/sync",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>c(e,...t)}).finally(()=>{if(!d)return;d.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=i.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==g.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${s} ${n}`;d.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),d.updateName(e),t&&t!==d&&(t.setAttribute("http.route",n),t.updateName(e))}else d.updateName(`${s} ${a}`)});p&&d?await m(d):(t=i.getActiveScopeSpan(),await i.withPropagatedContext(e.headers,()=>i.trace(g.BaseServerSpan.handleRequest,{spanName:`${s} ${a}`,kind:y.SpanKind.SERVER,attributes:{"http.method":s,"http.target":e.url}},m),void 0,!p))}catch(e){if(v.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==s.waitUntil||s.waitUntil.call(s,Promise.resolve())}}e.s(["config",0,_,"default",0,x,"handler",0,L],426427)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0c-bb5d._.js.map
@@ -0,0 +1,52 @@
1
+ module.exports=[688947,(e,t,a)=>{t.exports=e.x("stream",()=>require("stream"))},406461,(e,t,a)=>{t.exports=e.x("zlib",()=>require("zlib"))},254799,(e,t,a)=>{t.exports=e.x("crypto",()=>require("crypto"))},524836,(e,t,a)=>{t.exports=e.x("https",()=>require("https"))},921517,(e,t,a)=>{t.exports=e.x("http",()=>require("http"))},504446,(e,t,a)=>{t.exports=e.x("net",()=>require("net"))},755004,(e,t,a)=>{t.exports=e.x("tls",()=>require("tls"))},792509,(e,t,a)=>{t.exports=e.x("url",()=>require("url"))},500874,(e,t,a)=>{t.exports=e.x("buffer",()=>require("buffer"))},427699,(e,t,a)=>{t.exports=e.x("events",()=>require("events"))},270406,(e,t,a)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,a)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,a)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,a)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,a)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,a)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,a)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,a)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},25146,e=>{"use strict";var t=e.i(130146),a=e.i(814747),r=e.i(446786);let i=a.default.join(r.default.homedir(),".purplemux","logs"),s=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let a of e.split(",")){let[e,r]=a.split("=").map(e=>e.trim());e&&r&&(t[e]=r)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[s,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:a.default.join(i,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??s,t}])},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,a=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(a)),e.s(["PRISTINE_ENV",0,a],965898);let r=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),i=["LC_"],s=e=>r.has(e)||i.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,r]of Object.entries(a))void 0!==r&&s(t)&&(e[t]=r);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>a.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},44014,e=>{"use strict";let t,a;var r=e.i(666680);e.s(["nanoid",0,function(e=21){var i;i=e|=0,!t||t.length<i?(t=Buffer.allocUnsafe(128*i),r.webcrypto.getRandomValues(t),a=0):a+i>t.length&&(r.webcrypto.getRandomValues(t),a=0),a+=i;let s="";for(let r=a-e;r<a;r++)s+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[r]];return s}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),a=e.i(924868),r=e.i(224361),i=e.i(814747),s=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let c=(0,o.createLogger)("terminal"),p=(0,r.promisify)(t.execFile),d="purple",m=i.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),w=async()=>{try{let{stdout:e}=await p("tmux",["-L",d,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},f=async(e,t,a,r)=>{let i=(0,l.buildShellLaunchCommand)();await p("tmux",["-u","-L",d,"-f",m,"new-session","-d","-s",e,"-x",String(t),"-y",String(a),i],{timeout:5e3,cwd:r||n.PRISTINE_ENV.HOME||"/"}),await v(),c.debug(`tmux session created: ${e} (cols: ${t}, rows: ${a})`)},y=e=>new Promise(t=>setTimeout(t,e)),h=async e=>{if(!await k(e))return;c.debug(`killSession start: ${e}`);let t=await S(e);if(t)try{c.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await p("tmux",["-L",d,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await k(e))return void c.debug(`killSession done (SIGTERM): ${e}`);await y(200)}if(c.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{c.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await p("tmux",["-L",d,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await k(e))return void c.debug(`killSession done (SIGKILL): ${e}`);await y(200)}c.warn(`tmux session still alive after kill: ${e}`)},g=async e=>{let t=n.PRISTINE_ENV.HOME||"/";if(!e)return t;let r=e;for(;;){try{if((await a.default.stat(r)).isDirectory())return r}catch{}let e=i.default.dirname(r);if(e===r)return t;r=e}},k=async e=>{try{return await p("tmux",["-L",d,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},x=async()=>{},b=async()=>{await x();let e=await w();e.length>0&&e.forEach(e=>{c.debug(`existing tmux session found: ${e}`)})},I=async e=>{if(u)try{return await a.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await p("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),a=t.split("\n").find(e=>e.startsWith("n/"));return a?a.slice(1):null}catch{return null}},L=async e=>{let t=await S(e);if(t){let e=await I(t);if(e)return e}try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},S=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),a=parseInt(t.trim(),10);return Number.isNaN(a)?null:a}catch{return null}},v=async()=>{try{await p("tmux",["-L",d,"source-file",m],{timeout:5e3})}catch{}},_=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},$=async()=>{try{let{stdout:e}=await p("tmux",["-L",d,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let a of e.trim().split("\n")){if(!a)continue;let[e,r,i,s,n]=a.split(" ");if(e&&r){let a=parseInt(s,10),l=parseInt(n,10);t.set(e,{command:r,path:i||"",pid:Number.isNaN(a)?0:a,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},P=new Set(["bash","zsh","fish","sh","dash"]),N=async e=>{let t=await _(e);return t?{isSafe:P.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},T=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},E=async e=>{await p("tmux",["-L",d,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},W=async(e,t)=>{await E(e),await p("tmux",["-L",d,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},C=async(e,t)=>{await E(e),await p("tmux",["-L",d,"send-keys","-t",e,t],{timeout:5e3})},A=async(e,t)=>{await E(e),await p("tmux",["-L",d,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await p("tmux",["-L",d,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await p("tmux",["-L",d,"send-keys","-t",e,"Enter"],{timeout:5e3})},D=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[a,r,i,s,n,l]=t.trim().split(" ");return{cwd:a||null,command:r||null,pid:i&&parseInt(i,10)||null,width:s&&parseInt(s,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},F=new Set(["node","python","python3","ruby","perl","deno","bun"]),M=async()=>{try{await p("tmux",["-L",d,"kill-server"],{timeout:5e3}),c.debug("tmux server killed")}catch{}},O=async e=>{try{let{stdout:t}=await p("tmux",["-L",d,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},j=async(e,t)=>{try{let{stdout:a}=await p("tmux",["-L",d,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return a}catch{return null}},R=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let r of(await a.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(r,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await p("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},G=async e=>{let t=[],a=[e];for(;a.length>0;){let e=await R(a);if(0===e.length)break;t.push(...e),a=e}return t},q=async e=>{try{let t=new Set(e),{stdout:a}=await p("ss",["-tlnp"],{timeout:5e3}),r=new Set;for(let e of a.split("\n")){let a=e.match(/pid=(\d+)/g);if(!a||!a.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let i=e.match(/:(\d+)\s/);i&&r.add(parseInt(i[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},H=async e=>{let t=await G(e);if(0===t.length)return[];if(u)return q(t);try{let{stdout:e}=await p("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),a=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&a.add(parseInt(e[1],10))}return[...a].sort((e,t)=>e-t)}catch{return[]}},U=async e=>{let t=await S(e);if(!t)return null;try{let{stdout:e}=await p("pgrep",["-n","-P",String(t)],{timeout:5e3}),a=e.trim();if(!a)return null;let{stdout:r}=await p("ps",["-o","args=","-p",a],{timeout:5e3}),s=r.trim();if(!s)return null;let n=s.split(/\s+/);if(0===n.length)return s;if(n[0]=i.default.basename(n[0]),F.has(n[0])&&n.length>1){let e=i.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,P,"applyConfig",0,v,"capturePaneContent",0,O,"capturePaneContentWithHistory",0,j,"checkTerminalProcess",0,N,"createSession",0,f,"defaultSessionName",0,()=>`pt-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}`,"exitCopyMode",0,E,"getAllPanesInfo",0,$,"getLastCommand",0,U,"getListeningPorts",0,H,"getPaneCurrentCommand",0,_,"getPaneDetailInfo",0,D,"getPaneTitle",0,T,"getSessionCwd",0,L,"getSessionPanePid",0,S,"hasSession",0,k,"killServer",0,M,"killSession",0,h,"listSessions",0,w,"resolveExistingDir",0,g,"scanSessions",0,b,"sendBracketedPaste",0,A,"sendKeys",0,W,"sendRawKeys",0,C,"workspaceSessionName",0,(e,t,a)=>`pt-${e}-${t}-${a}`],459015)},160874,e=>{"use strict";var t=e.i(924868),a=e.i(814747),r=e.i(25146),i=e.i(825265);(0,r.createLogger)("claude-prompt");let s=e=>a.default.join((0,i.resolveLayoutDir)(e),"claude-prompt.md"),n=async e=>{let r=s(e.id);await t.default.mkdir(a.default.dirname(r),{recursive:!0});let i=`# purplemux context
2
+
3
+ You are running inside a purplemux workspace tab.
4
+
5
+ - **Workspace ID**: \`${e.id}\`
6
+
7
+ Use \`purplemux workspaces\` if you need the workspace name or directories.
8
+
9
+ ## purplemux CLI
10
+
11
+ The \`purplemux\` CLI lets you inspect and control other tabs in this workspace.
12
+ It reads port and token from \`~/.purplemux/{port,cli-token}\` automatically,
13
+ so no environment setup is needed.
14
+
15
+ ### Commands
16
+
17
+ \`\`\`bash
18
+ purplemux workspaces # list all workspaces
19
+ purplemux tab list -w ${e.id} # list tabs in this workspace
20
+ purplemux tab create -w ${e.id} [-n NAME] [-t TYPE] # create a tab (type: terminal | claude-code | web-browser | diff)
21
+ purplemux tab send -w ${e.id} TAB_ID CONTENT... # send input to a tab
22
+ purplemux tab status -w ${e.id} TAB_ID # tab status
23
+ purplemux tab result -w ${e.id} TAB_ID # capture current pane content
24
+ purplemux tab close -w ${e.id} TAB_ID # close a tab
25
+ \`\`\`
26
+
27
+ For the full HTTP API reference (including endpoint paths and payloads),
28
+ run:
29
+
30
+ \`\`\`bash
31
+ purplemux api-guide
32
+ \`\`\`
33
+
34
+ ### When to use
35
+
36
+ - Delegate work to another tab when a task benefits from isolation
37
+ (long-running builds, different project context, parallel exploration).
38
+ - Poll \`status\` and read \`result\` to verify delegated work.
39
+ - Prefer small, scoped tabs over cramming everything into one session.
40
+
41
+ ### Tab type notes
42
+
43
+ - **\`web-browser\` tabs**: Electron webviews, not tmux. The \`alive\` field in
44
+ \`tab list\` / \`tab status\` is always \`false\` for these — that is the normal
45
+ value, not a sign the tab is dead. Do not gate actions on \`alive\`. Use the
46
+ browser-specific HTTP endpoints (\`/browser/url\`, \`/browser/screenshot\`, …;
47
+ see \`purplemux api-guide\`) directly.
48
+ - **\`terminal\` / \`claude-code\` tabs**: run inside tmux, so \`alive\` is a valid
49
+ liveness signal.
50
+ `;try{if(await t.default.readFile(r,"utf-8")===i)return r}catch{}return await t.default.writeFile(r,i,"utf-8"),r};e.s(["getClaudePromptPath",0,s,"writeClaudePromptFile",0,n])},322429,e=>{"use strict";var t=e.i(924868),a=e.i(814747),r=e.i(446786),i=e.i(44014),s=e.i(459015),n=e.i(25146),l=e.i(666126),o=e.i(825265),u=e.i(804767),c=e.i(160874);let p=(0,n.createLogger)("workspace"),d="Workspace ",m=a.default.join(r.default.homedir(),".purplemux"),w=a.default.join(m,"workspaces.json"),f=a.default.join(m,"layout.json"),y=a.default.join(m,"tabs.json"),h=globalThis;h.__purplemuxWorkspaceLock||(h.__purplemuxWorkspaceLock=Promise.resolve());let g=async e=>{let t,a=new Promise(e=>{t=e}),r=h.__purplemuxWorkspaceLock;h.__purplemuxWorkspaceLock=a,await r;try{return await e()}finally{t()}},k=()=>({workspaces:[],groups:[],sidebarCollapsed:!1,sidebarWidth:240,updatedAt:new Date().toISOString()}),x=e=>(e.groups||(e.groups=[]),e.groups),b=async()=>{let e;try{e=await t.default.readFile(w,"utf-8")}catch{return null}try{let t=JSON.parse(e);for(let e of t.workspaces)!e.directories&&e.directory&&(e.directories=[e.directory],delete e.directory),delete e.order;for(let e of(Array.isArray(t.groups)||(t.groups=[]),t.groups))delete e.order;let a=new Set(t.groups.map(e=>e.id));for(let e of t.workspaces)e.groupId&&!a.has(e.groupId)&&(e.groupId=null);return t}catch{p.warn("Failed to parse workspaces.json, starting empty");try{await t.default.copyFile(w,w.replace(/\.json$/,".json.bak"))}catch{}return null}},I=async e=>{let a;a=x(e),e.workspaces=((e,t)=>{let a=new Set(t.map(e=>e.id)),r=new Map,i=[];for(let t of e){let e=t.groupId??null;if(e&&a.has(e)){let a=r.get(e)??[];a.push(t),r.set(e,a)}else i.push(t)}let s=[];for(let e of t){let t=r.get(e.id);t&&s.push(...t)}return s.push(...i),s})(e.workspaces,a);let{workspaces:r,groups:i,activeWorkspaceId:s,sidebarCollapsed:n,sidebarWidth:o}=e,u=JSON.stringify({workspaces:r,groups:i??[],activeWorkspaceId:s,sidebarCollapsed:n,sidebarWidth:o});if(h.__purplemuxWorkspacesContentCache===u)return;e.updatedAt=new Date().toISOString();let c=w+".tmp";try{await t.default.writeFile(c,JSON.stringify(e,null,2),{mode:384}),await t.default.rename(c,w)}catch(e){throw await t.default.unlink(c).catch(()=>{}),e}h.__purplemuxWorkspacesContentCache=u,(0,l.broadcastSync)({type:"workspace"})},L=async()=>{let e=await (0,o.readLayoutFile)(f);if(!e)return null;let a="ws-default";await t.default.mkdir((0,o.resolveLayoutDir)(a),{recursive:!0}),await (0,o.writeLayoutFile)(e,(0,o.resolveLayoutFile)(a));let i={workspaces:[{id:a,name:"default",directories:[r.default.homedir()]}],sidebarCollapsed:!1,sidebarWidth:240,updatedAt:e.updatedAt||new Date().toISOString()};return await I(i),p.info("Phase 4 layout.json → Workspace 'default' migration complete"),i},S=async()=>{try{let e=await t.default.readFile(y,"utf-8"),a=JSON.parse(e);if(!Array.isArray(a.tabs)||0===a.tabs.length)return null;let r=`pane-${(0,i.nanoid)(6)}`,s={root:{type:"pane",id:r,tabs:a.tabs,activeTabId:a.activeTabId??null},activePaneId:r,updatedAt:new Date().toISOString()},n=f+".tmp";try{await t.default.writeFile(n,JSON.stringify(s,null,2),{mode:384}),await t.default.rename(n,f)}catch(e){throw await t.default.unlink(n).catch(()=>{}),e}return p.info("tabs.json → layout.json migration complete"),await L()}catch{return null}},v=async()=>{await t.default.mkdir(a.default.join(m,"workspaces"),{recursive:!0});let e=await b();if(!e&&(await t.default.access(f).then(()=>!0).catch(()=>!1)?e=await L():await t.default.access(y).then(()=>!0).catch(()=>!1)&&(e=await S())),!e){let t=k();await I(t),e=t,p.info("Initial workspaces.json created")}if(0===e.workspaces.length)return;let r=await (0,s.listSessions)();for(let t of e.workspaces){let e=(0,o.resolveLayoutFile)(t.id),a=await (0,o.readLayoutFile)(e);if(!a){p.warn(`Workspace '${t.name}': layout.json corrupted, reset to default pane`),a=await (0,o.createDefaultLayout)(t.id,t.directories[0]),await (0,o.writeLayoutFile)(a,e);continue}let i=(0,u.collectAllTabs)(a.root).map(e=>e.sessionName),s=`pt-${t.id}-`,n=r.filter(e=>i.includes(e)||e.startsWith(s));try{await (0,o.crossCheckLayout)(a,n,t.id,t.directories[0])&&await (0,o.writeLayoutFile)(a,e)}catch(e){p.error(`Workspace '${t.name}': tmux consistency check failed: ${e instanceof Error?e.message:e}`)}}},_=async()=>{let e=await b();return e?{workspaces:e.workspaces,groups:e.groups??[],activeWorkspaceId:e.activeWorkspaceId,sidebarCollapsed:e.sidebarCollapsed,sidebarWidth:e.sidebarWidth}:{workspaces:[],groups:[],sidebarCollapsed:!1,sidebarWidth:220}},$=async()=>{let e=await b();return e?.activeWorkspaceId&&e.workspaces.some(t=>t.id===e.activeWorkspaceId)?e.activeWorkspaceId:e?.workspaces[0]?.id??null},P=async e=>{let t=await b();return t?.workspaces.find(t=>t.id===e)},N=async(e,a,r)=>g(async()=>{let s;try{s=await t.default.stat(e)}catch{throw Error("Directory does not exist")}if(!s.isDirectory())throw Error("Please enter a directory path, not a file");let n=await b()??k(),l=`ws-${(0,i.nanoid)(6)}`,u=a?.trim()||(e=>{let t=0;for(let a of e)if(a.name.startsWith(d)){let e=parseInt(a.name.slice(d.length),10);e>t&&(t=e)}return`${d}${t+1}`})(n.workspaces),m=await (0,o.createDefaultLayout)(l,e,r);await t.default.mkdir((0,o.resolveLayoutDir)(l),{recursive:!0}),await (0,o.writeLayoutFile)(m,(0,o.resolveLayoutFile)(l));let w={id:l,name:u,directories:[e]};return n.workspaces.push(w),await I(n),await (0,c.writeClaudePromptFile)(w),p.debug(`Created: ${l} (${u}, ${e})`),w}),T=async e=>g(async()=>{let t=await b()??k(),a=t.workspaces.findIndex(t=>t.id===e);if(-1===a)return!1;let r=t.workspaces[a],i=await (0,o.readLayoutFile)((0,o.resolveLayoutFile)(e));if(i)for(let e of(0,u.collectAllTabs)(i.root))try{await (0,s.killSession)(e.sessionName)}catch{}try{await (0,o.removeLayoutFile)(e)}catch{}return t.workspaces.splice(a,1),await I(t),p.info(`Deleted: ${e} (${r.name})`),!0}),E=async(e,t)=>g(async()=>{let a=await b();if(!a)return null;let r=a.workspaces.find(t=>t.id===e);return r?(r.name=t,await I(a),await (0,c.writeClaudePromptFile)(r),p.debug(`Renamed: ${e} → "${t}"`),{...r}):null}),W=async e=>g(async()=>{let t=await b()??k();void 0!==e.activeWorkspaceId&&(t.activeWorkspaceId=e.activeWorkspaceId),void 0!==e.sidebarCollapsed&&(t.sidebarCollapsed=e.sidebarCollapsed),void 0!==e.sidebarWidth&&(t.sidebarWidth=e.sidebarWidth),await I(t)}),C=async(e,t)=>g(async()=>{let a=await b();if(!a)return;let r=a.workspaces.find(t=>t.id===e);r&&JSON.stringify(r.directories)!==JSON.stringify(t)&&(r.directories=t,await I(a),await (0,c.writeClaudePromptFile)(r))}),A=async e=>g(async()=>{let t=await b()??k(),a=new Map(t.workspaces.map(e=>[e.id,e])),r=new Set((t.groups??[]).map(e=>e.id)),i=[];for(let t of e){let e=a.get(t.id);if(!e)return!1;void 0!==t.groupId&&(e.groupId=t.groupId&&r.has(t.groupId)?t.groupId:null),i.push(e)}return i.length===t.workspaces.length&&(t.workspaces=i,await I(t),!0)}),D=async e=>g(async()=>{let t=await b()??k(),a=x(t),r=e.trim()||`Group ${a.length+1}`,s={id:`grp-${(0,i.nanoid)(6)}`,name:r,collapsed:!1};return a.push(s),await I(t),p.debug(`Group created: ${s.id} (${s.name})`),s}),F=async(e,t)=>g(async()=>{let a=await b();if(!a)return null;let r=(a.groups??[]).find(t=>t.id===e);if(!r)return null;let i=t.trim();return i?(r.name=i,await I(a),{...r}):r}),M=async(e,t)=>g(async()=>{let a=await b();if(!a)return!1;let r=(a.groups??[]).find(t=>t.id===e);return!!r&&(r.collapsed===t||(r.collapsed=t,await I(a),!0))}),O=async e=>g(async()=>{let t=await b();if(!t)return!1;let a=x(t),r=a.findIndex(t=>t.id===e);if(-1===r)return!1;for(let a of t.workspaces)a.groupId===e&&(a.groupId=null);return a.splice(r,1),await I(t),p.info(`Group ungrouped: ${e}`),!0}),j=async e=>g(async()=>{let t=await b();if(!t)return!1;let a=x(t),r=new Map(a.map(e=>[e.id,e])),i=[];for(let t of e){let e=r.get(t);if(!e)return!1;i.push(e)}return i.length===a.length&&(t.groups=i,await I(t),!0)}),R=async(e,t)=>g(async()=>{let a=await b();if(!a)return!1;let r=a.workspaces.find(t=>t.id===e);if(!r)return!1;let i=new Set((a.groups??[]).map(e=>e.id)),s=t&&i.has(t)?t:null;return(r.groupId??null)===s||(r.groupId=s,await I(a),!0)}),G=async e=>{try{if(!(await t.default.stat(e)).isDirectory())return{valid:!1,error:"Please enter a directory path, not a file"}}catch{return{valid:!1,error:"Directory does not exist"}}return{valid:!0,suggestedName:a.default.basename(e)}};e.s(["createGroup",0,D,"createWorkspace",0,N,"deleteWorkspace",0,T,"getActiveWorkspaceId",0,$,"getWorkspaceById",0,P,"getWorkspaces",0,_,"initWorkspaceStore",0,v,"renameGroup",0,F,"renameWorkspace",0,E,"reorderGroups",0,j,"reorderWorkspaces",0,A,"setGroupCollapsed",0,M,"setWorkspaceGroup",0,R,"ungroupGroup",0,O,"updateActive",0,W,"updateWorkspaceDirectories",0,C,"validateDirectory",0,G],322429)}];
51
+
52
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0dvelfj._.js.map
@@ -0,0 +1,5 @@
1
+ module.exports=[254799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,r)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},666680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},25146,e=>{"use strict";var t=e.i(130146),r=e.i(814747),a=e.i(446786);let i=r.default.join(a.default.homedir(),".purplemux","logs"),s=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let r of e.split(",")){let[e,a]=r.split("=").map(e=>e.trim());e&&a&&(t[e]=a)}return t})(process.env.LOG_LEVELS),l=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[s,...Object.values(n)].reduce((e,t)=>l.indexOf(t)<l.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:r.default.join(i,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??s,t}])},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,r=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(r)),e.s(["PRISTINE_ENV",0,r],965898);let a=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),i=["LC_"],s=e=>a.has(e)||i.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},l=()=>{let e={};for(let[t,a]of Object.entries(r))void 0!==a&&s(t)&&(e[t]=a);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>r.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>l(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(l()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},44014,e=>{"use strict";let t,r;var a=e.i(666680);e.s(["nanoid",0,function(e=21){var i;i=e|=0,!t||t.length<i?(t=Buffer.allocUnsafe(128*i),a.webcrypto.getRandomValues(t),r=0):r+i>t.length&&(a.webcrypto.getRandomValues(t),r=0),r+=i;let s="";for(let a=r-e;a<r;a++)s+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[a]];return s}],44014)},459015,544538,e=>{"use strict";var t=e.i(233405),r=e.i(924868),a=e.i(224361),i=e.i(814747),s=e.i(44014),n=e.i(965898),l=e.i(597789),o=e.i(25146);process.platform;let u="linux"===process.platform;e.s(["isLinux",0,u],544538);let c=(0,o.createLogger)("terminal"),d=(0,a.promisify)(t.execFile),p="purple",m=i.default.join(process.env.__PMUX_APP_DIR_UNPACKED||process.env.__PMUX_APP_DIR||process.cwd(),"src","config","tmux.conf"),f=async()=>{try{let{stdout:e}=await d("tmux",["-L",p,"ls","-F","#{session_name}"],{timeout:5e3});return e.trim().split("\n").map(e=>e.trim()).filter(e=>e.startsWith("pt-"))}catch{return[]}},h=async(e,t,r,a)=>{let i=(0,l.buildShellLaunchCommand)();await d("tmux",["-u","-L",p,"-f",m,"new-session","-d","-s",e,"-x",String(t),"-y",String(r),i],{timeout:5e3,cwd:a||n.PRISTINE_ENV.HOME||"/"}),await b(),c.debug(`tmux session created: ${e} (cols: ${t}, rows: ${r})`)},y=e=>new Promise(t=>setTimeout(t,e)),g=async e=>{if(!await x(e))return;c.debug(`killSession start: ${e}`);let t=await L(e);if(t)try{c.debug(`SIGTERM → process group ${t}: ${e}`),process.kill(-t,"SIGTERM")}catch{}try{await d("tmux",["-L",p,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<5;t++){if(!await x(e))return void c.debug(`killSession done (SIGTERM): ${e}`);await y(200)}if(c.warn(`session survived SIGTERM, escalating to SIGKILL: ${e}`),t)try{c.debug(`SIGKILL → process group ${t}: ${e}`),process.kill(-t,"SIGKILL")}catch{}try{await d("tmux",["-L",p,"kill-session","-t",e],{timeout:5e3})}catch{}for(let t=0;t<3;t++){if(!await x(e))return void c.debug(`killSession done (SIGKILL): ${e}`);await y(200)}c.warn(`tmux session still alive after kill: ${e}`)},w=async e=>{let t=n.PRISTINE_ENV.HOME||"/";if(!e)return t;let a=e;for(;;){try{if((await r.default.stat(a)).isDirectory())return a}catch{}let e=i.default.dirname(a);if(e===a)return t;a=e}},x=async e=>{try{return await d("tmux",["-L",p,"has-session","-t",e],{timeout:5e3}),!0}catch{return!1}},S=async()=>{},v=async()=>{await S();let e=await f();e.length>0&&e.forEach(e=>{c.debug(`existing tmux session found: ${e}`)})},_=async e=>{if(u)try{return await r.default.readlink(`/proc/${e}/cwd`)}catch{return null}try{let{stdout:t}=await d("lsof",["-a","-p",String(e),"-d","cwd","-Fn"],{timeout:5e3}),r=t.split("\n").find(e=>e.startsWith("n/"));return r?r.slice(1):null}catch{return null}},E=async e=>{let t=await L(e);if(t){let e=await _(t);if(e)return e}try{let{stdout:t}=await d("tmux",["-L",p,"display-message","-p","-t",e,"#{pane_current_path}"],{timeout:5e3});return t.trim()||null}catch{return null}},L=async e=>{try{let{stdout:t}=await d("tmux",["-L",p,"display-message","-p","-t",e,"#{pane_pid}"],{timeout:5e3}),r=parseInt(t.trim(),10);return Number.isNaN(r)?null:r}catch{return null}},b=async()=>{try{await d("tmux",["-L",p,"source-file",m],{timeout:5e3})}catch{}},P=async e=>{try{let{stdout:t}=await d("tmux",["-L",p,"list-panes","-t",e,"-F","#{pane_current_command}"],{timeout:5e3});return t.trim()||null}catch{return null}},I=async()=>{try{let{stdout:e}=await d("tmux",["-L",p,"list-panes","-a","-F","#{session_name} #{pane_current_command} #{pane_current_path} #{pane_pid} #{window_activity}"],{timeout:5e3}),t=new Map;for(let r of e.trim().split("\n")){if(!r)continue;let[e,a,i,s,n]=r.split(" ");if(e&&a){let r=parseInt(s,10),l=parseInt(n,10);t.set(e,{command:a,path:i||"",pid:Number.isNaN(r)?0:r,windowActivity:Number.isNaN(l)?0:l})}}return t}catch{return new Map}},N=new Set(["bash","zsh","fish","sh","dash"]),$=async e=>{let t=await P(e);return t?{isSafe:N.has(t),processName:t}:{isSafe:!1,processName:"unknown"}},R=async e=>{try{let{stdout:t}=await d("tmux",["-L",p,"display-message","-p","-t",e,"#{pane_title}"],{timeout:5e3});return t.trim()||null}catch{return null}},T=async e=>{await d("tmux",["-L",p,"copy-mode","-q","-t",e],{timeout:5e3}).catch(()=>{})},M=async(e,t)=>{await T(e),await d("tmux",["-L",p,"send-keys","-t",e,t,"Enter"],{timeout:5e3})},A=async(e,t)=>{await T(e),await d("tmux",["-L",p,"send-keys","-t",e,t],{timeout:5e3})},k=async(e,t)=>{await T(e),await d("tmux",["-L",p,"send-keys","-t",e,"-l",`\x1b[200~${t}\x1b[201~`],{timeout:5e3}),await d("tmux",["-L",p,"send-keys","-t",e,"Enter"],{timeout:5e3}),await new Promise(e=>setTimeout(e,600)),await d("tmux",["-L",p,"send-keys","-t",e,"Enter"],{timeout:5e3})},D=async e=>{try{let{stdout:t}=await d("tmux",["-L",p,"display-message","-p","-t",e,"#{pane_current_path} #{pane_current_command} #{pane_pid} #{pane_width} #{pane_height} #{session_created}"],{timeout:5e3}),[r,a,i,s,n,l]=t.trim().split(" ");return{cwd:r||null,command:a||null,pid:i&&parseInt(i,10)||null,width:s&&parseInt(s,10)||null,height:n&&parseInt(n,10)||null,sessionCreated:l&&parseInt(l,10)||null}}catch{return{cwd:null,command:null,pid:null,width:null,height:null,sessionCreated:null}}},C=new Set(["node","python","python3","ruby","perl","deno","bun"]),H=async()=>{try{await d("tmux",["-L",p,"kill-server"],{timeout:5e3}),c.debug("tmux server killed")}catch{}},q=async e=>{try{let{stdout:t}=await d("tmux",["-L",p,"capture-pane","-p","-t",e],{timeout:5e3});return t}catch{return null}},j=async(e,t)=>{try{let{stdout:r}=await d("tmux",["-L",p,"capture-pane","-p","-S",`-${t}`,"-t",e],{timeout:5e3});return r}catch{return null}},O=async e=>{if(u){let t=[];return await Promise.all(e.map(async e=>{try{for(let a of(await r.default.readFile(`/proc/${e}/task/${e}/children`,"utf-8")).trim().split(/\s+/)){let e=parseInt(a,10);Number.isNaN(e)||t.push(e)}}catch{}})),t}try{let{stdout:t}=await d("pgrep",["-P",e.join(",")],{timeout:5e3});return t.trim().split("\n").map(e=>parseInt(e,10)).filter(e=>!Number.isNaN(e))}catch{return[]}},G=async e=>{let t=[],r=[e];for(;r.length>0;){let e=await O(r);if(0===e.length)break;t.push(...e),r=e}return t},U=async e=>{try{let t=new Set(e),{stdout:r}=await d("ss",["-tlnp"],{timeout:5e3}),a=new Set;for(let e of r.split("\n")){let r=e.match(/pid=(\d+)/g);if(!r||!r.some(e=>t.has(parseInt(e.replace("pid=",""),10))))continue;let i=e.match(/:(\d+)\s/);i&&a.add(parseInt(i[1],10))}return[...a].sort((e,t)=>e-t)}catch{return[]}},F=async e=>{let t=await G(e);if(0===t.length)return[];if(u)return U(t);try{let{stdout:e}=await d("lsof",["-a","-p",t.join(","),"-i","-sTCP:LISTEN","-P","-Fn"],{timeout:5e3}),r=new Set;for(let t of e.split("\n"))if(t.startsWith("n")){let e=t.match(/:(\d+)$/);e&&r.add(parseInt(e[1],10))}return[...r].sort((e,t)=>e-t)}catch{return[]}},K=async e=>{let t=await L(e);if(!t)return null;try{let{stdout:e}=await d("pgrep",["-n","-P",String(t)],{timeout:5e3}),r=e.trim();if(!r)return null;let{stdout:a}=await d("ps",["-o","args=","-p",r],{timeout:5e3}),s=a.trim();if(!s)return null;let n=s.split(/\s+/);if(0===n.length)return s;if(n[0]=i.default.basename(n[0]),C.has(n[0])&&n.length>1){let e=i.default.basename(n[1]).replace(/\.(c|m)?js$/,"");n.splice(0,2,e)}return n.join(" ")}catch{return null}};e.s(["SAFE_SHELLS",0,N,"applyConfig",0,b,"capturePaneContent",0,q,"capturePaneContentWithHistory",0,j,"checkTerminalProcess",0,$,"createSession",0,h,"defaultSessionName",0,()=>`pt-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}-${(0,s.nanoid)(6)}`,"exitCopyMode",0,T,"getAllPanesInfo",0,I,"getLastCommand",0,K,"getListeningPorts",0,F,"getPaneCurrentCommand",0,P,"getPaneDetailInfo",0,D,"getPaneTitle",0,R,"getSessionCwd",0,E,"getSessionPanePid",0,L,"hasSession",0,x,"killServer",0,H,"killSession",0,g,"listSessions",0,f,"resolveExistingDir",0,w,"scanSessions",0,v,"sendBracketedPaste",0,k,"sendKeys",0,M,"sendRawKeys",0,A,"workspaceSessionName",0,(e,t,r)=>`pt-${e}-${t}-${r}`],459015)},942080,e=>{"use strict";var t=e.i(926747),r=e.i(190406),a=e.i(244898),i=e.i(262950),s=e.i(233405),n=e.i(254799),l=e.i(224361),o=e.i(459015),u=e.i(25146);let c=(0,l.promisify)(s.execFile),d=(0,u.createLogger)("diff"),p=async e=>{try{let{stdout:t}=await c("git",["rev-list","--left-right","--count","HEAD...@{upstream}"],{cwd:e,timeout:1e4}),r=t.trim().split(/\s+/);return{ahead:parseInt(r[0],10)||0,behind:parseInt(r[1],10)||0}}catch{return{ahead:0,behind:0}}},m=async e=>{let[t,r,a,i]=await Promise.allSettled([c("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,timeout:1e4}),c("git",["rev-parse","--abbrev-ref","--symbolic-full-name","@{upstream}"],{cwd:e,timeout:1e4}),c("git",["stash","list"],{cwd:e,timeout:1e4}),c("git",["log","-1","--format=%H\x1f%s\x1f%an\x1f%at"],{cwd:e,timeout:1e4})]),s="fulfilled"===t.status?t.value.stdout.trim():"",n="fulfilled"===r.status?r.value.stdout.trim():null,l="fulfilled"===a.status?a.value.stdout.trim():"",o=l?l.split("\n").length:0,u=null;if("fulfilled"===i.status){let e=i.value.stdout.trim().split("\x1f");if(e.length>=4){let[t,r,a,i]=e;u={hash:t,shortHash:t.slice(0,7),subject:r,author:a,timestamp:1e3*parseInt(i,10)}}}return{branch:s,upstream:n,isDetached:"HEAD"===s,stash:o,headCommit:u}},f=async e=>{let[{stdout:t},{stdout:r},{stdout:a}]=await Promise.all([c("git",["rev-parse","HEAD"],{cwd:e,timeout:1e4}),c("git",["status","--porcelain","-uall"],{cwd:e,timeout:1e4}),c("git",["diff","HEAD","--shortstat"],{cwd:e,timeout:1e4})]);return(0,n.createHash)("sha1").update(`${t.trim()}
2
+ ${r}
3
+ ${a}`).digest("hex").slice(0,16)},h=async(e,t)=>{if("GET"!==e.method)return t.setHeader("Allow","GET"),t.status(405).json({error:"Method not allowed"});let r=e.query.session,a="true"===e.query.hashOnly,i="true"===e.query.fetch;if(!r)return t.status(400).json({error:"session parameter required"});if(!await (0,o.hasSession)(r))return t.status(404).json({error:"Session not found"});let s=await (0,o.getSessionCwd)(r);if(!s)return t.status(500).json({error:"Failed to get CWD"});try{await c("git",["rev-parse","--is-inside-work-tree"],{cwd:s,timeout:1e4})}catch{return t.status(200).json({isGitRepo:!1,diff:"",hash:""})}let n=!1;if(i)try{await c("git",["fetch","--prune"],{cwd:s,timeout:2e4}),n=!0}catch(e){d.warn(`silent fetch failed: ${e instanceof Error?e.message:e}`)}try{if(a){let[e,r]=await Promise.all([f(s),p(s)]);return t.status(200).json({isGitRepo:!0,hash:e,ahead:r.ahead,behind:r.behind,fetched:n})}let[{stdout:e},{stdout:r},i,l,o]=await Promise.all([c("git",["diff","HEAD"],{cwd:s,timeout:1e4,maxBuffer:5242880}),c("git",["status","--porcelain","-uall"],{cwd:s,timeout:1e4}),f(s),p(s),m(s)]),u=r.split("\n").filter(e=>e.startsWith("??")).map(e=>e.slice(3).trim()),d=e;for(let e of u)try{let{stdout:t}=await c("git",["diff","--no-index","/dev/null",e],{cwd:s,timeout:1e4});d+=t}catch(e){e&&"object"==typeof e&&"stdout"in e&&(d+=e.stdout)}return t.status(200).json({isGitRepo:!0,diff:d,hash:i,ahead:l.ahead,behind:l.behind,branch:o.branch,upstream:o.upstream,isDetached:o.isDetached,stash:o.stash,headCommit:o.headCommit,fetched:n})}catch(e){return d.error(`git diff failed: ${e instanceof Error?e.message:e}`),t.status(500).json({error:"Failed to get diff"})}};e.s(["default",0,h],607240);var y=e.i(607240),g=e.i(7031),w=e.i(181927),x=e.i(846432);let S=(0,i.hoist)(y,"default"),v=(0,i.hoist)(y,"config"),_=new a.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/layout/diff",pathname:"/api/layout/diff",bundlePath:"",filename:""},userland:y,distDir:".next",relativeProjectDir:""});async function E(e,r,a){a.requestMeta&&(0,x.setRequestMeta)(e,a.requestMeta),_.isDev&&(0,x.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let i="/api/layout/diff";i=i.replace(/\/index$/,"")||"/";let s=await _.prepare(e,r,{srcPage:i});if(!s){r.statusCode=400,r.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve());return}let{query:n,params:l,prerenderManifest:o,routerServerContext:u}=s;try{let t,a=e.method||"GET",s=(0,g.getTracer)(),c=s.getActiveScopeSpan(),d=!!(null==u?void 0:u.isWrappedByNextServer),p=_.instrumentationOnRequestError.bind(_),m=async c=>_.render(e,r,{query:{...n,...l},params:l,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:_.isDev,page:"/api/layout/diff",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>p(e,...t)}).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=s.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==w.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${a} ${n}`;c.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),c.updateName(e),t&&t!==c&&(t.setAttribute("http.route",n),t.updateName(e))}else c.updateName(`${a} ${i}`)});d&&c?await m(c):(t=s.getActiveScopeSpan(),await s.withPropagatedContext(e.headers,()=>s.trace(w.BaseServerSpan.handleRequest,{spanName:`${a} ${i}`,kind:g.SpanKind.SERVER,attributes:{"http.method":a,"http.target":e.url}},m),void 0,!d))}catch(e){if(_.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==a.waitUntil||a.waitUntil.call(a,Promise.resolve())}}e.s(["config",0,v,"default",0,S,"handler",0,E],942080)}];
4
+
5
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0e.7isl._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[522734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},688947,(e,t,r)=>{t.exports=e.x("stream",()=>require("stream"))},406461,(e,t,r)=>{t.exports=e.x("zlib",()=>require("zlib"))},254799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},524836,(e,t,r)=>{t.exports=e.x("https",()=>require("https"))},921517,(e,t,r)=>{t.exports=e.x("http",()=>require("http"))},504446,(e,t,r)=>{t.exports=e.x("net",()=>require("net"))},755004,(e,t,r)=>{t.exports=e.x("tls",()=>require("tls"))},792509,(e,t,r)=>{t.exports=e.x("url",()=>require("url"))},500874,(e,t,r)=>{t.exports=e.x("buffer",()=>require("buffer"))},427699,(e,t,r)=>{t.exports=e.x("events",()=>require("events"))},224361,(e,t,r)=>{t.exports=e.x("util",()=>require("util"))},233405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},597789,965898,e=>{"use strict";let t=process.env.__PMUX_PRISTINE_ENV,r=Object.freeze(t?JSON.parse(t):{...process.env});t||(process.env.__PMUX_PRISTINE_ENV=JSON.stringify(r)),e.s(["PRISTINE_ENV",0,r],965898);let i=new Set(["HOME","USER","LOGNAME","SHELL","PATH","TERM","COLORTERM","LANG","TMPDIR","SSH_AUTH_SOCK","SSH_CONNECTION","SSH_TTY","DISPLAY","WAYLAND_DISPLAY","XDG_RUNTIME_DIR","TZ"]),a=["LC_"],l=e=>i.has(e)||a.some(t=>e.startsWith(t)),n={TERM:"xterm-256color",COLORTERM:"truecolor"},s=()=>{let e={};for(let[t,i]of Object.entries(r))void 0!==i&&l(t)&&(e[t]=i);return{...e,...n}},o=e=>`'${e.replace(/'/g,"'\\''")}'`,u=()=>r.SHELL||"/bin/bash";e.s(["buildShellEnv",0,()=>s(),"buildShellLaunchCommand",0,()=>{let e=Object.entries(s()).map(([e,t])=>`${e}=${o(t)}`).join(" ");return`env -i TMUX="$TMUX" TMUX_PANE="$TMUX_PANE" ${e} ${o(u())} -l`},"defaultShell",0,u],597789)},270406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},446786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},814747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},924868,(e,t,r)=>{t.exports=e.x("fs/promises",()=>require("fs/promises"))},130146,(e,t,r)=>{t.exports=e.x("pino-28069d5257187539",()=>require("pino-28069d5257187539"))},25146,e=>{"use strict";var t=e.i(130146),r=e.i(814747),i=e.i(446786);let a=r.default.join(i.default.homedir(),".purplemux","logs"),l=process.env.LOG_LEVEL||"info",n=(e=>{if(!e)return{};let t={};for(let r of e.split(",")){let[e,i]=r.split("=").map(e=>e.trim());e&&i&&(t[e]=i)}return t})(process.env.LOG_LEVELS),s=["trace","debug","info","warn","error","fatal"],o=globalThis;if(!o.__ptRootLogger){let e=[l,...Object.values(n)].reduce((e,t)=>s.indexOf(t)<s.indexOf(e)?t:e,"fatal");o.__ptRootLogger=(0,t.default)({level:e,transport:{targets:[{target:"pino-roll",level:e,options:{file:r.default.join(a,"purplemux"),frequency:"daily",dateFormat:"yyyy-MM-dd",limit:{count:7},mkdir:!0}},{target:"pino-pretty",level:e,options:{colorize:!0,ignore:"pid,hostname,module",translateTime:"HH:MM:ss",messageFormat:"[{module}] {msg}"}}]}})}let u=o.__ptRootLogger;e.s(["createLogger",0,e=>{let t=u.child({module:e});return t.level=n[e]??l,t}])},871911,e=>{"use strict";var t=e.i(254799),r=e.i(522734),i=e.i(814747),a=e.i(446786);let l=i.default.join(a.default.homedir(),".purplemux","cli-token"),n=globalThis;e.s(["verifyCliToken",0,e=>{let a=e.headers["x-pmux-token"];var s="string"==typeof a?a:void 0;if(!s)return!1;let o=(()=>{if(n.__ptCliToken)return n.__ptCliToken;let e=(()=>{try{return r.default.readFileSync(l,"utf-8").trim()||null}catch{return null}})();if(e)return n.__ptCliToken=e,e;let a=(0,t.randomBytes)(32).toString("hex");n.__ptCliToken=a;try{r.default.mkdirSync(i.default.dirname(l),{recursive:!0}),r.default.writeFileSync(l,a,{mode:384})}catch{}return a})();return s.length===o.length&&(0,t.timingSafeEqual)(Buffer.from(s),Buffer.from(o))}])},713915,e=>{"use strict";var t=e.i(233405),r=e.i(924868),i=e.i(446786),a=e.i(814747),l=e.i(224361),n=e.i(597789),s=e.i(965898);let o=(0,l.promisify)(t.execFile),u=null,d=null,c=async()=>{let e=i.default.userInfo().shell||(0,n.defaultShell)();try{let{stdout:t}=await o(e,["-ilc",'echo -n "$PATH"'],{timeout:5e3,env:{...(0,n.buildShellEnv)(),SHELL:e,DISABLE_AUTO_UPDATE:"true",ZSH_TMUX_AUTOSTARTED:"true"}});return t.toString().trim()}catch{return s.PRISTINE_ENV.PATH||""}},p=async()=>u||(d||(d=c().then(e=>(u=e,d=null,e))),d),f=async(e,t,r)=>{try{let i=await p(),{stdout:a}=await o(e,t,{timeout:5e3,env:{...process.env,PATH:i}});return{installed:!0,version:r(a)}}catch{return{installed:!1,version:null}}},h=e=>e.trim().match(/(\d+\.\d+[\d.]*)/)?.[1]??null,m=[a.default.join(i.default.homedir(),".local","bin")],g=async()=>{for(let e of m)try{return await (0,r.access)(a.default.join(e,"claude")),e}catch{}return null},y=e=>e.installed&&null!==e.version&&parseFloat(e.version)>=2.9,x=async()=>{u=await c();let[e,t,l]=await Promise.all([f("tmux",["-V"],h),f("git",["--version"],h),f("claude",["--version"],h)]),n=(y(e)&&t.installed&&l.installed,l.installed?null:await g()),s=!1;if(l.installed||n)try{await (0,r.access)(a.default.join(i.default.homedir(),".claude")),s=!0}catch{}return{tmux:{...e,compatible:y(e)},git:t,claude:{...l,binaryPath:n,loggedIn:s}}},S=null,v=null,w=null,_=null,E=async()=>w&&Date.now()-w.checkedAt<1e3?w.result:_||(_=x().then(e=>(w={result:e,checkedAt:Date.now()},_=null,e)).catch(e=>{throw _=null,e})),T=async()=>{u=await c();let[e,t,r]=await Promise.all([f("tmux",["-V"],h),f("git",["--version"],h),f("claude",["--version"],h)]);return{tmux:{...e,compatible:y(e)},git:t,claude:r}},P=async()=>S&&Date.now()-S.checkedAt<3e4?S.result:v||(v=T().then(e=>(S={result:e,checkedAt:Date.now()},v=null,e)).catch(e=>{throw v=null,e}));e.s(["getCachedPreflightStatus",0,E,"getCachedRuntimePreflight",0,P,"getShellPath",0,p,"invalidateRuntimeCache",0,()=>{S=null,v=null}])},845994,e=>{"use strict";var t=e.i(924868),r=e.i(814747),i=e.i(446786),a=e.i(254799),l=e.i(666126);(0,e.i(25146).createLogger)("config");let n=r.default.join(i.default.homedir(),".purplemux"),s=r.default.join(n,"config.json"),o=globalThis;o.__ptConfigLock||(o.__ptConfigLock=Promise.resolve());let u=async e=>{let t,r=new Promise(e=>{t=e}),i=o.__ptConfigLock;o.__ptConfigLock=r,await i;try{return await e()}finally{t()}},d=()=>({updatedAt:new Date().toISOString()}),c=async()=>{try{let e=await t.default.readFile(s,"utf-8");return JSON.parse(e)}catch{return null}},p=async e=>{let{updatedAt:r,...i}=e,a=JSON.stringify(i);if(o.__ptConfigContentCache===a)return;e.updatedAt=new Date().toISOString();let n=s+".tmp";try{await t.default.writeFile(n,JSON.stringify(e,null,2),{mode:384}),await t.default.rename(n,s)}catch(e){throw await t.default.unlink(n).catch(()=>{}),e}o.__ptConfigContentCache=a,(0,l.broadcastSync)({type:"config"})},f="scrypt:",h=e=>"string"==typeof e&&e.startsWith(f),m=async e=>{let t=a.default.randomBytes(16),r=await new Promise((r,i)=>{a.default.scrypt(e,t,64,(e,t)=>{e?i(e):r(t)})});return`${f}${t.toString("hex")}:${r.toString("hex")}`},g=async(e,t)=>{if(!h(t))return!1;let[,r,i]=t.split(":"),l=Buffer.from(r,"hex"),n=Buffer.from(i,"hex"),s=await new Promise((t,r)=>{a.default.scrypt(e,l,n.length,(e,i)=>{e?r(e):t(i)})});return a.default.timingSafeEqual(s,n)},y=async()=>await c()??d(),x=async e=>u(async()=>{let t=await c()??d();Object.assign(t,e),await p(t)}),S=async()=>{let e=await c();return!h(e?.authPassword)},v=async()=>{let e=await c();return e?.dangerouslySkipPermissions??!1};e.s(["generateSecret",0,()=>a.default.randomBytes(32).toString("hex"),"getConfig",0,y,"getDangerouslySkipPermissions",0,v,"hashPassword",0,m,"needsSetup",0,S,"updateConfig",0,x,"verifyPassword",0,g])},284345,e=>{"use strict";var t=e.i(926747),r=e.i(190406),i=e.i(244898),a=e.i(262950),l=e.i(713915),n=e.i(845994),s=e.i(772601),o=e.i(871911);let u=async(e,t)=>{if("GET"!==e.method)return t.setHeader("Allow","GET"),t.status(405).json({error:"Method not allowed"});if(!await (0,n.needsSetup)()&&!((0,o.verifyCliToken)(e)||await (0,s.verifyRequestSession)(e.headers.cookie)))return t.status(401).json({error:"Unauthorized"});let r=await (0,l.getCachedPreflightStatus)();return t.status(200).json(r)};e.s(["default",0,u],16083);var d=e.i(16083),c=e.i(7031),p=e.i(181927),f=e.i(846432);let h=(0,a.hoist)(d,"default"),m=(0,a.hoist)(d,"config"),g=new i.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/auth/preflight",pathname:"/api/auth/preflight",bundlePath:"",filename:""},userland:d,distDir:".next",relativeProjectDir:""});async function y(e,r,i){i.requestMeta&&(0,f.setRequestMeta)(e,i.requestMeta),g.isDev&&(0,f.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let a="/api/auth/preflight";a=a.replace(/\/index$/,"")||"/";let l=await g.prepare(e,r,{srcPage:a});if(!l){r.statusCode=400,r.end("Bad Request"),null==i.waitUntil||i.waitUntil.call(i,Promise.resolve());return}let{query:n,params:s,prerenderManifest:o,routerServerContext:u}=l;try{let t,i=e.method||"GET",l=(0,c.getTracer)(),d=l.getActiveScopeSpan(),f=!!(null==u?void 0:u.isWrappedByNextServer),h=g.instrumentationOnRequestError.bind(g),m=async d=>g.render(e,r,{query:{...n,...s},params:s,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:g.isDev,page:"/api/auth/preflight",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>h(e,...t)}).finally(()=>{if(!d)return;d.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=l.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=e.get("next.route");if(n){let e=`${i} ${n}`;d.setAttributes({"next.route":n,"http.route":n,"next.span_name":e}),d.updateName(e),t&&t!==d&&(t.setAttribute("http.route",n),t.updateName(e))}else d.updateName(`${i} ${a}`)});f&&d?await m(d):(t=l.getActiveScopeSpan(),await l.withPropagatedContext(e.headers,()=>l.trace(p.BaseServerSpan.handleRequest,{spanName:`${i} ${a}`,kind:c.SpanKind.SERVER,attributes:{"http.method":i,"http.target":e.url}},m),void 0,!f))}catch(e){if(g.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==i.waitUntil||i.waitUntil.call(i,Promise.resolve())}}e.s(["config",0,m,"default",0,h,"handler",0,y],284345)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0gcec.8._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[522734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},871911,e=>{"use strict";var t=e.i(254799),r=e.i(522734),a=e.i(814747),i=e.i(446786);let n=a.default.join(i.default.homedir(),".purplemux","cli-token"),s=globalThis;e.s(["verifyCliToken",0,e=>{let i=e.headers["x-pmux-token"];var o="string"==typeof i?i:void 0;if(!o)return!1;let l=(()=>{if(s.__ptCliToken)return s.__ptCliToken;let e=(()=>{try{return r.default.readFileSync(n,"utf-8").trim()||null}catch{return null}})();if(e)return s.__ptCliToken=e,e;let i=(0,t.randomBytes)(32).toString("hex");s.__ptCliToken=i;try{r.default.mkdirSync(a.default.dirname(n),{recursive:!0}),r.default.writeFileSync(n,i,{mode:384})}catch{}return i})();return o.length===l.length&&(0,t.timingSafeEqual)(Buffer.from(o),Buffer.from(l))}])},200523,e=>{"use strict";var t=e.i(825265),r=e.i(804767),a=e.i(322429),i=e.i(871911);let n=async(e,i)=>{if(!await (0,a.getWorkspaceById)(e))return null;let n=await (0,t.getLayout)(e);for(let t of(0,r.collectPanes)(n.root)){let r=t.tabs.find(e=>e.id===i);if(r)return{workspaceId:e,paneId:t.id,tab:r}}return null},s=async e=>{let a=await (0,t.getLayout)(e);return(0,r.getFirstPaneId)(a.root)||null},o=async(e,t,r,a)=>{if(e.method!==r){t.setHeader("Allow",r),t.status(405).json({error:"Method not allowed"});return}if(!(0,i.verifyCliToken)(e))return void t.status(403).json({error:"Forbidden"});let s=e.query.tabId,o="string"==typeof e.query.workspaceId?e.query.workspaceId:void 0;if(!o)return void t.status(400).json({error:"workspaceId is required"});let l=await n(o,s);if(!l)return void t.status(404).json({error:"Tab not found"});if("web-browser"!==l.tab.panelType)return void t.status(400).json({error:"Tab is not a web-browser panel"});let u=globalThis.__ptBrowserBridge??null;u?await a({tabId:s,bridge:u}):t.status(503).json({error:"Browser bridge unavailable (Electron-only feature)"})};e.s(["findTab",0,n,"resolveFirstPaneId",0,s,"withBrowserTab",0,o],200523)},500208,e=>{"use strict";var t=e.i(926747),r=e.i(190406),a=e.i(244898),i=e.i(262950),n=e.i(871911),s=e.i(200523),o=e.i(825265);let l=async(e,t)=>{if(!(0,n.verifyCliToken)(e))return t.status(403).json({error:"Forbidden"});let r=e.query.tabId,a="string"==typeof e.query.workspaceId?e.query.workspaceId:void 0;if(!a)return t.status(400).json({error:"workspaceId is required"});if("GET"===e.method){let e=await (0,s.findTab)(a,r);return e?t.status(200).json({tabId:e.tab.id,workspaceId:e.workspaceId,paneId:e.paneId,name:e.tab.name,sessionName:e.tab.sessionName,panelType:e.tab.panelType}):t.status(404).json({error:"Tab not found"})}if("DELETE"===e.method){let e=await (0,s.findTab)(a,r);if(!e)return t.status(404).json({error:"Tab not found"});let i=await (0,o.removeTabFromPane)(a,e.paneId,r);return t.status(200).json({ok:i})}return t.setHeader("Allow","GET, DELETE"),t.status(405).json({error:"Method not allowed"})};e.s(["default",0,l],83594);var u=e.i(83594),d=e.i(7031),p=e.i(181927),f=e.i(846432);let c=(0,i.hoist)(u,"default"),v=(0,i.hoist)(u,"config"),b=new a.PagesAPIRouteModule({definition:{kind:r.RouteKind.PAGES_API,page:"/api/cli/tabs/[tabId]/index",pathname:"/api/cli/tabs/[tabId]",bundlePath:"",filename:""},userland:u,distDir:".next",relativeProjectDir:""});async function w(e,r,a){a.requestMeta&&(0,f.setRequestMeta)(e,a.requestMeta),b.isDev&&(0,f.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let i="/api/cli/tabs/[tabId]/index";i=i.replace(/\/index$/,"")||"/";let n=await b.prepare(e,r,{srcPage:i});if(!n){r.statusCode=400,r.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve());return}let{query:s,params:o,prerenderManifest:l,routerServerContext:u}=n;try{let t,a=e.method||"GET",n=(0,d.getTracer)(),f=n.getActiveScopeSpan(),c=!!(null==u?void 0:u.isWrappedByNextServer),v=b.instrumentationOnRequestError.bind(b),w=async d=>b.render(e,r,{query:{...s,...o},params:o,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:l.preview,propagateError:!1,dev:b.isDev,page:"/api/cli/tabs/[tabId]/index",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>v(e,...t)}).finally(()=>{if(!d)return;d.setAttributes({"http.status_code":r.statusCode,"next.rsc":!1});let e=n.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==p.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${e.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=e.get("next.route");if(s){let e=`${a} ${s}`;d.setAttributes({"next.route":s,"http.route":s,"next.span_name":e}),d.updateName(e),t&&t!==d&&(t.setAttribute("http.route",s),t.updateName(e))}else d.updateName(`${a} ${i}`)});c&&f?await w(f):(t=n.getActiveScopeSpan(),await n.withPropagatedContext(e.headers,()=>n.trace(p.BaseServerSpan.handleRequest,{spanName:`${a} ${i}`,kind:d.SpanKind.SERVER,attributes:{"http.method":a,"http.target":e.url}},w),void 0,!c))}catch(e){if(b.isDev)throw e;(0,t.sendError)(r,500,"Internal Server Error")}finally{null==a.waitUntil||a.waitUntil.call(a,Promise.resolve())}}e.s(["config",0,v,"default",0,c,"handler",0,w],500208)},981532,e=>{e.v(e=>Promise.resolve().then(()=>e(322429)))},322522,e=>{e.v(e=>Promise.resolve().then(()=>e(459015)))},245061,e=>{e.v(t=>Promise.all(["server/chunks/src_lib_tab-title_ts_0onatvs._.js"].map(t=>e.l(t))).then(()=>t(785128)))}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0i1m1v9._.js.map