purplemux 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +31 -31
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +1 -1
- package/.next/standalone/.next/routes-manifest.json +14 -14
- package/.next/standalone/.next/server/chunks/_04vmy2-._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_pages-api_0qhmds_.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_layout-store_ts_0fanx7c._.js +1 -1
- package/.next/standalone/.next/server/chunks/src_lib_status-manager_ts_003hlhy._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0-xx2s1._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_02xys-k._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0camkxl._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0i209pm._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_0sfa_96._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/_12sjhza._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_de_terminal_json_[json]_cjs_05jirtw._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_en_terminal_json_[json]_cjs_0~ls3g-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_es_terminal_json_[json]_cjs_04g2b1_._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_fr_terminal_json_[json]_cjs_0uhakya._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_ja_terminal_json_[json]_cjs_0776z4f._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_ko_terminal_json_[json]_cjs_06611.3._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_pt-BR_terminal_json_[json]_cjs_034yyg9._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_ru_terminal_json_[json]_cjs_0emk8~n._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_tr_terminal_json_[json]_cjs_0xpix8g._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_zh-CN_terminal_json_[json]_cjs_12vwl8a._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/messages_zh-TW_terminal_json_[json]_cjs_0spg5z5._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_components_features_mobile_mobile-terminal-page_tsx_02chzch._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/src_components_features_terminal_terminal-page_tsx_0o~2bsa._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +31 -31
- package/.next/standalone/.next/server/pages/_app/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/_app/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/agents/[agentId]/chat/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/agents/[agentId]/chat/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/agents/[agentId]/memory/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/agents/[agentId]/memory/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/agents/[agentId]/workspace/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/agents/[agentId]/workspace/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/agents/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/agents/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/de/404.html +1 -1
- package/.next/standalone/.next/server/pages/de/500.html +1 -1
- package/.next/standalone/.next/server/pages/en/404.html +1 -1
- package/.next/standalone/.next/server/pages/en/500.html +1 -1
- package/.next/standalone/.next/server/pages/es/404.html +1 -1
- package/.next/standalone/.next/server/pages/es/500.html +1 -1
- package/.next/standalone/.next/server/pages/fr/404.html +1 -1
- package/.next/standalone/.next/server/pages/fr/500.html +1 -1
- package/.next/standalone/.next/server/pages/index/build-manifest.json +4 -4
- package/.next/standalone/.next/server/pages/index/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/index/react-loadable-manifest.json +4 -4
- package/.next/standalone/.next/server/pages/ja/404.html +1 -1
- package/.next/standalone/.next/server/pages/ja/500.html +1 -1
- package/.next/standalone/.next/server/pages/ko/404.html +1 -1
- package/.next/standalone/.next/server/pages/ko/500.html +1 -1
- package/.next/standalone/.next/server/pages/pt-BR/404.html +1 -1
- package/.next/standalone/.next/server/pages/pt-BR/500.html +1 -1
- package/.next/standalone/.next/server/pages/reports/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/reports/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/ru/404.html +1 -1
- package/.next/standalone/.next/server/pages/ru/500.html +1 -1
- package/.next/standalone/.next/server/pages/stats/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/stats/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/tr/404.html +1 -1
- package/.next/standalone/.next/server/pages/tr/500.html +1 -1
- package/.next/standalone/.next/server/pages/webview/build-manifest.json +3 -3
- package/.next/standalone/.next/server/pages/webview/client-build-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/zh-CN/404.html +1 -1
- package/.next/standalone/.next/server/pages/zh-CN/500.html +1 -1
- package/.next/standalone/.next/server/pages/zh-TW/404.html +1 -1
- package/.next/standalone/.next/server/pages/zh-TW/500.html +1 -1
- package/.next/standalone/.next/static/chunks/0-sg4kua_koj3.js +1 -0
- package/.next/standalone/.next/static/chunks/0.afp8gebc17y.js +1 -0
- package/.next/standalone/.next/static/chunks/{04~5g0kns0w-3.js → 00ll0wq7g5_ab.js} +3 -3
- package/.next/standalone/.next/static/chunks/{0bu_7.oshhrhc.js → 019qnp3cdlqll.js} +3 -3
- package/.next/standalone/.next/static/chunks/01_k6x8wlb8-9.js +1 -0
- package/.next/standalone/.next/static/chunks/01u8i_srzu1bi.js +1 -0
- package/.next/standalone/.next/static/chunks/{08mloizj8v086.js → 02hya8y6ngh8h.js} +1 -1
- package/.next/standalone/.next/static/chunks/02qyd-w_8qzow.js +1 -0
- package/.next/standalone/.next/static/chunks/05r1jaq5c83x4.js +1 -0
- package/.next/standalone/.next/static/chunks/{12p51x0jwo~g0.js → 072lr.h0_1017.js} +4 -4
- package/.next/standalone/.next/static/chunks/{0pitqn2--9ly-.js → 09auw~hymill5.js} +3 -3
- package/.next/standalone/.next/static/chunks/{18eatd5x-6wn7.js → 09v9onq32.q9o.js} +3 -3
- package/.next/standalone/.next/static/chunks/0_vi4_~nojpg6.js +1 -0
- package/.next/standalone/.next/static/chunks/0c6dh~_8nm8rw.js +1 -0
- package/.next/standalone/.next/static/chunks/{0c3fuwgxh-35e.js → 0cc9wtn2ws_hj.js} +1 -1
- package/.next/standalone/.next/static/chunks/0dz5dqn26cusn.js +1 -0
- package/.next/standalone/.next/static/chunks/{11oe_y_tnk5rs.js → 0epyfzijr8853.js} +1 -1
- package/.next/standalone/.next/static/chunks/0igc5x66mp3y1.js +1 -0
- package/.next/standalone/.next/static/chunks/0rm79dcgdvabz.js +1 -0
- package/.next/standalone/.next/static/chunks/0uc3c0x4yp~g_.js +1 -0
- package/.next/standalone/.next/static/chunks/0vjl9v9ti52-t.js +1 -0
- package/.next/standalone/.next/static/chunks/{13zscswif89xn.js → 0y.2idt4jy0v8.js} +3 -3
- package/.next/standalone/.next/static/chunks/0ygr.-bo5mo3a.js +1 -0
- package/.next/standalone/.next/static/chunks/{0a-2nzgsh-~9k.js → 0yoqx-p57vv4h.js} +1 -1
- package/.next/standalone/.next/static/chunks/0zbiq5qe~ekdz.js +1 -0
- package/.next/standalone/.next/static/chunks/{0e7eht~s9maij.js → 0zwzi3f2rc3z4.js} +3 -3
- package/.next/standalone/.next/static/chunks/{0efmzxto_4qc3.js → 0z~upx8kxb56s.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0.emlk-pyrq15.js → 10q_80uhujl-n.js} +3 -3
- package/.next/standalone/.next/static/chunks/11bhs_nxim363.js +5 -0
- package/.next/standalone/.next/static/chunks/12r4bxpyxo0h-.js +5 -0
- package/.next/standalone/.next/static/chunks/140fifc12jmjv.js +1 -0
- package/.next/standalone/.next/static/chunks/{05~-~kex871hu.js → 14rag.6lha5-y.js} +3 -3
- package/.next/standalone/.next/static/chunks/{turbopack-0z94ziwry23f8.js → turbopack-03wgtzkruqo9d.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0kc~8bc2j~nm5.js → turbopack-091shq5m7aijg.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0g9hcqkf8--nt.js → turbopack-0l-gurbj0.orc.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0pbs5o5-yw7zn.js → turbopack-0sqhowkqu.h25.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0kxgmh4de86.c.js → turbopack-0um3302fiwl.8.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0v2s_rrv-4zo_.js → turbopack-0v.9~z92dgw~6.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0qzp5t.v8o4yd.js → turbopack-0wzedz_6usy8n.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0zo4s0e54r18i.js → turbopack-11briqm29_e1a.js} +1 -1
- package/.next/standalone/.next/static/chunks/{turbopack-0vg_jegb9r64~.js → turbopack-14zdukk1meg5n.js} +1 -1
- package/.next/standalone/.next/static/{cUc-iVh9yPvV5U6zlJnRI → mG4eqGEgMBuU5tAi2sxtl}/_buildManifest.js +8 -8
- package/.next/standalone/messages/de/terminal.json +1 -1
- package/.next/standalone/messages/en/terminal.json +1 -1
- package/.next/standalone/messages/es/terminal.json +1 -1
- package/.next/standalone/messages/fr/terminal.json +1 -1
- package/.next/standalone/messages/ja/terminal.json +1 -1
- package/.next/standalone/messages/ko/terminal.json +1 -1
- package/.next/standalone/messages/pt-BR/terminal.json +1 -1
- package/.next/standalone/messages/ru/terminal.json +1 -1
- package/.next/standalone/messages/tr/terminal.json +1 -1
- package/.next/standalone/messages/zh-CN/terminal.json +1 -1
- package/.next/standalone/messages/zh-TW/terminal.json +1 -1
- package/.next/standalone/package.json +10 -2
- package/.next/standalone/server.js +1 -1
- package/dist/server.js +11 -2
- package/package.json +10 -2
- package/.next/standalone/.next/static/chunks/0.6_j_h-u_8~u.js +0 -1
- package/.next/standalone/.next/static/chunks/05_uo4o5moo04.js +0 -1
- package/.next/standalone/.next/static/chunks/09.nvq4m4q6nw.js +0 -1
- package/.next/standalone/.next/static/chunks/0_tchj5ld5cb0.js +0 -5
- package/.next/standalone/.next/static/chunks/0cacobjih1-zm.js +0 -1
- package/.next/standalone/.next/static/chunks/0cv-p.g_i.2x4.js +0 -1
- package/.next/standalone/.next/static/chunks/0g65_p2-lr~2p.js +0 -1
- package/.next/standalone/.next/static/chunks/0nib3rg.-vev~.js +0 -1
- package/.next/standalone/.next/static/chunks/0pd8.t0drvms0.js +0 -1
- package/.next/standalone/.next/static/chunks/0ron~pzh_y-kg.js +0 -5
- package/.next/standalone/.next/static/chunks/0rs6s1tzjmjev.js +0 -1
- package/.next/standalone/.next/static/chunks/0rtjgrowjz8n3.js +0 -1
- package/.next/standalone/.next/static/chunks/0uh~v~z-_qx.~.js +0 -1
- package/.next/standalone/.next/static/chunks/0uv~o_jk4b1cj.js +0 -1
- package/.next/standalone/.next/static/chunks/0vglv5cz.-0qh.js +0 -1
- package/.next/standalone/.next/static/chunks/0wbv3pd2oyilv.js +0 -1
- package/.next/standalone/.next/static/chunks/0~9o7bcqoa_1i.js +0 -1
- package/.next/standalone/.next/static/chunks/17rm0jup5m3lg.js +0 -1
- /package/.next/standalone/.next/static/{cUc-iVh9yPvV5U6zlJnRI → mG4eqGEgMBuU5tAi2sxtl}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{cUc-iVh9yPvV5U6zlJnRI → mG4eqGEgMBuU5tAi2sxtl}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
mG4eqGEgMBuU5tAi2sxtl
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"pages": {
|
|
3
3
|
"/": [
|
|
4
|
-
"static/chunks/
|
|
4
|
+
"static/chunks/0epyfzijr8853.js",
|
|
5
5
|
"static/chunks/0y1iobvr7xv~m.js",
|
|
6
6
|
"static/chunks/06wc2umsaus4g.js",
|
|
7
|
-
"static/chunks/
|
|
7
|
+
"static/chunks/01u8i_srzu1bi.js",
|
|
8
8
|
"static/chunks/0qe146f.3s0ud.js",
|
|
9
9
|
"static/chunks/12t3ws50siqw1.js",
|
|
10
10
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
@@ -18,20 +18,20 @@
|
|
|
18
18
|
"static/chunks/02lycfk~b_9ps.js",
|
|
19
19
|
"static/chunks/0ti3g2b7fhm5v.js",
|
|
20
20
|
"static/chunks/05-mpg38w0a82.js",
|
|
21
|
-
"static/chunks/
|
|
22
|
-
"static/chunks/turbopack-
|
|
21
|
+
"static/chunks/0dz5dqn26cusn.js",
|
|
22
|
+
"static/chunks/turbopack-091shq5m7aijg.js"
|
|
23
23
|
],
|
|
24
24
|
"/_app": [
|
|
25
|
-
"static/chunks/
|
|
25
|
+
"static/chunks/02hya8y6ngh8h.js",
|
|
26
26
|
"static/chunks/08h59hstdxbn0.js",
|
|
27
27
|
"static/chunks/00x-ygjkfbgnz.js",
|
|
28
28
|
"static/chunks/00yfl7agnve...js",
|
|
29
29
|
"static/chunks/0yi.kp2rt4-nc.js",
|
|
30
|
-
"static/chunks/
|
|
30
|
+
"static/chunks/0cc9wtn2ws_hj.js",
|
|
31
31
|
"static/chunks/05-mpg38w0a82.js",
|
|
32
32
|
"static/chunks/0g7dnwyslqeva.css",
|
|
33
33
|
"static/chunks/0z3gpm0o.mwwy.css",
|
|
34
|
-
"static/chunks/turbopack-
|
|
34
|
+
"static/chunks/turbopack-0wzedz_6usy8n.js"
|
|
35
35
|
],
|
|
36
36
|
"/_error": [
|
|
37
37
|
"static/chunks/0~o730huopa91.js",
|
|
@@ -48,21 +48,21 @@
|
|
|
48
48
|
"static/chunks/0ti3g2b7fhm5v.js",
|
|
49
49
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
50
50
|
"static/chunks/06fd4gm.ayhf7.js",
|
|
51
|
-
"static/chunks/
|
|
51
|
+
"static/chunks/0zbiq5qe~ekdz.js",
|
|
52
52
|
"static/chunks/02lycfk~b_9ps.js",
|
|
53
53
|
"static/chunks/0yi.kp2rt4-nc.js",
|
|
54
54
|
"static/chunks/00yfl7agnve...js",
|
|
55
|
-
"static/chunks/
|
|
55
|
+
"static/chunks/0dz5dqn26cusn.js",
|
|
56
56
|
"static/chunks/09wg815lxyi._.js",
|
|
57
57
|
"static/chunks/0wlz6--vu7adu.js",
|
|
58
58
|
"static/chunks/0ml5~2ty-rbv_.js",
|
|
59
59
|
"static/chunks/12t3ws50siqw1.js",
|
|
60
60
|
"static/chunks/15aj3kd.p7zw6.js",
|
|
61
|
-
"static/chunks/turbopack-
|
|
61
|
+
"static/chunks/turbopack-11briqm29_e1a.js"
|
|
62
62
|
],
|
|
63
63
|
"/agents/[agentId]/chat": [
|
|
64
64
|
"static/chunks/0fungak7h7t_u.js",
|
|
65
|
-
"static/chunks/
|
|
65
|
+
"static/chunks/0zbiq5qe~ekdz.js",
|
|
66
66
|
"static/chunks/0ay.h74rl2t2c.js",
|
|
67
67
|
"static/chunks/12t3ws50siqw1.js",
|
|
68
68
|
"static/chunks/06fd4gm.ayhf7.js",
|
|
@@ -80,16 +80,16 @@
|
|
|
80
80
|
"static/chunks/02lycfk~b_9ps.js",
|
|
81
81
|
"static/chunks/0py3p~barq9qm.js",
|
|
82
82
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
83
|
-
"static/chunks/
|
|
83
|
+
"static/chunks/0dz5dqn26cusn.js",
|
|
84
84
|
"static/chunks/0ml5~2ty-rbv_.js",
|
|
85
|
-
"static/chunks/turbopack-
|
|
85
|
+
"static/chunks/turbopack-0um3302fiwl.8.js"
|
|
86
86
|
],
|
|
87
87
|
"/agents/[agentId]/memory": [
|
|
88
88
|
"static/chunks/0mi.f1.iffvs7.js",
|
|
89
89
|
"static/chunks/0b64-twwftp.b.js",
|
|
90
90
|
"static/chunks/0ay.h74rl2t2c.js",
|
|
91
91
|
"static/chunks/05-mpg38w0a82.js",
|
|
92
|
-
"static/chunks/
|
|
92
|
+
"static/chunks/01u8i_srzu1bi.js",
|
|
93
93
|
"static/chunks/12t3ws50siqw1.js",
|
|
94
94
|
"static/chunks/10r8rypk5fanv.js",
|
|
95
95
|
"static/chunks/0py3p~barq9qm.js",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"static/chunks/02lycfk~b_9ps.js",
|
|
99
99
|
"static/chunks/0wlz6--vu7adu.js",
|
|
100
100
|
"static/chunks/0ti3g2b7fhm5v.js",
|
|
101
|
-
"static/chunks/
|
|
101
|
+
"static/chunks/0dz5dqn26cusn.js",
|
|
102
102
|
"static/chunks/00yfl7agnve...js",
|
|
103
103
|
"static/chunks/0p15~kn-ue177.js",
|
|
104
104
|
"static/chunks/0yi.kp2rt4-nc.js",
|
|
@@ -106,13 +106,13 @@
|
|
|
106
106
|
"static/chunks/0qe146f.3s0ud.js",
|
|
107
107
|
"static/chunks/09wg815lxyi._.js",
|
|
108
108
|
"static/chunks/15aj3kd.p7zw6.js",
|
|
109
|
-
"static/chunks/turbopack-
|
|
109
|
+
"static/chunks/turbopack-0v.9~z92dgw~6.js"
|
|
110
110
|
],
|
|
111
111
|
"/agents/[agentId]/workspace": [
|
|
112
112
|
"static/chunks/0kmwqchx6vxwc.js",
|
|
113
113
|
"static/chunks/0fungak7h7t_u.js",
|
|
114
114
|
"static/chunks/0ay.h74rl2t2c.js",
|
|
115
|
-
"static/chunks/
|
|
115
|
+
"static/chunks/01u8i_srzu1bi.js",
|
|
116
116
|
"static/chunks/05-mpg38w0a82.js",
|
|
117
117
|
"static/chunks/00yfl7agnve...js",
|
|
118
118
|
"static/chunks/15aj3kd.p7zw6.js",
|
|
@@ -124,10 +124,10 @@
|
|
|
124
124
|
"static/chunks/09wg815lxyi._.js",
|
|
125
125
|
"static/chunks/0wlz6--vu7adu.js",
|
|
126
126
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
127
|
-
"static/chunks/
|
|
127
|
+
"static/chunks/0dz5dqn26cusn.js",
|
|
128
128
|
"static/chunks/0qe146f.3s0ud.js",
|
|
129
129
|
"static/chunks/02lycfk~b_9ps.js",
|
|
130
|
-
"static/chunks/turbopack-
|
|
130
|
+
"static/chunks/turbopack-14zdukk1meg5n.js"
|
|
131
131
|
],
|
|
132
132
|
"/login": [
|
|
133
133
|
"static/chunks/14rkjvhij9msz.js",
|
|
@@ -153,18 +153,18 @@
|
|
|
153
153
|
"static/chunks/0ti3g2b7fhm5v.js",
|
|
154
154
|
"static/chunks/0qe146f.3s0ud.js",
|
|
155
155
|
"static/chunks/05-mpg38w0a82.js",
|
|
156
|
-
"static/chunks/
|
|
156
|
+
"static/chunks/01u8i_srzu1bi.js",
|
|
157
157
|
"static/chunks/0py3p~barq9qm.js",
|
|
158
158
|
"static/chunks/0ml5~2ty-rbv_.js",
|
|
159
159
|
"static/chunks/0wlz6--vu7adu.js",
|
|
160
160
|
"static/chunks/09wg815lxyi._.js",
|
|
161
|
-
"static/chunks/
|
|
161
|
+
"static/chunks/0rm79dcgdvabz.js",
|
|
162
162
|
"static/chunks/0yi.kp2rt4-nc.js",
|
|
163
163
|
"static/chunks/00yfl7agnve...js",
|
|
164
164
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
165
165
|
"static/chunks/02lycfk~b_9ps.js",
|
|
166
166
|
"static/chunks/06fd4gm.ayhf7.js",
|
|
167
|
-
"static/chunks/turbopack-
|
|
167
|
+
"static/chunks/turbopack-03wgtzkruqo9d.js"
|
|
168
168
|
],
|
|
169
169
|
"/reset": [
|
|
170
170
|
"static/chunks/0_sdw~kzk-at0.js",
|
|
@@ -183,17 +183,17 @@
|
|
|
183
183
|
"static/chunks/0qe146f.3s0ud.js",
|
|
184
184
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
185
185
|
"static/chunks/06fd4gm.ayhf7.js",
|
|
186
|
-
"static/chunks/
|
|
186
|
+
"static/chunks/01u8i_srzu1bi.js",
|
|
187
187
|
"static/chunks/0ti3g2b7fhm5v.js",
|
|
188
188
|
"static/chunks/00yfl7agnve...js",
|
|
189
189
|
"static/chunks/0wlz6--vu7adu.js",
|
|
190
190
|
"static/chunks/09wg815lxyi._.js",
|
|
191
191
|
"static/chunks/02lycfk~b_9ps.js",
|
|
192
192
|
"static/chunks/0ml5~2ty-rbv_.js",
|
|
193
|
-
"static/chunks/
|
|
193
|
+
"static/chunks/05r1jaq5c83x4.js",
|
|
194
194
|
"static/chunks/15aj3kd.p7zw6.js",
|
|
195
195
|
"static/chunks/0yi.kp2rt4-nc.js",
|
|
196
|
-
"static/chunks/turbopack-
|
|
196
|
+
"static/chunks/turbopack-0sqhowkqu.h25.js"
|
|
197
197
|
],
|
|
198
198
|
"/tools-required": [
|
|
199
199
|
"static/chunks/0kf8xkvr3218u.js",
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
"static/chunks/0c8._01-id.jr.js",
|
|
211
211
|
"static/chunks/0fungak7h7t_u.js",
|
|
212
212
|
"static/chunks/0ay.h74rl2t2c.js",
|
|
213
|
-
"static/chunks/
|
|
213
|
+
"static/chunks/01u8i_srzu1bi.js",
|
|
214
214
|
"static/chunks/05-mpg38w0a82.js",
|
|
215
215
|
"static/chunks/0ti3g2b7fhm5v.js",
|
|
216
216
|
"static/chunks/0-sxrfxgcu1ce.js",
|
|
@@ -218,22 +218,22 @@
|
|
|
218
218
|
"static/chunks/06fd4gm.ayhf7.js",
|
|
219
219
|
"static/chunks/15aj3kd.p7zw6.js",
|
|
220
220
|
"static/chunks/00yfl7agnve...js",
|
|
221
|
-
"static/chunks/
|
|
221
|
+
"static/chunks/0dz5dqn26cusn.js",
|
|
222
222
|
"static/chunks/0ml5~2ty-rbv_.js",
|
|
223
223
|
"static/chunks/09wg815lxyi._.js",
|
|
224
224
|
"static/chunks/0wlz6--vu7adu.js",
|
|
225
225
|
"static/chunks/02lycfk~b_9ps.js",
|
|
226
226
|
"static/chunks/0qe146f.3s0ud.js",
|
|
227
227
|
"static/chunks/0yi.kp2rt4-nc.js",
|
|
228
|
-
"static/chunks/turbopack-
|
|
228
|
+
"static/chunks/turbopack-0l-gurbj0.orc.js"
|
|
229
229
|
]
|
|
230
230
|
},
|
|
231
231
|
"devFiles": [],
|
|
232
232
|
"polyfillFiles": [],
|
|
233
233
|
"lowPriorityFiles": [
|
|
234
|
-
"static/
|
|
235
|
-
"static/
|
|
236
|
-
"static/
|
|
234
|
+
"static/mG4eqGEgMBuU5tAi2sxtl/_buildManifest.js",
|
|
235
|
+
"static/mG4eqGEgMBuU5tAi2sxtl/_ssgManifest.js",
|
|
236
|
+
"static/mG4eqGEgMBuU5tAi2sxtl/_clientMiddlewareManifest.js"
|
|
237
237
|
],
|
|
238
238
|
"rootMainFiles": []
|
|
239
239
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
"routes": {},
|
|
4
4
|
"dynamicRoutes": {},
|
|
5
5
|
"preview": {
|
|
6
|
-
"previewModeId": "
|
|
7
|
-
"previewModeSigningKey": "
|
|
8
|
-
"previewModeEncryptionKey": "
|
|
6
|
+
"previewModeId": "9dce7d6cdff8027b974bebef336b85d5",
|
|
7
|
+
"previewModeSigningKey": "116ab281fb98416b6604d6b37e0dbfc861f058945dfb661ecb2e74f2c228557d",
|
|
8
|
+
"previewModeEncryptionKey": "955a68a9ed6e2aa48f57b7f8e8db2b2482a6afa6dbc726e904cdc53affa03614"
|
|
9
9
|
},
|
|
10
10
|
"notFoundRoutes": []
|
|
11
11
|
}
|
|
@@ -614,59 +614,59 @@
|
|
|
614
614
|
"dataRoutes": [
|
|
615
615
|
{
|
|
616
616
|
"page": "/",
|
|
617
|
-
"dataRouteRegex": "^/_next/data/
|
|
617
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/index\\.json$"
|
|
618
618
|
},
|
|
619
619
|
{
|
|
620
620
|
"page": "/agents",
|
|
621
|
-
"dataRouteRegex": "^/_next/data/
|
|
621
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents\\.json$"
|
|
622
622
|
},
|
|
623
623
|
{
|
|
624
624
|
"page": "/agents/[agentId]/chat",
|
|
625
625
|
"routeKeys": {
|
|
626
626
|
"nxtPagentId": "nxtPagentId"
|
|
627
627
|
},
|
|
628
|
-
"dataRouteRegex": "^/_next/data/
|
|
629
|
-
"namedDataRouteRegex": "^/_next/data/
|
|
628
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents/([^/]+?)/chat\\.json$",
|
|
629
|
+
"namedDataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents/(?<nxtPagentId>[^/]+?)/chat\\.json$"
|
|
630
630
|
},
|
|
631
631
|
{
|
|
632
632
|
"page": "/agents/[agentId]/memory",
|
|
633
633
|
"routeKeys": {
|
|
634
634
|
"nxtPagentId": "nxtPagentId"
|
|
635
635
|
},
|
|
636
|
-
"dataRouteRegex": "^/_next/data/
|
|
637
|
-
"namedDataRouteRegex": "^/_next/data/
|
|
636
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents/([^/]+?)/memory\\.json$",
|
|
637
|
+
"namedDataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents/(?<nxtPagentId>[^/]+?)/memory\\.json$"
|
|
638
638
|
},
|
|
639
639
|
{
|
|
640
640
|
"page": "/agents/[agentId]/workspace",
|
|
641
641
|
"routeKeys": {
|
|
642
642
|
"nxtPagentId": "nxtPagentId"
|
|
643
643
|
},
|
|
644
|
-
"dataRouteRegex": "^/_next/data/
|
|
645
|
-
"namedDataRouteRegex": "^/_next/data/
|
|
644
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents/([^/]+?)/workspace\\.json$",
|
|
645
|
+
"namedDataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/agents/(?<nxtPagentId>[^/]+?)/workspace\\.json$"
|
|
646
646
|
},
|
|
647
647
|
{
|
|
648
648
|
"page": "/login",
|
|
649
|
-
"dataRouteRegex": "^/_next/data/
|
|
649
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/login\\.json$"
|
|
650
650
|
},
|
|
651
651
|
{
|
|
652
652
|
"page": "/reports",
|
|
653
|
-
"dataRouteRegex": "^/_next/data/
|
|
653
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/reports\\.json$"
|
|
654
654
|
},
|
|
655
655
|
{
|
|
656
656
|
"page": "/reset",
|
|
657
|
-
"dataRouteRegex": "^/_next/data/
|
|
657
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/reset\\.json$"
|
|
658
658
|
},
|
|
659
659
|
{
|
|
660
660
|
"page": "/stats",
|
|
661
|
-
"dataRouteRegex": "^/_next/data/
|
|
661
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/stats\\.json$"
|
|
662
662
|
},
|
|
663
663
|
{
|
|
664
664
|
"page": "/tools-required",
|
|
665
|
-
"dataRouteRegex": "^/_next/data/
|
|
665
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/tools-required\\.json$"
|
|
666
666
|
},
|
|
667
667
|
{
|
|
668
668
|
"page": "/webview",
|
|
669
|
-
"dataRouteRegex": "^/_next/data/
|
|
669
|
+
"dataRouteRegex": "^/_next/data/mG4eqGEgMBuU5tAi2sxtl/webview\\.json$"
|
|
670
670
|
}
|
|
671
671
|
],
|
|
672
672
|
"i18n": {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[845994,e=>{"use strict";var t=e.i(924868),a=e.i(814747),r=e.i(446786),
|
|
1
|
+
module.exports=[845994,e=>{"use strict";var t=e.i(924868),a=e.i(814747),r=e.i(446786),s=e.i(254799),i=e.i(666126);(0,e.i(25146).createLogger)("config");let n=a.default.join(r.default.homedir(),".purplemux"),o=a.default.join(n,"config.json"),l=globalThis;l.__ptConfigLock||(l.__ptConfigLock=Promise.resolve());let u=async e=>{let t,a=new Promise(e=>{t=e}),r=l.__ptConfigLock;l.__ptConfigLock=a,await r;try{return await e()}finally{t()}},d=()=>({updatedAt:new Date().toISOString()}),p=async()=>{try{let e=await t.default.readFile(o,"utf-8");return JSON.parse(e)}catch{return null}},c=async e=>{let{updatedAt:a,...r}=e,s=JSON.stringify(r);if(l.__ptConfigContentCache===s)return;e.updatedAt=new Date().toISOString();let n=o+".tmp";try{await t.default.writeFile(n,JSON.stringify(e,null,2),{mode:384}),await t.default.rename(n,o)}catch(e){throw await t.default.unlink(n).catch(()=>{}),e}l.__ptConfigContentCache=s,(0,i.broadcastSync)({type:"config"})},f=async e=>{let t=s.default.randomBytes(16),a=await new Promise((a,r)=>{s.default.scrypt(e,t,64,(e,t)=>{e?r(e):a(t)})});return`scrypt:${t.toString("hex")}:${a.toString("hex")}`},g=async(e,t)=>{if(!t.startsWith("scrypt:"))return!1;let[,a,r]=t.split(":"),i=Buffer.from(a,"hex"),n=Buffer.from(r,"hex"),o=await new Promise((t,a)=>{s.default.scrypt(e,i,n.length,(e,r)=>{e?a(e):t(r)})});return s.default.timingSafeEqual(o,n)},y=async()=>await p()??d(),m=async e=>u(async()=>{let t=await p()??d();Object.assign(t,e),await c(t)}),w=async()=>{let e=await p();return!e?.authPassword||!e.authPassword.startsWith("scrypt:")},h=async()=>{let e=await p();return e?.dangerouslySkipPermissions??!1};e.s(["generateSecret",0,()=>s.default.randomBytes(32).toString("hex"),"getConfig",0,y,"getDangerouslySkipPermissions",0,h,"hashPassword",0,f,"needsSetup",0,w,"updateConfig",0,m,"verifyPassword",0,g])},478490,e=>{"use strict";var t=e.i(845994),a=e.i(578331);let r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,s=e=>"string"==typeof e&&r.test(e),i=async e=>{if(!s(e))throw Error(`Invalid session ID format: ${e}`);let r=await (0,t.getDangerouslySkipPermissions)(),i=`--settings ${a.HOOK_SETTINGS_PATH}`;return r?`claude --resume ${e} ${i} --dangerously-skip-permissions`:`claude --resume ${e} ${i}`};e.s(["buildResumeCommand",0,i,"isValidSessionId",0,s])},667250,e=>{"use strict";var t=e.i(926747),a=e.i(190406),r=e.i(244898),s=e.i(262950),i=e.i(825265),n=e.i(322429),o=e.i(964759),l=e.i(478490),u=e.i(459015);let d=(0,e.i(25146).createLogger)("layout"),p=async(e,t)=>{if("POST"!==e.method)return t.setHeader("Allow","POST"),t.status(405).json({error:"Method not allowed"});let a=e.query.workspace||await (0,n.getActiveWorkspaceId)();if(!a)return t.status(400).json({error:"No workspace found"});let r=e.query.paneId,{name:s,cwd:p,panelType:c,command:f,resumeSessionId:g}=e.body??{};if(g&&!(0,l.isValidSessionId)(g))return t.status(400).json({error:"Invalid session ID format"});try{let e=await (0,i.addTabToPane)(a,r,s,p,c,f);if(!e)return t.status(404).json({error:"Pane not found"});return"web-browser"!==e.panelType&&(0,o.getStatusManager)().registerTab(e.id,{cliState:"inactive",workspaceId:a,tabName:e.name,tmuxSession:e.sessionName,lastEvent:null,eventSeq:0}),g&&!f&&(await (0,i.updateTabClaudeSessionId)(e.sessionName,g),e.claudeSessionId=g,setTimeout(async()=>{try{let t=await (0,l.buildResumeCommand)(g);await (0,u.sendKeys)(e.sessionName,t)}catch(e){d.warn(`resume sendKeys failed: ${e instanceof Error?e.message:e}`)}},500)),t.status(200).json(e)}catch(e){return d.error(`tab creation failed: ${e instanceof Error?e.message:e}`),t.status(500).json({error:"Failed to create tab"})}};e.s(["default",0,p],170096);var c=e.i(170096),f=e.i(7031),g=e.i(181927),y=e.i(846432);let m=(0,s.hoist)(c,"default"),w=(0,s.hoist)(c,"config"),h=new r.PagesAPIRouteModule({definition:{kind:a.RouteKind.PAGES_API,page:"/api/layout/pane/[paneId]/tabs/index",pathname:"/api/layout/pane/[paneId]/tabs",bundlePath:"",filename:""},userland:c,distDir:".next",relativeProjectDir:""});async function S(e,a,r){r.requestMeta&&(0,y.setRequestMeta)(e,r.requestMeta),h.isDev&&(0,y.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let s="/api/layout/pane/[paneId]/tabs/index";s=s.replace(/\/index$/,"")||"/";let i=await h.prepare(e,a,{srcPage:s});if(!i){a.statusCode=400,a.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve());return}let{query:n,params:o,prerenderManifest:l,routerServerContext:u}=i;try{let t,r=e.method||"GET",i=(0,f.getTracer)(),d=i.getActiveScopeSpan(),p=!!(null==u?void 0:u.isWrappedByNextServer),c=h.instrumentationOnRequestError.bind(h),y=async d=>h.render(e,a,{query:{...n,...o},params:o,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:l.preview,propagateError:!1,dev:h.isDev,page:"/api/layout/pane/[paneId]/tabs/index",internalRevalidate:null==u?void 0:u.revalidate,onError:(...t)=>c(e,...t)}).finally(()=>{if(!d)return;d.setAttributes({"http.status_code":a.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=`${r} ${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(`${r} ${s}`)});p&&d?await y(d):(t=i.getActiveScopeSpan(),await i.withPropagatedContext(e.headers,()=>i.trace(g.BaseServerSpan.handleRequest,{spanName:`${r} ${s}`,kind:f.SpanKind.SERVER,attributes:{"http.method":r,"http.target":e.url}},y),void 0,!p))}catch(e){if(h.isDev)throw e;(0,t.sendError)(a,500,"Internal Server Error")}finally{null==r.waitUntil||r.waitUntil.call(r,Promise.resolve())}}e.s(["config",0,w,"default",0,m,"handler",0,S],667250)},981532,e=>{e.v(e=>Promise.resolve().then(()=>e(322429)))}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=_04vmy2-._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[727130,e=>{"use strict";var t=e.i(926747),a=e.i(190406),r=e.i(244898),n=e.i(262950),s=e.i(459015),i=e.i(143511);let
|
|
1
|
+
module.exports=[727130,e=>{"use strict";var t=e.i(926747),a=e.i(190406),r=e.i(244898),n=e.i(262950),s=e.i(459015),i=e.i(143511);let l=async(e,t)=>{if("GET"!==e.method)return t.setHeader("Allow","GET"),t.status(405).json({error:"Method not allowed"});let a=e.query.session;if(!a)return t.status(400).json({error:"session parameter required"});let r=Date.now();if(!await (0,s.hasSession)(a))return t.status(200).json({running:!1,checkedAt:r,sessionId:null});let n=await (0,s.getSessionPanePid)(a);if(!n)return t.status(200).json({running:!1,checkedAt:r,sessionId:null});let l=await (0,i.getChildPids)(n);if(!await (0,i.isClaudeRunning)(n,l))return t.status(200).json({running:!1,checkedAt:r,sessionId:null});let o=await (0,i.detectActiveSession)(n,l);return t.status(200).json({running:!0,checkedAt:r,sessionId:o.sessionId,resumable:!!o.jsonlPath})};e.s(["default",0,l],102649);var o=e.i(102649),u=e.i(7031),d=e.i(181927),p=e.i(846432);let c=(0,n.hoist)(o,"default"),h=(0,n.hoist)(o,"config"),v=new r.PagesAPIRouteModule({definition:{kind:a.RouteKind.PAGES_API,page:"/api/check-claude",pathname:"/api/check-claude",bundlePath:"",filename:""},userland:o,distDir:".next",relativeProjectDir:""});async function g(e,a,r){r.requestMeta&&(0,p.setRequestMeta)(e,r.requestMeta),v.isDev&&(0,p.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let n="/api/check-claude";n=n.replace(/\/index$/,"")||"/";let s=await v.prepare(e,a,{srcPage:n});if(!s){a.statusCode=400,a.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve());return}let{query:i,params:l,prerenderManifest:o,routerServerContext:c}=s;try{let t,r=e.method||"GET",s=(0,u.getTracer)(),p=s.getActiveScopeSpan(),h=!!(null==c?void 0:c.isWrappedByNextServer),g=v.instrumentationOnRequestError.bind(v),f=async u=>v.render(e,a,{query:{...i,...l},params:l,allowedRevalidateHeaderKeys:[],multiZoneDraftMode:!1,trustHostHeader:!1,previewProps:o.preview,propagateError:!1,dev:v.isDev,page:"/api/check-claude",internalRevalidate:null==c?void 0:c.revalidate,onError:(...t)=>g(e,...t)}).finally(()=>{if(!u)return;u.setAttributes({"http.status_code":a.statusCode,"next.rsc":!1});let e=s.getRootSpanAttributes();if(!e)return;if(e.get("next.span_type")!==d.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 i=e.get("next.route");if(i){let e=`${r} ${i}`;u.setAttributes({"next.route":i,"http.route":i,"next.span_name":e}),u.updateName(e),t&&t!==u&&(t.setAttribute("http.route",i),t.updateName(e))}else u.updateName(`${r} ${n}`)});h&&p?await f(p):(t=s.getActiveScopeSpan(),await s.withPropagatedContext(e.headers,()=>s.trace(d.BaseServerSpan.handleRequest,{spanName:`${r} ${n}`,kind:u.SpanKind.SERVER,attributes:{"http.method":r,"http.target":e.url}},f),void 0,!h))}catch(e){if(v.isDev)throw e;(0,t.sendError)(a,500,"Internal Server Error")}finally{null==r.waitUntil||r.waitUntil.call(r,Promise.resolve())}}e.s(["config",0,h,"default",0,c,"handler",0,g],727130)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=node_modules_next_dist_esm_build_templates_pages-api_0qhmds_.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[825265,804767,e=>{"use strict";var t=e.i(924868),a=e.i(814747),n=e.i(446786),r=e.i(44014),i=e.i(459015),l=e.i(666126),o=e.i(25146);let s=e=>"pane"===e.type?[e]:[...s(e.children[0]),...s(e.children[1])],d=e=>s(e).flatMap(e=>e.tabs),c=(e,t)=>"pane"===e.type?e.id===t?e:null:c(e.children[0],t)||c(e.children[1],t),u=e=>"pane"===e.type?e.id:u(e.children[0]),p=e=>"pane"===e.type?e.id:p(e.children[1]),y=(e,t,a)=>"pane"===e.type?e.id===t?a:e:{...e,children:[y(e.children[0],t,a),y(e.children[1],t,a)]},w=(e,t)=>{if("pane"===e.type)return null;let[a,n]=e.children;if("pane"===a.type&&a.id===t)return n;if("pane"===n.type&&n.id===t)return a;let r=w(a,t);if(r)return{...e,children:[r,n]};let i=w(n,t);return i?{...e,children:[a,i]}:null},f=(e,t)=>{if("pane"===e.type)return null;let[a,n]=e.children;return"pane"===a.type&&a.id===t?u(n):"pane"===n.type&&n.id===t?p(a):f(a,t)||f(n,t)},b=(e,t)=>{let a=f(e.root,t),n=w(e.root,t);n&&(e.root=n),e.activePaneId===t&&(e.activePaneId=a??s(e.root)[0]?.id??null)},h=(e,t,a)=>{if("split"!==e.type)return e;if(0===t.length)return{...e,ratio:a};let[n,...r]=t,i=[e.children[0],e.children[1]];return i[n]=h(e.children[n],r,a),{...e,children:i}},m=(e,t)=>"pane"===e.type||e.orientation!==t?1:m(e.children[0],t)+m(e.children[1],t),I=e=>{if("pane"===e.type)return!0;let t=m(e.children[0],e.orientation),a=m(e.children[1],e.orientation);return!(Math.abs(e.ratio-t/(t+a)*100)>1)&&I(e.children[0])&&I(e.children[1])},v=e=>{if("pane"===e.type)return e;let t=m(e.children[0],e.orientation),a=Math.round(t/(t+m(e.children[1],e.orientation))*1e4)/100;return{...e,ratio:a,children:[v(e.children[0]),v(e.children[1])]}};e.s(["collectAllTabs",0,d,"collectPanes",0,s,"equalizeNode",0,v,"findPane",0,c,"isEqualized",0,I,"removePaneWithFocus",0,b,"replacePane",0,y,"updateRatioAtPath",0,h],804767);let S=(0,o.createLogger)("layout"),T=a.default.join(n.default.homedir(),".purplemux"),P=globalThis;P.__ptLayoutLock||(P.__ptLayoutLock=Promise.resolve()),P.__ptLayoutContentCache||(P.__ptLayoutContentCache=new Map),void 0===P.__ptLayoutReconciler&&(P.__ptLayoutReconciler=null);let g=async e=>{let t,a=new Promise(e=>{t=e}),n=P.__ptLayoutLock;P.__ptLayoutLock=a,await n;try{return await e()}finally{t()}},L=()=>`pane-${(0,r.nanoid)(6)}`,_=()=>`tab-${(0,r.nanoid)(6)}`,N=e=>a.default.join(T,"workspaces",e),k=e=>a.default.join(N(e),"layout.json"),C=(e,t)=>{let a=L(),n=((e,t,a=0,n)=>{let r=_(),l={id:r,sessionName:(0,i.workspaceSessionName)(e,t,r),name:"",order:a};return n&&(l.cwd=n),l})(e,a,0,t);return{pane:{type:"pane",id:a,tabs:[n],activeTabId:n.id},tab:n}},A=async e=>{let a;try{a=await t.default.readFile(e,"utf-8")}catch{return null}try{return JSON.parse(a)}catch{S.warn(`${e} parse failed`);try{await t.default.copyFile(e,e.replace(/\.json$/,".json.bak"))}catch{}return null}},O=async(e,n)=>{let r,i=JSON.stringify({root:e.root,activePaneId:e.activePaneId}),o=P.__ptLayoutContentCache;if(o.get(n)===i)return;await t.default.mkdir(a.default.dirname(n),{recursive:!0});let s=n+".tmp";try{await t.default.writeFile(s,JSON.stringify(e,null,2),{mode:384}),await t.default.rename(s,n)}catch(e){throw await t.default.unlink(s).catch(()=>{}),e}o.set(n,i);let c=(r=n.match(/workspaces\/(ws-[^/]+)\//),r?.[1]??null);if(c){let t=P.__ptLayoutReconciler;if(t){let a=d(e.root).map(e=>e.id);t.reconcileWorkspaceTabs(c,a)}(0,l.broadcastSync)({type:"layout",workspaceId:c})}},D=async e=>{await t.default.rm(N(e),{recursive:!0,force:!0}),F(e);let a=P.__ptLayoutReconciler;a&&a.removeWorkspaceTabs(e),(0,l.broadcastSync)({type:"layout",workspaceId:e})},F=e=>{let t=k(e);P.__ptLayoutContentCache.delete(t)},M=(t,a)=>{let n=[...new Set(d(a).map(e=>e.cwd).filter(e=>!!e))];n.length>0&&e.A(981532).then(({updateWorkspaceDirectories:e})=>{e(t,n).catch(()=>{})}).catch(()=>{})},R=async(e,t,a,n)=>{let r=!1,l=new Set(t),o=s(e.root),d=new Set;for(let e of o)for(let t of e.tabs)if("web-browser"!==t.panelType&&(d.add(t.sessionName),!l.has(t.sessionName)&&"claude-code"===t.panelType)){let e=t.cwd||n;S.debug(`crossCheck: Claude tab session recreated: ${t.sessionName} (cwd: ${e})`),await (0,i.createSession)(t.sessionName,80,24,e),r=!0}let c=t.filter(e=>!d.has(e));if(c.length>0){r=!0;let e=o[0];if(e){let t=e.tabs.length>0?Math.max(...e.tabs.map(e=>e.order)):-1;for(let a of c)t++,e.tabs.push({id:_(),sessionName:a,name:"",order:t});!e.activeTabId&&e.tabs.length>0&&(e.activeTabId=e.tabs[0].id)}}if(r){e.updatedAt=new Date().toISOString();let t=s(e.root);e.activePaneId&&!t.some(t=>t.id===e.activePaneId)&&(e.activePaneId=t[0]?.id??null)}return r},$=async(e,t,a)=>{let{pane:n,tab:r}=C(e,t);return a?.panelType&&(r.panelType=a.panelType),await (0,i.createSession)(r.sessionName,80,24,t),{root:n,activePaneId:n.id,updatedAt:new Date().toISOString()}},j=async(e,t)=>g(async()=>{let a=k(e),n=await A(a);if(n)return n;let{pane:r,tab:l}=C(e,t);await (0,i.createSession)(l.sessionName,80,24,t);let o={root:r,activePaneId:r.id,updatedAt:new Date().toISOString()};return await O(o,a),o}),x=async(e,t)=>{let a=L(),n=_(),r=(0,i.workspaceSessionName)(e,a,n);return await (0,i.createSession)(r,80,24,t),{paneId:a,tab:{id:n,sessionName:r,name:"",order:0,...t?{cwd:t}:{}}}},U=async(e,t=[])=>{for(let e of t)try{await (0,i.killSession)(e)}catch{}},W=async(e,t,a,n,r,l)=>g(async()=>{let o=k(e),d=await A(o);if(!d)return null;let c=s(d.root).find(e=>e.id===t);if(!c)return null;let u="web-browser"===r,p=_(),y=(0,i.workspaceSessionName)(e,t,p);!u&&(await (0,i.createSession)(y,80,24,n),l&&await (0,i.sendKeys)(y,l));let w=c.tabs.length>0?Math.max(...c.tabs.map(e=>e.order))+1:0,f={id:p,sessionName:y,name:a?.trim()||(u?"Web Browser":""),order:w,...n?{cwd:n}:{},...r?{panelType:r}:{}};return c.tabs.push(f),c.activeTabId=p,d.updatedAt=new Date().toISOString(),await O(d,o),M(e,d.root),f}),E=async(e,t,a)=>{let n=await g(async()=>{let n=k(e),r=await A(n);if(!r)return null;let i=s(r.root).find(e=>e.id===t);if(!i)return null;let l=i.tabs.find(e=>e.id===a);return l?{sessionName:l.sessionName,panelType:l.panelType}:null});return!!n&&("web-browser"!==n.panelType&&await (0,i.killSession)(n.sessionName),g(async()=>{let n=k(e),r=await A(n);if(!r)return!1;let i=s(r.root).find(e=>e.id===t);if(!i)return!1;let l=i.tabs.findIndex(e=>e.id===a);return -1!==l&&(i.tabs.splice(l,1),i.activeTabId===a&&(i.activeTabId=i.tabs[0]?.id??null),0===i.tabs.length&&s(r.root).length>1&&b(r,t),i.tabs.forEach((e,t)=>{e.order=t}),r.updatedAt=new Date().toISOString(),await O(r,n),M(e,r.root),!0)}))},q=async(e,t,a,n)=>g(async()=>{let r=k(e),l=await A(r);if(!l)return!1;let o=s(l.root).find(e=>e.id===t);if(!o)return!1;let d=o.tabs.find(e=>e.id===a);return!!d&&(!!await (0,i.hasSession)(d.sessionName)||(await (0,i.createSession)(d.sessionName,80,24,d.cwd),n&&await (0,i.sendKeys)(d.sessionName,n),!0))}),z=e=>{let t=e.match(/^pt-(ws-.*?)-(pane-.*?)-(tab-.+)$/);return t?{wsId:t[1],paneId:t[2],tabId:t[3]}:null},B=async(e,t)=>{let a=z(e);a&&await g(async()=>{let n=k(a.wsId),r=await A(n);if(!r)return;let i=d(r.root).find(t=>t.sessionName===e);i&&i.claudeSummary!==t&&(i.claudeSummary=t,r.updatedAt=new Date().toISOString(),await O(r,n))})},J=async(e,t,a)=>{let n=z(e);n&&await g(async()=>{let r=k(n.wsId),i=await A(r);if(!i)return;let l=d(i.root).find(t=>t.sessionName===e);l&&(l.cliState!==t||l.dismissedAt!==a)&&(l.cliState=t,l.dismissedAt=a,i.updatedAt=new Date().toISOString(),await O(i,r))})},K=async(e,t)=>g(async()=>{let a=k(e),n=await A(a);if(!n)return null;let r=t(n);return r?(r.updatedAt=new Date().toISOString(),await O(r,a),M(e,r.root),r):null}),G=async(e,t)=>K(e,e=>{if(void 0!==t.activePaneId){if(!c(e.root,t.activePaneId))return null;e.activePaneId=t.activePaneId}return t.ratioUpdate&&(e.root=h(e.root,t.ratioUpdate.path,t.ratioUpdate.ratio)),t.equalize&&(e.root=v(e.root)),e}),H=async(e,t,a)=>K(e,e=>{let n=c(e.root,t);if(!n)return null;if(void 0!==a.activeTabId){if(!n.tabs.some(e=>e.id===a.activeTabId))return null;n.activeTabId=a.activeTabId}return e}),Q=async(e,t,a,n,r)=>{let l="web-browser"===r,o=L(),s=_(),d=(0,i.workspaceSessionName)(e,o,s);l||await (0,i.createSession)(d,80,24,n);let u={id:s,sessionName:d,name:l?"Web Browser":"",order:0,...n?{cwd:n}:{}};r&&(u.panelType=r);let p={type:"pane",id:o,tabs:[u],activeTabId:s},w=await K(e,e=>{let r=c(e.root,t);if(!r)return null;let i=I(e.root);if(n){let e=r.tabs.find(e=>e.id===r.activeTabId);e&&(e.cwd=n)}let l={type:"split",orientation:a,ratio:50,children:[{...r},p]};return e.root=y(e.root,t,l),i&&(e.root=v(e.root)),e.activePaneId=o,e});return w||l||await (0,i.killSession)(d).catch(()=>{}),w},V=async(e,t)=>{let a=[],n=await g(async()=>{let n=k(e),r=await A(n);if(!r)return null;let i=c(r.root,t);if(!i||s(r.root).length<=1)return null;a=i.tabs.filter(e=>"web-browser"!==e.panelType).map(e=>e.sessionName);let l=I(r.root);return b(r,t),l&&(r.root=v(r.root)),r.updatedAt=new Date().toISOString(),await O(r,n),M(e,r.root),r});return await Promise.all(a.map(e=>(0,i.killSession)(e).catch(()=>{}))),n},X=async(e,t,a)=>K(e,e=>{let n=c(e.root,t);if(!n)return null;let r=new Map(n.tabs.map(e=>[e.id,e])),i=a.map((e,t)=>{let a=r.get(e);return a?{...a,order:t}:null}).filter(e=>null!==e);return i.length!==n.tabs.length?null:(n.tabs=i,e)}),Y=async(e,t,a,n,r)=>K(e,e=>{let i=c(e.root,a),l=c(e.root,n);if(!i||!l)return null;let o=i.tabs.findIndex(e=>e.id===t);if(-1===o)return null;let[d]=i.tabs.splice(o,1);return i.activeTabId===t&&(i.activeTabId=i.tabs[0]?.id??null),i.tabs.forEach((e,t)=>{e.order=t}),l.tabs.splice(r,0,d),l.tabs.forEach((e,t)=>{e.order=t}),l.activeTabId=t,0===i.tabs.length&&s(e.root).length>1&&b(e,a),e.activePaneId=n,e}),Z=async(e,t,a,n)=>K(e,e=>{let r=c(e.root,t);if(!r)return null;let i=r.tabs.find(e=>e.id===a);return i?(void 0!==n.name&&(i.name=n.name),void 0!==n.panelType&&(i.panelType=n.panelType),void 0!==n.title&&(i.title=n.title),void 0!==n.cwd&&(i.cwd=n.cwd),void 0!==n.lastCommand&&(i.lastCommand=n.lastCommand),void 0!==n.webUrl&&(i.webUrl=n.webUrl),e):null});e.s(["addTabToPane",0,W,"closePaneInLayout",0,V,"createDefaultLayout",0,$,"createPane",0,x,"crossCheckLayout",0,R,"deletePane",0,U,"getLayout",0,j,"moveTabBetweenPanes",0,Y,"parseSessionName",0,z,"patchLayout",0,G,"patchPane",0,H,"patchTab",0,Z,"readLayoutFile",0,A,"removeLayoutFile",0,D,"removeTabFromPane",0,E,"reorderTabsInPane",0,X,"resolveLayoutDir",0,N,"resolveLayoutFile",0,k,"restartTabSession",0,q,"setLayoutReconciler",0,e=>{P.__ptLayoutReconciler=e},"splitPaneInLayout",0,Q,"updateTabClaudeSummary",0,B,"updateTabCliStatus",0,J,"writeLayoutFile",0,O],825265)}];
|
|
1
|
+
module.exports=[825265,804767,e=>{"use strict";var t=e.i(924868),a=e.i(814747),n=e.i(446786),r=e.i(44014),i=e.i(459015),l=e.i(666126),o=e.i(25146);let s=e=>"pane"===e.type?[e]:[...s(e.children[0]),...s(e.children[1])],d=e=>s(e).flatMap(e=>e.tabs),c=(e,t)=>"pane"===e.type?e.id===t?e:null:c(e.children[0],t)||c(e.children[1],t),u=e=>"pane"===e.type?e.id:u(e.children[0]),p=e=>"pane"===e.type?e.id:p(e.children[1]),y=(e,t,a)=>"pane"===e.type?e.id===t?a:e:{...e,children:[y(e.children[0],t,a),y(e.children[1],t,a)]},w=(e,t)=>{if("pane"===e.type)return null;let[a,n]=e.children;if("pane"===a.type&&a.id===t)return n;if("pane"===n.type&&n.id===t)return a;let r=w(a,t);if(r)return{...e,children:[r,n]};let i=w(n,t);return i?{...e,children:[a,i]}:null},f=(e,t)=>{if("pane"===e.type)return null;let[a,n]=e.children;return"pane"===a.type&&a.id===t?u(n):"pane"===n.type&&n.id===t?p(a):f(a,t)||f(n,t)},b=(e,t)=>{let a=f(e.root,t),n=w(e.root,t);n&&(e.root=n),e.activePaneId===t&&(e.activePaneId=a??s(e.root)[0]?.id??null)},h=(e,t,a)=>{if("split"!==e.type)return e;if(0===t.length)return{...e,ratio:a};let[n,...r]=t,i=[e.children[0],e.children[1]];return i[n]=h(e.children[n],r,a),{...e,children:i}},m=(e,t)=>"pane"===e.type||e.orientation!==t?1:m(e.children[0],t)+m(e.children[1],t),I=e=>{if("pane"===e.type)return!0;let t=m(e.children[0],e.orientation),a=m(e.children[1],e.orientation);return!(Math.abs(e.ratio-t/(t+a)*100)>1)&&I(e.children[0])&&I(e.children[1])},S=e=>{if("pane"===e.type)return e;let t=m(e.children[0],e.orientation),a=Math.round(t/(t+m(e.children[1],e.orientation))*1e4)/100;return{...e,ratio:a,children:[S(e.children[0]),S(e.children[1])]}};e.s(["collectAllTabs",0,d,"collectPanes",0,s,"equalizeNode",0,S,"findPane",0,c,"isEqualized",0,I,"removePaneWithFocus",0,b,"replacePane",0,y,"updateRatioAtPath",0,h],804767);let v=(0,o.createLogger)("layout"),T=a.default.join(n.default.homedir(),".purplemux"),g=globalThis;g.__ptLayoutLock||(g.__ptLayoutLock=Promise.resolve()),g.__ptLayoutContentCache||(g.__ptLayoutContentCache=new Map),void 0===g.__ptLayoutReconciler&&(g.__ptLayoutReconciler=null);let P=async e=>{let t,a=new Promise(e=>{t=e}),n=g.__ptLayoutLock;g.__ptLayoutLock=a,await n;try{return await e()}finally{t()}},L=()=>`pane-${(0,r.nanoid)(6)}`,N=()=>`tab-${(0,r.nanoid)(6)}`,_=e=>a.default.join(T,"workspaces",e),k=e=>a.default.join(_(e),"layout.json"),C=(e,t)=>{let a=L(),n=((e,t,a=0,n)=>{let r=N(),l={id:r,sessionName:(0,i.workspaceSessionName)(e,t,r),name:"",order:a};return n&&(l.cwd=n),l})(e,a,0,t);return{pane:{type:"pane",id:a,tabs:[n],activeTabId:n.id},tab:n}},A=async e=>{let a;try{a=await t.default.readFile(e,"utf-8")}catch{return null}try{return JSON.parse(a)}catch{v.warn(`${e} parse failed`);try{await t.default.copyFile(e,e.replace(/\.json$/,".json.bak"))}catch{}return null}},O=async(e,n)=>{let r,i=JSON.stringify({root:e.root,activePaneId:e.activePaneId}),o=g.__ptLayoutContentCache;if(o.get(n)===i)return;await t.default.mkdir(a.default.dirname(n),{recursive:!0});let s=n+".tmp";try{await t.default.writeFile(s,JSON.stringify(e,null,2),{mode:384}),await t.default.rename(s,n)}catch(e){throw await t.default.unlink(s).catch(()=>{}),e}o.set(n,i);let c=(r=n.match(/workspaces\/(ws-[^/]+)\//),r?.[1]??null);if(c){let t=g.__ptLayoutReconciler;if(t){let a=d(e.root).map(e=>e.id);t.reconcileWorkspaceTabs(c,a)}(0,l.broadcastSync)({type:"layout",workspaceId:c})}},D=async e=>{await t.default.rm(_(e),{recursive:!0,force:!0}),F(e);let a=g.__ptLayoutReconciler;a&&a.removeWorkspaceTabs(e),(0,l.broadcastSync)({type:"layout",workspaceId:e})},F=e=>{let t=k(e);g.__ptLayoutContentCache.delete(t)},M=(t,a)=>{let n=[...new Set(d(a).map(e=>e.cwd).filter(e=>!!e))];n.length>0&&e.A(981532).then(({updateWorkspaceDirectories:e})=>{e(t,n).catch(()=>{})}).catch(()=>{})},R=async(e,t,a,n)=>{let r=!1,l=new Set(t),o=s(e.root),d=new Set;for(let e of o)for(let t of e.tabs)if("web-browser"!==t.panelType&&(d.add(t.sessionName),!l.has(t.sessionName)&&"claude-code"===t.panelType)){let e=t.cwd||n;v.debug(`crossCheck: Claude tab session recreated: ${t.sessionName} (cwd: ${e})`),await (0,i.createSession)(t.sessionName,80,24,e),r=!0}let c=t.filter(e=>!d.has(e));if(c.length>0){r=!0;let e=o[0];if(e){let t=e.tabs.length>0?Math.max(...e.tabs.map(e=>e.order)):-1;for(let a of c)t++,e.tabs.push({id:N(),sessionName:a,name:"",order:t});!e.activeTabId&&e.tabs.length>0&&(e.activeTabId=e.tabs[0].id)}}if(r){e.updatedAt=new Date().toISOString();let t=s(e.root);e.activePaneId&&!t.some(t=>t.id===e.activePaneId)&&(e.activePaneId=t[0]?.id??null)}return r},$=async(e,t,a)=>{let{pane:n,tab:r}=C(e,t);return a?.panelType&&(r.panelType=a.panelType),await (0,i.createSession)(r.sessionName,80,24,t),{root:n,activePaneId:n.id,updatedAt:new Date().toISOString()}},j=async(e,t)=>P(async()=>{let a=k(e),n=await A(a);if(n)return n;let{pane:r,tab:l}=C(e,t);await (0,i.createSession)(l.sessionName,80,24,t);let o={root:r,activePaneId:r.id,updatedAt:new Date().toISOString()};return await O(o,a),o}),x=async(e,t)=>{let a=L(),n=N(),r=(0,i.workspaceSessionName)(e,a,n);return await (0,i.createSession)(r,80,24,t),{paneId:a,tab:{id:n,sessionName:r,name:"",order:0,...t?{cwd:t}:{}}}},U=async(e,t=[])=>{for(let e of t)try{await (0,i.killSession)(e)}catch{}},W=async(e,t,a,n,r,l)=>P(async()=>{let o=k(e),d=await A(o);if(!d)return null;let c=s(d.root).find(e=>e.id===t);if(!c)return null;let u="web-browser"===r,p=N(),y=(0,i.workspaceSessionName)(e,t,p);!u&&(await (0,i.createSession)(y,80,24,n),l&&await (0,i.sendKeys)(y,l));let w=c.tabs.length>0?Math.max(...c.tabs.map(e=>e.order))+1:0,f={id:p,sessionName:y,name:a?.trim()||(u?"Web Browser":""),order:w,...n?{cwd:n}:{},...r?{panelType:r}:{}};return c.tabs.push(f),c.activeTabId=p,d.updatedAt=new Date().toISOString(),await O(d,o),M(e,d.root),f}),E=async(e,t,a)=>{let n=await P(async()=>{let n=k(e),r=await A(n);if(!r)return null;let i=s(r.root).find(e=>e.id===t);if(!i)return null;let l=i.tabs.find(e=>e.id===a);return l?{sessionName:l.sessionName,panelType:l.panelType}:null});return!!n&&("web-browser"!==n.panelType&&await (0,i.killSession)(n.sessionName),P(async()=>{let n=k(e),r=await A(n);if(!r)return!1;let i=s(r.root).find(e=>e.id===t);if(!i)return!1;let l=i.tabs.findIndex(e=>e.id===a);return -1!==l&&(i.tabs.splice(l,1),i.activeTabId===a&&(i.activeTabId=i.tabs[0]?.id??null),0===i.tabs.length&&s(r.root).length>1&&b(r,t),i.tabs.forEach((e,t)=>{e.order=t}),r.updatedAt=new Date().toISOString(),await O(r,n),M(e,r.root),!0)}))},q=async(e,t,a,n)=>P(async()=>{let r=k(e),l=await A(r);if(!l)return!1;let o=s(l.root).find(e=>e.id===t);if(!o)return!1;let d=o.tabs.find(e=>e.id===a);return!!d&&(!!await (0,i.hasSession)(d.sessionName)||(await (0,i.createSession)(d.sessionName,80,24,d.cwd),n&&await (0,i.sendKeys)(d.sessionName,n),!0))}),z=e=>{let t=e.match(/^pt-(ws-.*?)-(pane-.*?)-(tab-.+)$/);return t?{wsId:t[1],paneId:t[2],tabId:t[3]}:null},B=async(e,t)=>{let a=z(e);a&&await P(async()=>{let n=k(a.wsId),r=await A(n);if(!r)return;let i=d(r.root).find(t=>t.sessionName===e);i&&(i.claudeSessionId=t,r.updatedAt=new Date().toISOString(),await O(r,n))})},J=async(e,t)=>{let a=z(e);a&&await P(async()=>{let n=k(a.wsId),r=await A(n);if(!r)return;let i=d(r.root).find(t=>t.sessionName===e);i&&i.claudeSummary!==t&&(i.claudeSummary=t,r.updatedAt=new Date().toISOString(),await O(r,n))})},K=async(e,t,a)=>{let n=z(e);n&&await P(async()=>{let r=k(n.wsId),i=await A(r);if(!i)return;let l=d(i.root).find(t=>t.sessionName===e);l&&(l.cliState!==t||l.dismissedAt!==a)&&(l.cliState=t,l.dismissedAt=a,i.updatedAt=new Date().toISOString(),await O(i,r))})},G=async(e,t)=>P(async()=>{let a=k(e),n=await A(a);if(!n)return null;let r=t(n);return r?(r.updatedAt=new Date().toISOString(),await O(r,a),M(e,r.root),r):null}),H=async(e,t)=>G(e,e=>{if(void 0!==t.activePaneId){if(!c(e.root,t.activePaneId))return null;e.activePaneId=t.activePaneId}return t.ratioUpdate&&(e.root=h(e.root,t.ratioUpdate.path,t.ratioUpdate.ratio)),t.equalize&&(e.root=S(e.root)),e}),Q=async(e,t,a)=>G(e,e=>{let n=c(e.root,t);if(!n)return null;if(void 0!==a.activeTabId){if(!n.tabs.some(e=>e.id===a.activeTabId))return null;n.activeTabId=a.activeTabId}return e}),V=async(e,t,a,n,r)=>{let l="web-browser"===r,o=L(),s=N(),d=(0,i.workspaceSessionName)(e,o,s);l||await (0,i.createSession)(d,80,24,n);let u={id:s,sessionName:d,name:l?"Web Browser":"",order:0,...n?{cwd:n}:{}};r&&(u.panelType=r);let p={type:"pane",id:o,tabs:[u],activeTabId:s},w=await G(e,e=>{let r=c(e.root,t);if(!r)return null;let i=I(e.root);if(n){let e=r.tabs.find(e=>e.id===r.activeTabId);e&&(e.cwd=n)}let l={type:"split",orientation:a,ratio:50,children:[{...r},p]};return e.root=y(e.root,t,l),i&&(e.root=S(e.root)),e.activePaneId=o,e});return w||l||await (0,i.killSession)(d).catch(()=>{}),w},X=async(e,t)=>{let a=[],n=await P(async()=>{let n=k(e),r=await A(n);if(!r)return null;let i=c(r.root,t);if(!i||s(r.root).length<=1)return null;a=i.tabs.filter(e=>"web-browser"!==e.panelType).map(e=>e.sessionName);let l=I(r.root);return b(r,t),l&&(r.root=S(r.root)),r.updatedAt=new Date().toISOString(),await O(r,n),M(e,r.root),r});return await Promise.all(a.map(e=>(0,i.killSession)(e).catch(()=>{}))),n},Y=async(e,t,a)=>G(e,e=>{let n=c(e.root,t);if(!n)return null;let r=new Map(n.tabs.map(e=>[e.id,e])),i=a.map((e,t)=>{let a=r.get(e);return a?{...a,order:t}:null}).filter(e=>null!==e);return i.length!==n.tabs.length?null:(n.tabs=i,e)}),Z=async(e,t,a,n,r)=>G(e,e=>{let i=c(e.root,a),l=c(e.root,n);if(!i||!l)return null;let o=i.tabs.findIndex(e=>e.id===t);if(-1===o)return null;let[d]=i.tabs.splice(o,1);return i.activeTabId===t&&(i.activeTabId=i.tabs[0]?.id??null),i.tabs.forEach((e,t)=>{e.order=t}),l.tabs.splice(r,0,d),l.tabs.forEach((e,t)=>{e.order=t}),l.activeTabId=t,0===i.tabs.length&&s(e.root).length>1&&b(e,a),e.activePaneId=n,e}),ee=async(e,t,a,n)=>G(e,e=>{let r=c(e.root,t);if(!r)return null;let i=r.tabs.find(e=>e.id===a);return i?(void 0!==n.name&&(i.name=n.name),void 0!==n.panelType&&(i.panelType=n.panelType),void 0!==n.title&&(i.title=n.title),void 0!==n.cwd&&(i.cwd=n.cwd),void 0!==n.lastCommand&&(i.lastCommand=n.lastCommand),void 0!==n.webUrl&&(i.webUrl=n.webUrl),e):null});e.s(["addTabToPane",0,W,"closePaneInLayout",0,X,"createDefaultLayout",0,$,"createPane",0,x,"crossCheckLayout",0,R,"deletePane",0,U,"getLayout",0,j,"moveTabBetweenPanes",0,Z,"parseSessionName",0,z,"patchLayout",0,H,"patchPane",0,Q,"patchTab",0,ee,"readLayoutFile",0,A,"removeLayoutFile",0,D,"removeTabFromPane",0,E,"reorderTabsInPane",0,Y,"resolveLayoutDir",0,_,"resolveLayoutFile",0,k,"restartTabSession",0,q,"setLayoutReconciler",0,e=>{g.__ptLayoutReconciler=e},"splitPaneInLayout",0,V,"updateTabClaudeSessionId",0,B,"updateTabClaudeSummary",0,J,"updateTabCliStatus",0,K,"writeLayoutFile",0,O],825265)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_lib_layout-store_ts_0fanx7c._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[964759,t=>{"use strict";t.i(478319);var e=t.i(220951),s=t.i(322429),a=t.i(825265),i=t.i(804767),n=t.i(459015),l=t.i(143511),r=t.i(746514);let o={bash:"",zsh:"",fish:"",sh:"",dash:"",tcsh:"",nu:"",nvim:"",vim:"",vi:"",nano:"",emacs:"",hx:"",code:"",git:"",gitui:"",tig:"",gh:"",lazygit:"",jj:"",lazyjj:"",node:"",deno:"",bun:"",python:"",python3:"",go:"",ruby:"",java:"",rust:"",rustc:"",cargo:"",swift:"",dart:"",elixir:"",perl:"",php:"",R:"",julia:"",scala:"",zig:"",npm:"",pnpm:"",yarn:"",pip:"",pip3:"",brew:"",apt:"",dnf:"",pacman:"",yay:"",paru:"",make:"",cmake:"",gradle:"",maven:"",webpack:"",tsc:"",docker:"",lazydocker:"",kubectl:"",k9s:"",helm:"",minikube:"",aws:"",gcloud:"",terraform:"",ansible:"",vagrant:"",ssh:"",scp:"",curl:"",wget:"",rsync:"",ping:"",htop:"",btop:"",top:"",btm:"",glances:"",mactop:"",ranger:"",yazi:"",lf:"",lfcd:"",mysql:"",psql:"",mongo:"",redis:"",sqlite:"",tmux:"",screen:"",sudo:"",bat:"",gpg:"",openssl:"",zip:"",unzip:"",jest:"",claude:"",codex:""},c=new Set(["node","python","python3","ruby","perl","deno","bun"]),u=new Set(["zsh","bash","fish","sh","-zsh","-bash","-fish","-sh"]),d=t=>{if("~"===t||"/"===t)return t;let e=t.replace(/\/$/,"").split("/");return e[e.length-1]||t},p=t=>{let e=t.trim();if(!e)return"";let s=(t=>{let e=t.trim();if(!e)return null;let s=e.indexOf("|");return s>0?e.slice(0,s):null})(t);if(null!==s){let t=e.slice(e.indexOf("|")+1);return u.has(s)?d(t):s}let a=e.match(/@[^:]+:\s*(.*)/);if(a)return d(a[1].trim());if(e.startsWith("/")||e.startsWith("~"))return d(e);let i=e.split(/\s+/)[0];return u.has(i)?"":i||""};var h=t.i(840665),m=t.i(522734),y=t.i(924868),g=t.i(25146),f=t.i(796902);let S=(0,g.createLogger)("rate-limits");var b=t.i(971780),w=t.i(443571),T=t.i(814747),A=t.i(446786);let v=(0,g.createLogger)("session-history"),k=T.default.join(A.default.homedir(),".purplemux"),P=T.default.join(k,"session-history.json"),M=globalThis;M.__purplemuxSessionHistoryLock||(M.__purplemuxSessionHistoryLock=Promise.resolve());let I=async t=>{let e,s=new Promise(t=>{e=t}),a=M.__purplemuxSessionHistoryLock;M.__purplemuxSessionHistoryLock=s,await a;try{return await t()}finally{e()}},j=()=>({version:1,entries:[]}),U=async()=>{let t;try{t=await y.default.readFile(P,"utf-8")}catch{return j()}try{return JSON.parse(t)}catch{v.warn("Failed to parse session-history.json, starting empty");try{await y.default.copyFile(P,P.replace(/\.json$/,".json.bak"))}catch{}return j()}},W=async t=>{let e=JSON.stringify(t.entries);if(M.__purplemuxSessionHistoryContentCache===e)return;let s=P+".tmp";try{await y.default.writeFile(s,JSON.stringify(t,null,2),{mode:384}),await y.default.rename(s,P)}catch(t){throw await y.default.unlink(s).catch(()=>{}),t}M.__purplemuxSessionHistoryContentCache=e},E=async t=>{await I(async()=>{let e=await U();e.entries.unshift(t),e.entries.length>200&&(e.entries=e.entries.slice(0,200)),await W(e)})},L=async(t,e)=>await I(async()=>{let s=await U(),a=s.entries.find(e=>e.tabId===t&&null===e.dismissedAt);return a?(a.dismissedAt=e,await W(s),a):null});var x=t.i(157469),R=t.i(75874),N=t.i(228448),_=t.i(44014);let C=(0,g.createLogger)("status"),F=(0,g.createLogger)("hooks"),J=t=>t?T.default.basename(t,".jsonl"):null,z=new Set(["permission_prompt","worker_permission_prompt"]),D=new Map,q=t=>{let e=t.name??"Tool",s=t.input??{};return{toolName:e,summary:(0,h.summarizeToolCall)(e,s)}},O=t=>{let e=!1;for(let s=t.length-1;s>=0;s--)try{let a=JSON.parse(t[s]);if(a.isSidechain)continue;if("user"===a.type){let t=a.message?.content;Array.isArray(t)&&t.some(t=>"tool_result"===t.type)||(e=!0);continue}if("assistant"!==a.type||!a.message?.content)continue;if(e)return{lastAssistantSnippet:null,currentAction:null,reset:!0};let i=a.message.content;if(!Array.isArray(i))continue;let n=null,l=null;for(let t=i.length-1;t>=0;t--){let e=i[t];if("tool_use"===e.type){l=q(e);break}if("text"===e.type&&e.text?.trim()){let t=e.text.trim();l={toolName:null,summary:t.length>200?t.slice(0,200)+"…":t};break}}for(let t=i.length-1;t>=0;t--)if("text"===i[t].type&&i[t].text?.trim()){let e=i[t].text.trim();n=e.length>200?e.slice(0,200)+"…":e;break}return{lastAssistantSnippet:n,currentAction:l,reset:!1}}catch{continue}return{lastAssistantSnippet:null,currentAction:null,reset:!1}},$=(t,e)=>{for(let s=t.length-1;s>=0;s--)try{let a=JSON.parse(t[s]);if(a.isSidechain)continue;let i=a.timestamp?new Date(a.timestamp).getTime():null;if("system"===a.type&&("stop_hook_summary"===a.subtype||"turn_duration"===a.subtype))return{matched:!0,idle:!0,stale:!1,needsStaleRecheck:!1,staleMs:0,lastEntryTs:i,interrupted:!1};if("assistant"===a.type){let t=a.message?.stop_reason;if(!t){let t=e>2e4;return{matched:!0,idle:t,stale:!0,needsStaleRecheck:!t,staleMs:2e4,lastEntryTs:i,interrupted:!1}}return{matched:!0,idle:"tool_use"!==t,stale:!1,needsStaleRecheck:!1,staleMs:0,lastEntryTs:i,interrupted:!1}}if("user"===a.type){let t=a.message?.content;if(Array.isArray(t)&&1===t.length&&"string"==typeof t[0]?.text&&t[0].text.startsWith(h.INTERRUPT_PREFIX))return{matched:!0,idle:!0,stale:!1,needsStaleRecheck:!1,staleMs:0,lastEntryTs:i,interrupted:!0};let s=e>9e4;return{matched:!0,idle:s,stale:!0,needsStaleRecheck:!s,staleMs:9e4,lastEntryTs:i,interrupted:!1}}}catch{continue}return{matched:!1,idle:e>9e4,stale:!0,needsStaleRecheck:e<=9e4,staleMs:9e4,lastEntryTs:null,interrupted:!1}},H=async t=>{try{let e=await y.default.stat(t);if(0===e.size)return{idle:!0,stale:!1,lastAssistantSnippet:null,currentAction:null,reset:!1,lastEntryTs:null,staleMs:0,interrupted:!1};let s=D.get(t);if(s&&s.mtimeMs===e.mtimeMs){if(D.delete(t),D.set(t,s),s.idle)return{idle:!0,stale:s.stale,lastAssistantSnippet:s.lastAssistantSnippet,currentAction:s.currentAction,reset:s.reset,lastEntryTs:s.lastEntryTs,staleMs:s.staleMs,interrupted:s.interrupted};if(s.needsStaleRecheck)return{idle:Date.now()-e.mtimeMs>s.staleMs,stale:!0,lastAssistantSnippet:s.lastAssistantSnippet,currentAction:s.currentAction,reset:s.reset,lastEntryTs:s.lastEntryTs,staleMs:s.staleMs,interrupted:s.interrupted};return{idle:!1,stale:!1,lastAssistantSnippet:s.lastAssistantSnippet,currentAction:s.currentAction,reset:s.reset,lastEntryTs:s.lastEntryTs,staleMs:s.staleMs,interrupted:s.interrupted}}let a=await y.default.open(t,"r");try{let s=Date.now()-e.mtimeMs,i=Math.min(e.size,8192),n=Buffer.alloc(i);await a.read(n,0,i,e.size-i);let l=n.toString("utf-8").split("\n").filter(t=>t.trim()),r=$(l,s),o=O(l);if(!r.matched&&e.size>8192){let t=Math.min(e.size,131072),i=Buffer.alloc(t);await a.read(i,0,t,e.size-t);let n=i.toString("utf-8").split("\n").filter(t=>t.trim());r=$(n,s),o.lastAssistantSnippet||o.currentAction||(o=O(n))}return D.size>=256&&D.delete(D.keys().next().value),D.set(t,{mtimeMs:e.mtimeMs,idle:r.idle,stale:r.stale,needsStaleRecheck:r.needsStaleRecheck,staleMs:r.staleMs,lastAssistantSnippet:o.lastAssistantSnippet,currentAction:o.currentAction,reset:o.reset,lastEntryTs:r.lastEntryTs,interrupted:r.interrupted}),{idle:r.idle,stale:r.stale,lastAssistantSnippet:o.lastAssistantSnippet,currentAction:o.currentAction,reset:o.reset,lastEntryTs:r.lastEntryTs,staleMs:r.staleMs,interrupted:r.interrupted}}finally{await a.close()}}catch{return{idle:!1,stale:!1,lastAssistantSnippet:null,currentAction:null,reset:!1,lastEntryTs:null,staleMs:0,interrupted:!1}}},B=async t=>{let e={toolUsage:{},touchedFiles:[],lastAssistantText:null,lastUserText:null,firstUserTs:null,lastAssistantTs:null,turnDurationMs:null};try{let s=await y.default.stat(t);if(0===s.size)return e;let a=await y.default.open(t,"r");try{let t=Math.min(s.size,131072),e=Buffer.alloc(t);await a.read(e,0,t,s.size-t);let i=e.toString("utf-8").split("\n").filter(t=>t.trim()),n={},l=new Set,r=null,o=null,c=null,u=null,d=null;for(let t=i.length-1;t>=0;t--)try{let e=JSON.parse(i[t]);if("file-history-snapshot"===e.type)break;if(e.isSidechain)continue;"system"!==e.type||"turn_duration"!==e.subtype||"number"!=typeof e.durationMs||d||(d=e.durationMs);let s=e.timestamp?new Date(e.timestamp).getTime():null;if("user"===e.type&&(s&&(u=s),!o&&Array.isArray(e.message?.content))){for(let t of e.message.content)if("text"===t.type&&t.text){o=t.text;break}}if("assistant"===e.type&&(s&&!c&&(c=s),Array.isArray(e.message?.content))){let t=null;for(let s of e.message.content)"tool_use"===s.type&&s.name&&(n[s.name]=(n[s.name]??0)+1,("Edit"===s.name||"Write"===s.name)&&s.input?.file_path&&l.add(String(s.input.file_path))),"text"===s.type&&s.text&&(t=s.text);!r&&t&&(r=t)}}catch{continue}return{toolUsage:n,touchedFiles:[...l],lastAssistantText:r,lastUserText:o,firstUserTs:u,lastAssistantTs:c,turnDurationMs:d}}finally{await a.close()}}catch{return e}},K=/^[✳⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠐⠈]\s+/,V=t=>t&&K.test(t)&&t.replace(K,"").trim()||null,X=globalThis;class G{tabs=new Map;pollingTimer=null;currentInterval=0;clients=new Set;initialized=!1;rateLimitsWatcher=null;lastRateLimits=null;jsonlWatchers=new Map;compactStaleTimers=new Map;async init(){if(!this.initialized){var t;let e,s,a,i,n,l;this.initialized=!0,await this.scanAll(),this.startPolling(),this.rateLimitsWatcher=(t=t=>{this.lastRateLimits=t,this.broadcast({type:"rate-limits:update",data:t})},e=null,s=null,a=0,i=async()=>{try{let e=await y.default.readFile(f.RATE_LIMITS_FILE,"utf-8"),s=JSON.parse(e);s.ts&&s.ts!==a&&(a=s.ts,t(s))}catch{}},n=()=>{i();try{(e=m.default.watch(f.RATE_LIMITS_FILE,()=>{s&&clearTimeout(s),s=setTimeout(i,500)})).on("error",()=>{S.debug("rate-limits.json watch error, retrying..."),l(),setTimeout(n,5e3)})}catch{S.debug("rate-limits.json not found yet, retrying..."),setTimeout(n,5e3)}},{start:n,stop:l=()=>{s&&(clearTimeout(s),s=null),e&&(e.close(),e=null)}}),this.rateLimitsWatcher.start()}}async resolveCurrentProcess(t,e){if(!e||!(e&&c.has(e)))return e;let s=await (0,n.getLastCommand)(t);if(!s)return e;let a=s.split(/\s+/)[0];return a&&a&&a in o?a:e}async scanAll(){let{workspaces:t}=await (0,s.getWorkspaces)(),e=await (0,n.getAllPanesInfo)();for(let t of[...this.jsonlWatchers.keys()])this.stopJsonlWatch(t);for(let s of(this.tabs.clear(),t)){let t=await (0,a.readLayoutFile)((0,a.resolveLayoutFile)(s.id));if(t)for(let a of(0,i.collectAllTabs)(t.root)){let t=e.get(a.sessionName),i=await this.readTabMetadata(t),n=a.cliState??"idle",l="busy"===n?"unknown":n,{terminalStatus:r,listeningPorts:o}="claude-code"===a.panelType?{terminalStatus:"idle",listeningPorts:[]}:await this.detectTerminalStatus(t),c=await this.resolveCurrentProcess(a.sessionName,t?.command),u=t?`${c??t.command}|${t.path}`:void 0,d="needs-input"===l?{name:"notification",at:Date.now(),seq:0}:null;this.tabs.set(a.id,{cliState:l,workspaceId:s.id,tabName:a.name||(u?p(u):""),currentProcess:c,paneTitle:u,tmuxSession:a.sessionName,panelType:a.panelType,terminalStatus:r,listeningPorts:o,claudeSummary:a.claudeSummary,lastUserMessage:a.lastUserMessage,lastAssistantMessage:i.lastAssistantSnippet,currentAction:i.currentAction,readyForReviewAt:"ready-for-review"===l?Date.now():null,busySince:null,dismissedAt:a.dismissedAt??null,claudeSessionId:J(i.jsonlPath)??a.claudeSessionId??null,jsonlPath:i.jsonlPath,lastEvent:d,eventSeq:0}),("needs-input"===l||"unknown"===l)&&i.jsonlPath&&this.startJsonlWatch(a.id,i.jsonlPath),"unknown"===l&&this.resolveUnknown(a.id).catch(t=>C.warn("resolveUnknown failed: %s",t))}}}async resolveUnknown(t){let e=this.tabs.get(t);if(!e||"unknown"!==e.cliState)return;let s=(await (0,n.getAllPanesInfo)()).get(e.tmuxSession),a=s?.pid?await (0,l.getChildPids)(s.pid):[];if(!(s?.pid&&await (0,l.isClaudeRunning)(s.pid,a))){this.applyCliState(t,e,"idle",{silent:!0}),this.persistToLayout(e),this.broadcastUpdate(t,e);return}if(e.jsonlPath){let{idle:s,stale:a,lastAssistantSnippet:i}=await H(e.jsonlPath);if(s&&!a&&i){this.applyCliState(t,e,"ready-for-review",{silent:!0}),this.persistToLayout(e),this.broadcastUpdate(t,e);return}}}async readTabMetadata(t){let e={lastAssistantSnippet:null,currentAction:null,jsonlPath:null};if(!t||!t.pid)return e;let s=await (0,l.getChildPids)(t.pid);if(!await (0,l.isClaudeRunning)(t.pid,s))return e;let a=await (0,l.detectActiveSession)(t.pid,s);if("running"!==a.status||!a.jsonlPath)return{lastAssistantSnippet:null,currentAction:null,jsonlPath:a.jsonlPath??null};let{lastAssistantSnippet:i,currentAction:n}=await H(a.jsonlPath);return{lastAssistantSnippet:i,currentAction:n,jsonlPath:a.jsonlPath}}async detectTerminalStatus(t){if(!t||!t.pid)return{terminalStatus:"idle",listeningPorts:[]};let e=await (0,n.getListeningPorts)(t.pid);return e.length>0?{terminalStatus:"server",listeningPorts:e}:{terminalStatus:n.SAFE_SHELLS.has(t.command)?"idle":"running",listeningPorts:[]}}getPollingInterval(){let t=this.tabs.size;return t>=21?6e4:t>=11?45e3:3e4}async rescan(){await this.scanAll()}startPolling(){this.stopPolling(),this.currentInterval=this.getPollingInterval(),this.pollingTimer=setInterval(()=>{this.poll().catch(t=>{C.error({err:t},"Polling error")})},this.currentInterval)}stopPolling(){this.pollingTimer&&(clearInterval(this.pollingTimer),this.pollingTimer=null,this.currentInterval=0)}async poll(){let{workspaces:t}=await (0,s.getWorkspaces)(),e=await (0,n.getAllPanesInfo)(),r=new Set,o=new Set(this.tabs.keys()),c=Date.now();for(let s of t){let t=await (0,a.readLayoutFile)((0,a.resolveLayoutFile)(s.id));if(t)for(let o of(0,i.collectAllTabs)(t.root)){r.add(o.id);let t=this.tabs.get(o.id),i=e.get(o.sessionName),{terminalStatus:u,listeningPorts:d}="claude-code"===o.panelType?{terminalStatus:"idle",listeningPorts:[]}:await this.detectTerminalStatus(i),h=await this.resolveCurrentProcess(o.sessionName,i?.command),m=i?`${h??i.command}|${i.path}`:void 0;if(!t){let t=o.cliState??"idle",e="busy"===t?"unknown":t,a=await this.readTabMetadata(i),n="needs-input"===e?{name:"notification",at:Date.now(),seq:0}:null,l={cliState:e,workspaceId:s.id,tabName:o.name||(m?p(m):""),currentProcess:h,paneTitle:m,tmuxSession:o.sessionName,panelType:o.panelType,terminalStatus:u,listeningPorts:d,claudeSummary:o.claudeSummary,lastUserMessage:o.lastUserMessage,lastAssistantMessage:a.lastAssistantSnippet,currentAction:a.currentAction,claudeSessionId:J(a.jsonlPath)??o.claudeSessionId??null,jsonlPath:a.jsonlPath,lastEvent:n,eventSeq:0};this.tabs.set(o.id,l),this.persistToLayout(l),this.broadcastUpdate(o.id,l),"unknown"===e&&this.resolveUnknown(o.id).catch(t=>C.warn("resolveUnknown failed: %s",t));continue}let y=t.currentProcess!==h,g=t.lastUserMessage!==o.lastUserMessage,f=t.panelType!==o.panelType,S=await this.readTabMetadata(i);t.tabName=o.name||(m?p(m):""),t.currentProcess=h,t.paneTitle=m,t.workspaceId=s.id,t.panelType=o.panelType,t.claudeSessionId=J(S.jsonlPath)??o.claudeSessionId??null,t.jsonlPath=S.jsonlPath??t.jsonlPath,t.lastUserMessage=o.lastUserMessage,y&&(t.processRetries=3);let b=!y&&(t.processRetries??0)>0;b&&(t.processRetries=t.processRetries-1);let w=t.listeningPorts,T=w?.length!==d.length||d.some((t,e)=>w[e]!==t),A=t.terminalStatus!==u||T;A&&(t.terminalStatus=u,t.listeningPorts=d);let v=!1;if("busy"===t.cliState||"needs-input"===t.cliState){let e=V(await (0,n.getPaneTitle)(o.sessionName));e&&e!==t.claudeSummary&&(t.claudeSummary=e,v=!0,(0,a.updateTabClaudeSummary)(o.sessionName,e).catch(()=>{}))}else t.claudeSummary!==o.claudeSummary&&(t.claudeSummary=o.claudeSummary,v=!0);if("busy"===t.cliState&&t.lastEvent&&c-t.lastEvent.at>6e5){let e=i?.pid?await (0,l.getChildPids)(i.pid):[];if(!(i?.pid&&await (0,l.isClaudeRunning)(i.pid,e))){C.info({tabId:o.id},"busy stuck — Claude process gone, forcing idle"),this.applyCliState(o.id,t,"idle",{silent:!0}),this.persistToLayout(t),this.broadcastUpdate(o.id,t);continue}}(A||y||b||g||f||v)&&this.broadcastUpdate(o.id,t)}}for(let t of o)!r.has(t)&&this.tabs.has(t)&&(this.stopJsonlWatch(t),this.tabs.delete(t),this.broadcastRemove(t));let u=this.getPollingInterval();this.pollingTimer&&u!==this.currentInterval&&this.startPolling()}getAllForClient(){let t={};for(let[e,s]of this.tabs)t[e]={cliState:s.cliState,workspaceId:s.workspaceId,tabName:s.tabName,currentProcess:s.currentProcess,paneTitle:s.paneTitle,panelType:s.panelType,terminalStatus:s.terminalStatus,listeningPorts:s.listeningPorts,claudeSummary:s.claudeSummary,lastUserMessage:s.lastUserMessage,lastAssistantMessage:s.lastAssistantMessage,currentAction:s.currentAction,readyForReviewAt:s.readyForReviewAt,busySince:s.busySince,dismissedAt:s.dismissedAt,claudeSessionId:s.claudeSessionId,lastEvent:s.lastEvent,eventSeq:s.eventSeq};return t}applyCliState(t,e,s,a={}){if(e.cliState===s)return;let i=e.busySince;e.cliState=s,e.readyForReviewAt="ready-for-review"===s?Date.now():null,e.busySince="busy"===s?Date.now():null,"busy"===s&&(e.dismissedAt=null),"ready-for-review"===s&&e.jsonlPath&&new Promise(t=>setTimeout(t,500)).then(()=>this.saveSessionHistory(t,e,i,!1)).catch(t=>{C.warn("Failed to save session history: %s",t)}),"ready-for-review"!==s||a.silent||this.sendWebPush(t,e,"review").catch(t=>{C.warn("Web push failed: %s",t)}),"needs-input"!==s||a.silent||this.sendWebPush(t,e,"needs-input").catch(t=>{C.warn("Web push failed: %s",t)});let n=("busy"===s||"needs-input"===s)&&e.jsonlPath,l="ready-for-review"===s&&this.jsonlWatchers.has(t);n&&!this.jsonlWatchers.has(t)?this.startJsonlWatch(t,e.jsonlPath):!n&&!l&&this.jsonlWatchers.has(t)&&this.stopJsonlWatch(t)}async saveSessionHistory(t,e,a,i){if(!e.lastUserMessage)return;let n=e.jsonlPath?await B(e.jsonlPath):null,{workspaces:l}=await (0,s.getWorkspaces)(),r=l.find(t=>t.id===e.workspaceId),o=Date.now(),c=n?.firstUserTs??a??o,u=i?o:n?.lastAssistantTs??o,d=i?u-c:n?.turnDurationMs??u-c,p={id:(0,_.nanoid)(),workspaceId:e.workspaceId,workspaceName:r?.name??e.workspaceId,workspaceDir:r?.directories[0]??null,tabId:t,claudeSessionId:e.claudeSessionId??null,prompt:n?.lastUserText??e.lastUserMessage,result:n?.lastAssistantText??null,startedAt:c,completedAt:u,duration:d,dismissedAt:u,toolUsage:n?.toolUsage??{},touchedFiles:n?.touchedFiles??[],...i?{cancelled:!0}:{}};await E(p),this.broadcast({type:"session-history:update",entry:p})}dismissTab(t,e){let s=this.tabs.get(t);if(!s||"ready-for-review"!==s.cliState)return;let a=Date.now();this.applyCliState(t,s,"idle",{silent:!0}),s.dismissedAt=a,this.persistToLayout(s),this.broadcastUpdate(t,s,e),L(t,a).then(t=>{t&&this.broadcast({type:"session-history:update",entry:t})}).catch(t=>{C.warn("Failed to update session history dismissedAt: %s",t)})}ackNotificationInput(t,e){let s=this.tabs.get(t);s&&"needs-input"===s.cliState&&s.lastEvent?.name==="notification"&&s.lastEvent.seq===e&&(F.debug({tabId:t,seq:e},"ack: needs-input→busy"),this.applyCliState(t,s,"busy"),this.persistToLayout(s),this.broadcastUpdate(t,s))}async recoverUnknownIfPending(t){let e=this.tabs.get(t);if(!e)return{recovered:!1,reason:"no-entry"};if("unknown"!==e.cliState)return{recovered:!1,reason:"not-unknown"};let s=await (0,b.capturePaneAtWidth)(e.tmuxSession,120,50).catch(t=>(C.warn("recoverUnknownIfPending capture failed: %s",t),null));if(!s)return{recovered:!1,reason:"capture-failed"};let{options:a}=(0,w.parsePermissionOptions)(s);if(0===a.length)return{recovered:!1,reason:"no-options"};let i=Date.now(),n=(e.eventSeq??0)+1;return e.eventSeq=n,e.lastEvent={name:"notification",at:i,seq:n},F.debug({tabId:t,seq:n,options:a.length},"recover unknown→needs-input from pane capture"),this.applyCliState(t,e,"needs-input",{silent:!0}),this.persistToLayout(e),this.broadcastUpdate(t,e),{recovered:!0}}findTabIdBySession(t){for(let[e,s]of this.tabs)if(s.tmuxSession===t)return e}updateTabFromHook(t,e,s){let a=this.findTabIdBySession(t);if(!a)return void F.debug({tmuxSession:t,event:e,notificationType:s},"no tabId for session");let i=this.tabs.get(a);if(!i)return void F.debug({tabId:a,event:e,notificationType:s},"no entry for tab");if("pre-compact"===e||"post-compact"===e){F.debug({tabId:a,event:e},"compact hook"),this.setCompacting(a,i,"pre-compact"===e?Date.now():null);return}if("session-start"!==e&&"prompt-submit"!==e&&"notification"!==e&&"stop"!==e&&"interrupt"!==e)return void F.debug({tabId:a,event:e,notificationType:s},"unknown event, ignoring");if("notification"===e&&s&&!z.has(s))return void F.debug({tabId:a,event:e,notificationType:s},"non-input notification, skipping state transition");let n=Date.now(),l=(i.eventSeq??0)+1;i.eventSeq=l,i.lastEvent={name:e,at:n,seq:l},this.broadcast({type:"status:hook-event",tabId:a,event:i.lastEvent});let r=i.cliState,o="cancelled"===r?r:((t,e)=>{if(!t)return e;switch(t.name){case"session-start":case"interrupt":return"idle";case"prompt-submit":return"busy";case"notification":return"needs-input";case"stop":return"ready-for-review"}})(i.lastEvent,r);if(F.debug({tabId:a,event:e,notificationType:s,seq:l,prevState:r,newState:o,transition:r!==o},`processed ${e}${s?`(${s})`:""} ${r}→${o}`),r!==o&&(this.applyCliState(a,i,o),this.persistToLayout(i),this.broadcastUpdate(a,i)),"busy"!==o&&"needs-input"!==o||i.jsonlPath||this.resolveAndWatchJsonl(a,t).catch(()=>{}),"stop"===e&&i.jsonlPath){let t=()=>{H(i.jsonlPath).then(({currentAction:t,lastAssistantSnippet:e,reset:s})=>{let n=!1;s?(null!==i.currentAction&&(i.currentAction=null,n=!0),null!==i.lastAssistantMessage&&(i.lastAssistantMessage=null,n=!0)):(null!==t&&t.summary!==i.currentAction?.summary&&(i.currentAction=t,n=!0),null!==e&&i.lastAssistantMessage!==e&&(i.lastAssistantMessage=e,n=!0)),n&&this.broadcastUpdate(a,i)}).catch(()=>{})};t(),setTimeout(()=>{D.delete(i.jsonlPath),t()},500)}}setCompacting(t,e,s){let a=this.compactStaleTimers.get(t);if(a&&(clearTimeout(a),this.compactStaleTimers.delete(t)),(e.compactingSince??null)!==s&&(e.compactingSince=s,this.broadcastUpdate(t,e),null!==s)){let e=setTimeout(()=>{this.compactStaleTimers.delete(t);let e=this.tabs.get(t);e&&e.compactingSince===s&&(e.compactingSince=null,F.debug({tabId:t},"compact stale, auto-cleared"),this.broadcastUpdate(t,e))},6e4);this.compactStaleTimers.set(t,e)}}removeTab(t){let e=this.tabs.get(t);e&&("busy"===e.cliState||"needs-input"===e.cliState)&&e.lastUserMessage&&this.saveSessionHistory(t,e,e.busySince,!0).catch(t=>{C.warn("Failed to save cancelled session history: %s",t)}),this.stopJsonlWatch(t);let s=this.compactStaleTimers.get(t);s&&(clearTimeout(s),this.compactStaleTimers.delete(t)),this.tabs.delete(t),this.broadcastRemove(t)}reconcileWorkspaceTabs(t,e){let s=new Set(e);for(let[e,a]of this.tabs)a.workspaceId!==t||s.has(e)||this.removeTab(e)}removeWorkspaceTabs(t){for(let[e,s]of this.tabs)s.workspaceId===t&&this.removeTab(e)}registerTab(t,e){this.tabs.set(t,e),this.broadcastUpdate(t,e)}addClient(t){this.clients.add(t),this.lastRateLimits&&t.readyState===e.WebSocket.OPEN&&t.send(JSON.stringify({type:"rate-limits:update",data:this.lastRateLimits}))}removeClient(t){this.clients.delete(t)}persistToLayout(t){(0,a.updateTabCliStatus)(t.tmuxSession,t.cliState,t.dismissedAt).catch(()=>{})}broadcastUpdate(t,e,s){let a={type:"status:update",tabId:t,cliState:e.cliState,workspaceId:e.workspaceId,tabName:e.tabName,currentProcess:e.currentProcess,paneTitle:e.paneTitle,panelType:e.panelType,terminalStatus:e.terminalStatus,listeningPorts:e.listeningPorts,claudeSummary:e.claudeSummary,lastUserMessage:e.lastUserMessage,lastAssistantMessage:e.lastAssistantMessage,currentAction:e.currentAction,readyForReviewAt:e.readyForReviewAt,busySince:e.busySince,dismissedAt:e.dismissedAt,claudeSessionId:e.claudeSessionId,compactingSince:e.compactingSince,lastEvent:e.lastEvent,eventSeq:e.eventSeq};this.broadcast(a,s)}broadcastRemove(t){this.broadcast({type:"status:update",tabId:t,cliState:null,workspaceId:"",tabName:""})}static BACKPRESSURE_LIMIT=1048576;broadcast(t,s){let a=JSON.stringify(t);for(let t of this.clients)t!==s&&t.readyState===e.WebSocket.OPEN&&t.bufferedAmount<G.BACKPRESSURE_LIMIT&&t.send(a)}async resolveAndWatchJsonl(t,e){let s=this.tabs.get(t);if(!s||s.jsonlPath)return;let o=null,c=(0,a.parseSessionName)(e);if(c){let l=await (0,a.readLayoutFile)((0,a.resolveLayoutFile)(c.wsId));if(l){let a=(0,i.collectAllTabs)(l.root).find(t=>t.sessionName===e);if(a?.claudeSessionId){let t=await (0,n.getSessionCwd)(e);if(t){let e=`${(0,r.cwdToProjectPath)(t)}/${a.claudeSessionId}.jsonl`;try{await y.default.access(e),o=e}catch{}}}a?.lastUserMessage&&s.lastUserMessage!==a.lastUserMessage&&(s.lastUserMessage=a.lastUserMessage,this.broadcastUpdate(t,s))}}if(!o){let t=await (0,n.getSessionPanePid)(e);t&&(o=(await (0,l.detectActiveSession)(t)).jsonlPath)}o&&(s.jsonlPath=o,"busy"!==s.cliState&&"needs-input"!==s.cliState||this.jsonlWatchers.has(t)||this.startJsonlWatch(t,o))}startJsonlWatch(t,e){let s=this.jsonlWatchers.get(t);if(s?.jsonlPath!==e){s&&this.stopJsonlWatch(t),C.debug("startJsonlWatch tabId=%s path=%s",t,e);try{let s=(0,m.watch)(e,()=>{let s=this.jsonlWatchers.get(t);s&&(s.debounceTimer&&clearTimeout(s.debounceTimer),s.debounceTimer=setTimeout(()=>{this.onJsonlFileChange(t,e).catch(()=>{})},100))});s.on("error",()=>{this.stopJsonlWatch(t)}),this.jsonlWatchers.set(t,{watcher:s,jsonlPath:e,debounceTimer:null})}catch{}}}stopJsonlWatch(t){let e=this.jsonlWatchers.get(t);if(e){C.debug("stopJsonlWatch tabId=%s",t),e.debounceTimer&&clearTimeout(e.debounceTimer);try{e.watcher.close()}catch{}this.jsonlWatchers.delete(t)}}async onJsonlFileChange(t,e){let s=this.tabs.get(t);if(!s||"busy"!==s.cliState&&"needs-input"!==s.cliState&&"unknown"!==s.cliState&&"ready-for-review"!==s.cliState)return void this.stopJsonlWatch(t);let{currentAction:a,lastAssistantSnippet:i,reset:n,interrupted:l,lastEntryTs:r}=await H(e);l&&"busy"===s.cliState&&null!==r&&r>(s.lastInterruptTs??0)&&r>(s.lastEvent?.at??0)&&(s.lastInterruptTs=r,F.debug({tabId:t,lastEntryTs:r},"synthetic interrupt from JSONL"),this.updateTabFromHook(s.tmuxSession,"interrupt"));let o=!1;n?(null!==s.currentAction&&(s.currentAction=null,o=!0),null!==s.lastAssistantMessage&&(s.lastAssistantMessage=null,o=!0)):(null!==a&&a.summary!==s.currentAction?.summary&&(s.currentAction=a,o=!0),null!==i&&s.lastAssistantMessage!==i&&(s.lastAssistantMessage=i,o=!0)),o&&this.broadcastUpdate(t,s)}shutdown(){for(let t of(this.stopPolling(),this.rateLimitsWatcher?.stop(),[...this.jsonlWatchers.keys()]))this.stopJsonlWatch(t);for(let t of this.clients)t.readyState===e.WebSocket.OPEN&&t.close(1001,"Server shutting down");this.clients.clear()}notifyLastUserMessage(t,e){let s=(0,a.parseSessionName)(t);if(!s)return;let i=this.tabs.get(s.tabId);i&&i.lastUserMessage!==e&&(i.lastUserMessage=e,this.broadcastUpdate(s.tabId,i))}async sendWebPush(t,e,a){let i=await (0,R.getSubscriptions)();if(0===i.length)return;let n=await (0,N.getVAPIDKeys)();x.default.setVapidDetails("mailto:noreply@purplemux.app",n.publicKey,n.privateKey);let l=e.lastUserMessage?.slice(0,100)||e.tabName||t,r=(await (0,s.getWorkspaces)()).workspaces.find(t=>t.id===e.workspaceId),o=JSON.stringify({title:"needs-input"===a?"Input Required":"Task Complete",body:l,tabId:t,workspaceId:e.workspaceId,claudeSessionId:e.claudeSessionId??null,workspaceName:r?.name??"",workspaceDir:r?.directories[0]??null});if(!(0,R.isAnyDeviceVisible)())for(let t of i)try{await x.default.sendNotification(t,o)}catch(s){let e=s.statusCode;(410===e||404===e)&&await (0,R.removeSubscription)(t.endpoint),C.warn("Web push send error: %s",e)}}}t.s(["getStatusManager",0,()=>{if(!X.__ptStatusManager){let t=new G;X.__ptStatusManager=t,(0,a.setLayoutReconciler)({reconcileWorkspaceTabs:(e,s)=>t.reconcileWorkspaceTabs(e,s),removeWorkspaceTabs:e=>t.removeWorkspaceTabs(e)})}return X.__ptStatusManager}],964759)}];
|
|
1
|
+
module.exports=[964759,t=>{"use strict";t.i(478319);var e=t.i(220951),s=t.i(322429),a=t.i(825265),i=t.i(804767),n=t.i(459015),l=t.i(143511),r=t.i(746514);let o={bash:"",zsh:"",fish:"",sh:"",dash:"",tcsh:"",nu:"",nvim:"",vim:"",vi:"",nano:"",emacs:"",hx:"",code:"",git:"",gitui:"",tig:"",gh:"",lazygit:"",jj:"",lazyjj:"",node:"",deno:"",bun:"",python:"",python3:"",go:"",ruby:"",java:"",rust:"",rustc:"",cargo:"",swift:"",dart:"",elixir:"",perl:"",php:"",R:"",julia:"",scala:"",zig:"",npm:"",pnpm:"",yarn:"",pip:"",pip3:"",brew:"",apt:"",dnf:"",pacman:"",yay:"",paru:"",make:"",cmake:"",gradle:"",maven:"",webpack:"",tsc:"",docker:"",lazydocker:"",kubectl:"",k9s:"",helm:"",minikube:"",aws:"",gcloud:"",terraform:"",ansible:"",vagrant:"",ssh:"",scp:"",curl:"",wget:"",rsync:"",ping:"",htop:"",btop:"",top:"",btm:"",glances:"",mactop:"",ranger:"",yazi:"",lf:"",lfcd:"",mysql:"",psql:"",mongo:"",redis:"",sqlite:"",tmux:"",screen:"",sudo:"",bat:"",gpg:"",openssl:"",zip:"",unzip:"",jest:"",claude:"",codex:""},c=new Set(["node","python","python3","ruby","perl","deno","bun"]),u=new Set(["zsh","bash","fish","sh","-zsh","-bash","-fish","-sh"]),d=t=>{if("~"===t||"/"===t)return t;let e=t.replace(/\/$/,"").split("/");return e[e.length-1]||t},p=t=>{let e=t.trim();if(!e)return"";let s=(t=>{let e=t.trim();if(!e)return null;let s=e.indexOf("|");return s>0?e.slice(0,s):null})(t);if(null!==s){let t=e.slice(e.indexOf("|")+1);return u.has(s)?d(t):s}let a=e.match(/@[^:]+:\s*(.*)/);if(a)return d(a[1].trim());if(e.startsWith("/")||e.startsWith("~"))return d(e);let i=e.split(/\s+/)[0];return u.has(i)?"":i||""};var h=t.i(840665),m=t.i(522734),y=t.i(924868),g=t.i(25146),f=t.i(796902);let S=(0,g.createLogger)("rate-limits");var b=t.i(971780),w=t.i(443571),T=t.i(814747),A=t.i(446786);let v=(0,g.createLogger)("session-history"),k=T.default.join(A.default.homedir(),".purplemux"),P=T.default.join(k,"session-history.json"),M=globalThis;M.__purplemuxSessionHistoryLock||(M.__purplemuxSessionHistoryLock=Promise.resolve());let I=async t=>{let e,s=new Promise(t=>{e=t}),a=M.__purplemuxSessionHistoryLock;M.__purplemuxSessionHistoryLock=s,await a;try{return await t()}finally{e()}},j=()=>({version:1,entries:[]}),U=async()=>{let t;try{t=await y.default.readFile(P,"utf-8")}catch{return j()}try{return JSON.parse(t)}catch{v.warn("Failed to parse session-history.json, starting empty");try{await y.default.copyFile(P,P.replace(/\.json$/,".json.bak"))}catch{}return j()}},W=async t=>{let e=JSON.stringify(t.entries);if(M.__purplemuxSessionHistoryContentCache===e)return;let s=P+".tmp";try{await y.default.writeFile(s,JSON.stringify(t,null,2),{mode:384}),await y.default.rename(s,P)}catch(t){throw await y.default.unlink(s).catch(()=>{}),t}M.__purplemuxSessionHistoryContentCache=e},E=async t=>{await I(async()=>{let e=await U();e.entries.unshift(t),e.entries.length>200&&(e.entries=e.entries.slice(0,200)),await W(e)})},L=async(t,e)=>await I(async()=>{let s=await U(),a=s.entries.find(e=>e.tabId===t&&null===e.dismissedAt);return a?(a.dismissedAt=e,await W(s),a):null});var x=t.i(157469),R=t.i(75874),N=t.i(228448),_=t.i(44014);let C=(0,g.createLogger)("status"),F=(0,g.createLogger)("hooks"),J=t=>t?T.default.basename(t,".jsonl"):null,z=new Set(["permission_prompt","worker_permission_prompt"]),D=new Map,q=t=>{let e=t.name??"Tool",s=t.input??{};return{toolName:e,summary:(0,h.summarizeToolCall)(e,s)}},O=t=>{let e=!1;for(let s=t.length-1;s>=0;s--)try{let a=JSON.parse(t[s]);if(a.isSidechain)continue;if("user"===a.type){let t=a.message?.content;Array.isArray(t)&&t.some(t=>"tool_result"===t.type)||(e=!0);continue}if("assistant"!==a.type||!a.message?.content)continue;if(e)return{lastAssistantSnippet:null,currentAction:null,reset:!0};let i=a.message.content;if(!Array.isArray(i))continue;let n=null,l=null;for(let t=i.length-1;t>=0;t--){let e=i[t];if("tool_use"===e.type){l=q(e);break}if("text"===e.type&&e.text?.trim()){let t=e.text.trim();l={toolName:null,summary:t.length>200?t.slice(0,200)+"…":t};break}}for(let t=i.length-1;t>=0;t--)if("text"===i[t].type&&i[t].text?.trim()){let e=i[t].text.trim();n=e.length>200?e.slice(0,200)+"…":e;break}return{lastAssistantSnippet:n,currentAction:l,reset:!1}}catch{continue}return{lastAssistantSnippet:null,currentAction:null,reset:!1}},$=(t,e)=>{for(let s=t.length-1;s>=0;s--)try{let a=JSON.parse(t[s]);if(a.isSidechain)continue;let i=a.timestamp?new Date(a.timestamp).getTime():null;if("system"===a.type&&("stop_hook_summary"===a.subtype||"turn_duration"===a.subtype))return{matched:!0,idle:!0,stale:!1,needsStaleRecheck:!1,staleMs:0,lastEntryTs:i,interrupted:!1};if("assistant"===a.type){let t=a.message?.stop_reason;if(!t){let t=e>2e4;return{matched:!0,idle:t,stale:!0,needsStaleRecheck:!t,staleMs:2e4,lastEntryTs:i,interrupted:!1}}return{matched:!0,idle:"tool_use"!==t,stale:!1,needsStaleRecheck:!1,staleMs:0,lastEntryTs:i,interrupted:!1}}if("user"===a.type){let t=a.message?.content;if(Array.isArray(t)&&1===t.length&&"string"==typeof t[0]?.text&&t[0].text.startsWith(h.INTERRUPT_PREFIX))return{matched:!0,idle:!0,stale:!1,needsStaleRecheck:!1,staleMs:0,lastEntryTs:i,interrupted:!0};let s=e>9e4;return{matched:!0,idle:s,stale:!0,needsStaleRecheck:!s,staleMs:9e4,lastEntryTs:i,interrupted:!1}}}catch{continue}return{matched:!1,idle:e>9e4,stale:!0,needsStaleRecheck:e<=9e4,staleMs:9e4,lastEntryTs:null,interrupted:!1}},H=async t=>{try{let e=await y.default.stat(t);if(0===e.size)return{idle:!0,stale:!1,lastAssistantSnippet:null,currentAction:null,reset:!1,lastEntryTs:null,staleMs:0,interrupted:!1};let s=D.get(t);if(s&&s.mtimeMs===e.mtimeMs){if(D.delete(t),D.set(t,s),s.idle)return{idle:!0,stale:s.stale,lastAssistantSnippet:s.lastAssistantSnippet,currentAction:s.currentAction,reset:s.reset,lastEntryTs:s.lastEntryTs,staleMs:s.staleMs,interrupted:s.interrupted};if(s.needsStaleRecheck)return{idle:Date.now()-e.mtimeMs>s.staleMs,stale:!0,lastAssistantSnippet:s.lastAssistantSnippet,currentAction:s.currentAction,reset:s.reset,lastEntryTs:s.lastEntryTs,staleMs:s.staleMs,interrupted:s.interrupted};return{idle:!1,stale:!1,lastAssistantSnippet:s.lastAssistantSnippet,currentAction:s.currentAction,reset:s.reset,lastEntryTs:s.lastEntryTs,staleMs:s.staleMs,interrupted:s.interrupted}}let a=await y.default.open(t,"r");try{let s=Date.now()-e.mtimeMs,i=Math.min(e.size,8192),n=Buffer.alloc(i);await a.read(n,0,i,e.size-i);let l=n.toString("utf-8").split("\n").filter(t=>t.trim()),r=$(l,s),o=O(l);if(!r.matched&&e.size>8192){let t=Math.min(e.size,131072),i=Buffer.alloc(t);await a.read(i,0,t,e.size-t);let n=i.toString("utf-8").split("\n").filter(t=>t.trim());r=$(n,s),o.lastAssistantSnippet||o.currentAction||(o=O(n))}return D.size>=256&&D.delete(D.keys().next().value),D.set(t,{mtimeMs:e.mtimeMs,idle:r.idle,stale:r.stale,needsStaleRecheck:r.needsStaleRecheck,staleMs:r.staleMs,lastAssistantSnippet:o.lastAssistantSnippet,currentAction:o.currentAction,reset:o.reset,lastEntryTs:r.lastEntryTs,interrupted:r.interrupted}),{idle:r.idle,stale:r.stale,lastAssistantSnippet:o.lastAssistantSnippet,currentAction:o.currentAction,reset:o.reset,lastEntryTs:r.lastEntryTs,staleMs:r.staleMs,interrupted:r.interrupted}}finally{await a.close()}}catch{return{idle:!1,stale:!1,lastAssistantSnippet:null,currentAction:null,reset:!1,lastEntryTs:null,staleMs:0,interrupted:!1}}},B=async t=>{let e={toolUsage:{},touchedFiles:[],lastAssistantText:null,lastUserText:null,firstUserTs:null,lastAssistantTs:null,turnDurationMs:null};try{let s=await y.default.stat(t);if(0===s.size)return e;let a=await y.default.open(t,"r");try{let t=Math.min(s.size,131072),e=Buffer.alloc(t);await a.read(e,0,t,s.size-t);let i=e.toString("utf-8").split("\n").filter(t=>t.trim()),n={},l=new Set,r=null,o=null,c=null,u=null,d=null;for(let t=i.length-1;t>=0;t--)try{let e=JSON.parse(i[t]);if("file-history-snapshot"===e.type)break;if(e.isSidechain)continue;"system"!==e.type||"turn_duration"!==e.subtype||"number"!=typeof e.durationMs||d||(d=e.durationMs);let s=e.timestamp?new Date(e.timestamp).getTime():null;if("user"===e.type&&(s&&(u=s),!o&&Array.isArray(e.message?.content))){for(let t of e.message.content)if("text"===t.type&&t.text){o=t.text;break}}if("assistant"===e.type&&(s&&!c&&(c=s),Array.isArray(e.message?.content))){let t=null;for(let s of e.message.content)"tool_use"===s.type&&s.name&&(n[s.name]=(n[s.name]??0)+1,("Edit"===s.name||"Write"===s.name)&&s.input?.file_path&&l.add(String(s.input.file_path))),"text"===s.type&&s.text&&(t=s.text);!r&&t&&(r=t)}}catch{continue}return{toolUsage:n,touchedFiles:[...l],lastAssistantText:r,lastUserText:o,firstUserTs:u,lastAssistantTs:c,turnDurationMs:d}}finally{await a.close()}}catch{return e}},K=/^[✳⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏⠐⠈]\s+/,V=t=>t&&K.test(t)&&t.replace(K,"").trim()||null,X=globalThis;class G{tabs=new Map;pollingTimer=null;currentInterval=0;clients=new Set;initialized=!1;rateLimitsWatcher=null;lastRateLimits=null;jsonlWatchers=new Map;compactStaleTimers=new Map;async init(){if(!this.initialized){var t;let e,s,a,i,n,l;this.initialized=!0,await this.scanAll(),this.startPolling(),this.rateLimitsWatcher=(t=t=>{this.lastRateLimits=t,this.broadcast({type:"rate-limits:update",data:t})},e=null,s=null,a=0,i=async()=>{try{let e=await y.default.readFile(f.RATE_LIMITS_FILE,"utf-8"),s=JSON.parse(e);s.ts&&s.ts!==a&&(a=s.ts,t(s))}catch{}},n=()=>{i();try{(e=m.default.watch(f.RATE_LIMITS_FILE,()=>{s&&clearTimeout(s),s=setTimeout(i,500)})).on("error",()=>{S.debug("rate-limits.json watch error, retrying..."),l(),setTimeout(n,5e3)})}catch{S.debug("rate-limits.json not found yet, retrying..."),setTimeout(n,5e3)}},{start:n,stop:l=()=>{s&&(clearTimeout(s),s=null),e&&(e.close(),e=null)}}),this.rateLimitsWatcher.start()}}async resolveCurrentProcess(t,e){if(!e||!(e&&c.has(e)))return e;let s=await (0,n.getLastCommand)(t);if(!s)return e;let a=s.split(/\s+/)[0];return a&&a&&a in o?a:e}async scanAll(){let{workspaces:t}=await (0,s.getWorkspaces)(),e=await (0,n.getAllPanesInfo)();for(let t of[...this.jsonlWatchers.keys()])this.stopJsonlWatch(t);for(let s of(this.tabs.clear(),t)){let t=await (0,a.readLayoutFile)((0,a.resolveLayoutFile)(s.id));if(t)for(let a of(0,i.collectAllTabs)(t.root)){let t=e.get(a.sessionName),i=await this.readTabMetadata(t),n=a.cliState??"idle",l="busy"===n?"unknown":n,{terminalStatus:r,listeningPorts:o}="claude-code"===a.panelType?{terminalStatus:"idle",listeningPorts:[]}:await this.detectTerminalStatus(t),c=await this.resolveCurrentProcess(a.sessionName,t?.command),u=t?`${c??t.command}|${t.path}`:void 0,d="needs-input"===l?{name:"notification",at:Date.now(),seq:0}:null;this.tabs.set(a.id,{cliState:l,workspaceId:s.id,tabName:a.name||(u?p(u):""),currentProcess:c,paneTitle:u,tmuxSession:a.sessionName,panelType:a.panelType,terminalStatus:r,listeningPorts:o,claudeSummary:a.claudeSummary,lastUserMessage:a.lastUserMessage,lastAssistantMessage:i.lastAssistantSnippet,currentAction:i.currentAction,readyForReviewAt:"ready-for-review"===l?Date.now():null,busySince:null,dismissedAt:a.dismissedAt??null,claudeSessionId:J(i.jsonlPath)??a.claudeSessionId??null,jsonlPath:i.jsonlPath,lastEvent:d,eventSeq:0}),("needs-input"===l||"unknown"===l)&&i.jsonlPath&&this.startJsonlWatch(a.id,i.jsonlPath),"unknown"===l&&this.resolveUnknown(a.id).catch(t=>C.warn("resolveUnknown failed: %s",t))}}}async resolveUnknown(t){let e=this.tabs.get(t);if(!e||"unknown"!==e.cliState)return;let s=(await (0,n.getAllPanesInfo)()).get(e.tmuxSession),a=s?.pid?await (0,l.getChildPids)(s.pid):[];if(!(s?.pid&&await (0,l.isClaudeRunning)(s.pid,a))){this.applyCliState(t,e,"idle",{silent:!0}),this.persistToLayout(e),this.broadcastUpdate(t,e);return}if(e.jsonlPath){let{idle:s,stale:a,lastAssistantSnippet:i}=await H(e.jsonlPath);if(s&&!a&&i){this.applyCliState(t,e,"ready-for-review",{silent:!0}),this.persistToLayout(e),this.broadcastUpdate(t,e);return}}}async readTabMetadata(t){let e={lastAssistantSnippet:null,currentAction:null,jsonlPath:null};if(!t||!t.pid)return e;let s=await (0,l.getChildPids)(t.pid);if(!await (0,l.isClaudeRunning)(t.pid,s))return e;let a=await (0,l.detectActiveSession)(t.pid,s);if("running"!==a.status||!a.jsonlPath)return{lastAssistantSnippet:null,currentAction:null,jsonlPath:a.jsonlPath??null};let{lastAssistantSnippet:i,currentAction:n}=await H(a.jsonlPath);return{lastAssistantSnippet:i,currentAction:n,jsonlPath:a.jsonlPath}}async detectTerminalStatus(t){if(!t||!t.pid)return{terminalStatus:"idle",listeningPorts:[]};let e=await (0,n.getListeningPorts)(t.pid);return e.length>0?{terminalStatus:"server",listeningPorts:e}:{terminalStatus:n.SAFE_SHELLS.has(t.command)?"idle":"running",listeningPorts:[]}}getPollingInterval(){let t=this.tabs.size;return t>=21?6e4:t>=11?45e3:3e4}async rescan(){await this.scanAll()}startPolling(){this.stopPolling(),this.currentInterval=this.getPollingInterval(),this.pollingTimer=setInterval(()=>{this.poll().catch(t=>{C.error({err:t},"Polling error")})},this.currentInterval)}stopPolling(){this.pollingTimer&&(clearInterval(this.pollingTimer),this.pollingTimer=null,this.currentInterval=0)}async poll(){let{workspaces:t}=await (0,s.getWorkspaces)(),e=await (0,n.getAllPanesInfo)(),r=new Set,o=new Set(this.tabs.keys()),c=Date.now();for(let s of t){let t=await (0,a.readLayoutFile)((0,a.resolveLayoutFile)(s.id));if(t)for(let o of(0,i.collectAllTabs)(t.root)){r.add(o.id);let t=this.tabs.get(o.id),i=e.get(o.sessionName),{terminalStatus:u,listeningPorts:d}="claude-code"===o.panelType?{terminalStatus:"idle",listeningPorts:[]}:await this.detectTerminalStatus(i),h=await this.resolveCurrentProcess(o.sessionName,i?.command),m=i?`${h??i.command}|${i.path}`:void 0;if(!t){let t=o.cliState??"idle",e="busy"===t?"unknown":t,a=await this.readTabMetadata(i),n="needs-input"===e?{name:"notification",at:Date.now(),seq:0}:null,l={cliState:e,workspaceId:s.id,tabName:o.name||(m?p(m):""),currentProcess:h,paneTitle:m,tmuxSession:o.sessionName,panelType:o.panelType,terminalStatus:u,listeningPorts:d,claudeSummary:o.claudeSummary,lastUserMessage:o.lastUserMessage,lastAssistantMessage:a.lastAssistantSnippet,currentAction:a.currentAction,claudeSessionId:J(a.jsonlPath)??o.claudeSessionId??null,jsonlPath:a.jsonlPath,lastEvent:n,eventSeq:0};this.tabs.set(o.id,l),this.persistToLayout(l),this.broadcastUpdate(o.id,l),"unknown"===e&&this.resolveUnknown(o.id).catch(t=>C.warn("resolveUnknown failed: %s",t));continue}let y=t.currentProcess!==h,g=t.lastUserMessage!==o.lastUserMessage,f=t.panelType!==o.panelType,S=await this.readTabMetadata(i);t.tabName=o.name||(m?p(m):""),t.currentProcess=h,t.paneTitle=m,t.workspaceId=s.id,t.panelType=o.panelType,t.claudeSessionId=J(S.jsonlPath)??o.claudeSessionId??null,t.jsonlPath=S.jsonlPath??t.jsonlPath,t.lastUserMessage=o.lastUserMessage,y&&(t.processRetries=3);let b=!y&&(t.processRetries??0)>0;b&&(t.processRetries=t.processRetries-1);let w=t.listeningPorts,T=w?.length!==d.length||d.some((t,e)=>w[e]!==t),A=t.terminalStatus!==u||T;A&&(t.terminalStatus=u,t.listeningPorts=d);let v=!1;if("busy"===t.cliState||"needs-input"===t.cliState){let e=V(await (0,n.getPaneTitle)(o.sessionName));e&&e!==t.claudeSummary&&(t.claudeSummary=e,v=!0,(0,a.updateTabClaudeSummary)(o.sessionName,e).catch(()=>{}))}else t.claudeSummary!==o.claudeSummary&&(t.claudeSummary=o.claudeSummary,v=!0);if("busy"===t.cliState&&t.lastEvent&&c-t.lastEvent.at>6e5){let e=i?.pid?await (0,l.getChildPids)(i.pid):[];if(!(i?.pid&&await (0,l.isClaudeRunning)(i.pid,e))){C.info({tabId:o.id},"busy stuck — Claude process gone, forcing idle"),this.applyCliState(o.id,t,"idle",{silent:!0}),this.persistToLayout(t),this.broadcastUpdate(o.id,t);continue}}(A||y||b||g||f||v)&&this.broadcastUpdate(o.id,t)}}for(let t of o)!r.has(t)&&this.tabs.has(t)&&(this.stopJsonlWatch(t),this.tabs.delete(t),this.broadcastRemove(t));let u=this.getPollingInterval();this.pollingTimer&&u!==this.currentInterval&&this.startPolling()}getAllForClient(){let t={};for(let[e,s]of this.tabs)t[e]={cliState:s.cliState,workspaceId:s.workspaceId,tabName:s.tabName,currentProcess:s.currentProcess,paneTitle:s.paneTitle,panelType:s.panelType,terminalStatus:s.terminalStatus,listeningPorts:s.listeningPorts,claudeSummary:s.claudeSummary,lastUserMessage:s.lastUserMessage,lastAssistantMessage:s.lastAssistantMessage,currentAction:s.currentAction,readyForReviewAt:s.readyForReviewAt,busySince:s.busySince,dismissedAt:s.dismissedAt,claudeSessionId:s.claudeSessionId,lastEvent:s.lastEvent,eventSeq:s.eventSeq};return t}applyCliState(t,e,s,a={}){if(e.cliState===s)return;let i=e.busySince;e.cliState=s,e.readyForReviewAt="ready-for-review"===s?Date.now():null,e.busySince="busy"===s?Date.now():null,"busy"===s&&(e.dismissedAt=null),"ready-for-review"===s&&e.jsonlPath&&new Promise(t=>setTimeout(t,500)).then(()=>this.saveSessionHistory(t,e,i,!1)).catch(t=>{C.warn("Failed to save session history: %s",t)}),"ready-for-review"!==s||a.silent||this.sendWebPush(t,e,"review").catch(t=>{C.warn("Web push failed: %s",t)}),"needs-input"!==s||a.silent||this.sendWebPush(t,e,"needs-input").catch(t=>{C.warn("Web push failed: %s",t)});let n=("busy"===s||"needs-input"===s)&&e.jsonlPath,l="ready-for-review"===s&&this.jsonlWatchers.has(t);n&&!this.jsonlWatchers.has(t)?this.startJsonlWatch(t,e.jsonlPath):!n&&!l&&this.jsonlWatchers.has(t)&&this.stopJsonlWatch(t)}async saveSessionHistory(t,e,a,i){if(!e.lastUserMessage)return;let n=e.jsonlPath?await B(e.jsonlPath):null,{workspaces:l}=await (0,s.getWorkspaces)(),r=l.find(t=>t.id===e.workspaceId),o=Date.now(),c=n?.firstUserTs??a??o,u=i?o:n?.lastAssistantTs??o,d=i?u-c:n?.turnDurationMs??u-c,p={id:(0,_.nanoid)(),workspaceId:e.workspaceId,workspaceName:r?.name??e.workspaceId,workspaceDir:r?.directories[0]??null,tabId:t,claudeSessionId:e.claudeSessionId??null,prompt:n?.lastUserText??e.lastUserMessage,result:n?.lastAssistantText??null,startedAt:c,completedAt:u,duration:d,dismissedAt:u,toolUsage:n?.toolUsage??{},touchedFiles:n?.touchedFiles??[],...i?{cancelled:!0}:{}};await E(p),this.broadcast({type:"session-history:update",entry:p})}dismissTab(t,e){let s=this.tabs.get(t);if(!s||"ready-for-review"!==s.cliState)return;let a=Date.now();this.applyCliState(t,s,"idle",{silent:!0}),s.dismissedAt=a,this.persistToLayout(s),this.broadcastUpdate(t,s,e),L(t,a).then(t=>{t&&this.broadcast({type:"session-history:update",entry:t})}).catch(t=>{C.warn("Failed to update session history dismissedAt: %s",t)})}ackNotificationInput(t,e){let s=this.tabs.get(t);s&&"needs-input"===s.cliState&&s.lastEvent?.name==="notification"&&s.lastEvent.seq===e&&(F.debug({tabId:t,seq:e},"ack: needs-input→busy"),this.applyCliState(t,s,"busy"),this.persistToLayout(s),this.broadcastUpdate(t,s))}async recoverUnknownIfPending(t){let e=this.tabs.get(t);if(!e)return{recovered:!1,reason:"no-entry"};if("unknown"!==e.cliState)return{recovered:!1,reason:"not-unknown"};let s=await (0,b.capturePaneAtWidth)(e.tmuxSession,120,50).catch(t=>(C.warn("recoverUnknownIfPending capture failed: %s",t),null));if(!s)return{recovered:!1,reason:"capture-failed"};let{options:a}=(0,w.parsePermissionOptions)(s);if(0===a.length)return{recovered:!1,reason:"no-options"};let i=Date.now(),n=(e.eventSeq??0)+1;return e.eventSeq=n,e.lastEvent={name:"notification",at:i,seq:n},F.debug({tabId:t,seq:n,options:a.length},"recover unknown→needs-input from pane capture"),this.applyCliState(t,e,"needs-input",{silent:!0}),this.persistToLayout(e),this.broadcastUpdate(t,e),{recovered:!0}}findTabIdBySession(t){for(let[e,s]of this.tabs)if(s.tmuxSession===t)return e}updateTabFromHook(t,e,s){let a=this.findTabIdBySession(t);if(!a)return void F.debug({tmuxSession:t,event:e,notificationType:s},"no tabId for session");let i=this.tabs.get(a);if(!i)return void F.debug({tabId:a,event:e,notificationType:s},"no entry for tab");if("pre-compact"===e||"post-compact"===e){F.debug({tabId:a,event:e},"compact hook"),this.setCompacting(a,i,"pre-compact"===e?Date.now():null);return}if("session-start"!==e&&"prompt-submit"!==e&&"notification"!==e&&"stop"!==e&&"interrupt"!==e)return void F.debug({tabId:a,event:e,notificationType:s},"unknown event, ignoring");if("notification"===e&&s&&!z.has(s))return void F.debug({tabId:a,event:e,notificationType:s},"non-input notification, skipping state transition");let n=Date.now(),l=(i.eventSeq??0)+1;i.eventSeq=l,i.lastEvent={name:e,at:n,seq:l},this.broadcast({type:"status:hook-event",tabId:a,event:i.lastEvent});let r=i.cliState,o="cancelled"===r?r:((t,e)=>{if(!t)return e;switch(t.name){case"session-start":case"interrupt":return"idle";case"prompt-submit":return"busy";case"notification":return"needs-input";case"stop":return"ready-for-review"}})(i.lastEvent,r);if(F.debug({tabId:a,event:e,notificationType:s,seq:l,prevState:r,newState:o,transition:r!==o},`processed ${e}${s?`(${s})`:""} ${r}→${o}`),r!==o&&(this.applyCliState(a,i,o),this.persistToLayout(i),this.broadcastUpdate(a,i)),"busy"!==o&&"needs-input"!==o||i.jsonlPath||this.resolveAndWatchJsonl(a,t).catch(()=>{}),"stop"===e&&i.jsonlPath){let t=()=>{H(i.jsonlPath).then(({currentAction:t,lastAssistantSnippet:e,reset:s})=>{let n=!1;s?(null!==i.currentAction&&(i.currentAction=null,n=!0),null!==i.lastAssistantMessage&&(i.lastAssistantMessage=null,n=!0)):(null!==t&&t.summary!==i.currentAction?.summary&&(i.currentAction=t,n=!0),null!==e&&i.lastAssistantMessage!==e&&(i.lastAssistantMessage=e,n=!0)),n&&this.broadcastUpdate(a,i)}).catch(()=>{})};t(),setTimeout(()=>{D.delete(i.jsonlPath),t()},500)}}setCompacting(t,e,s){let a=this.compactStaleTimers.get(t);if(a&&(clearTimeout(a),this.compactStaleTimers.delete(t)),(e.compactingSince??null)!==s&&(e.compactingSince=s,this.broadcastUpdate(t,e),null!==s)){let e=setTimeout(()=>{this.compactStaleTimers.delete(t);let e=this.tabs.get(t);e&&e.compactingSince===s&&(e.compactingSince=null,F.debug({tabId:t},"compact stale, auto-cleared"),this.broadcastUpdate(t,e))},6e4);this.compactStaleTimers.set(t,e)}}removeTab(t){let e=this.tabs.get(t);e&&("busy"===e.cliState||"needs-input"===e.cliState)&&e.lastUserMessage&&this.saveSessionHistory(t,e,e.busySince,!0).catch(t=>{C.warn("Failed to save cancelled session history: %s",t)}),this.stopJsonlWatch(t);let s=this.compactStaleTimers.get(t);s&&(clearTimeout(s),this.compactStaleTimers.delete(t)),this.tabs.delete(t),this.broadcastRemove(t)}reconcileWorkspaceTabs(t,e){let s=new Set(e);for(let[e,a]of this.tabs)a.workspaceId!==t||s.has(e)||this.removeTab(e)}removeWorkspaceTabs(t){for(let[e,s]of this.tabs)s.workspaceId===t&&this.removeTab(e)}registerTab(t,e){this.tabs.set(t,e),this.broadcastUpdate(t,e)}addClient(t){this.clients.add(t),this.lastRateLimits&&t.readyState===e.WebSocket.OPEN&&t.send(JSON.stringify({type:"rate-limits:update",data:this.lastRateLimits}))}removeClient(t){this.clients.delete(t)}persistToLayout(t){(0,a.updateTabCliStatus)(t.tmuxSession,t.cliState,t.dismissedAt).catch(()=>{})}broadcastUpdate(t,e,s){let a={type:"status:update",tabId:t,cliState:e.cliState,workspaceId:e.workspaceId,tabName:e.tabName,currentProcess:e.currentProcess,paneTitle:e.paneTitle,panelType:e.panelType,terminalStatus:e.terminalStatus,listeningPorts:e.listeningPorts,claudeSummary:e.claudeSummary,lastUserMessage:e.lastUserMessage,lastAssistantMessage:e.lastAssistantMessage,currentAction:e.currentAction,readyForReviewAt:e.readyForReviewAt,busySince:e.busySince,dismissedAt:e.dismissedAt,claudeSessionId:e.claudeSessionId,compactingSince:e.compactingSince,lastEvent:e.lastEvent,eventSeq:e.eventSeq};this.broadcast(a,s)}broadcastRemove(t){this.broadcast({type:"status:update",tabId:t,cliState:null,workspaceId:"",tabName:""})}static BACKPRESSURE_LIMIT=1048576;broadcast(t,s){let a=JSON.stringify(t);for(let t of this.clients)t!==s&&t.readyState===e.WebSocket.OPEN&&t.bufferedAmount<G.BACKPRESSURE_LIMIT&&t.send(a)}async resolveAndWatchJsonl(t,e){let s=this.tabs.get(t);if(!s||s.jsonlPath)return;let o=null,c=(0,a.parseSessionName)(e);if(c){let l=await (0,a.readLayoutFile)((0,a.resolveLayoutFile)(c.wsId));if(l){let a=(0,i.collectAllTabs)(l.root).find(t=>t.sessionName===e);if(a?.claudeSessionId){let t=await (0,n.getSessionCwd)(e);if(t){let e=`${(0,r.cwdToProjectPath)(t)}/${a.claudeSessionId}.jsonl`;try{await y.default.access(e),o=e}catch{}}}a?.lastUserMessage&&s.lastUserMessage!==a.lastUserMessage&&(s.lastUserMessage=a.lastUserMessage,this.broadcastUpdate(t,s))}}if(!o){let t=await (0,n.getSessionPanePid)(e);t&&(o=(await (0,l.detectActiveSession)(t)).jsonlPath)}o&&(s.jsonlPath=o,s.claudeSessionId=J(o)??s.claudeSessionId,"busy"!==s.cliState&&"needs-input"!==s.cliState||this.jsonlWatchers.has(t)||this.startJsonlWatch(t,o))}startJsonlWatch(t,e){let s=this.jsonlWatchers.get(t);if(s?.jsonlPath!==e){s&&this.stopJsonlWatch(t),C.debug("startJsonlWatch tabId=%s path=%s",t,e);try{let s=(0,m.watch)(e,()=>{let s=this.jsonlWatchers.get(t);s&&(s.debounceTimer&&clearTimeout(s.debounceTimer),s.debounceTimer=setTimeout(()=>{this.onJsonlFileChange(t,e).catch(()=>{})},100))});s.on("error",()=>{this.stopJsonlWatch(t)}),this.jsonlWatchers.set(t,{watcher:s,jsonlPath:e,debounceTimer:null})}catch{}}}stopJsonlWatch(t){let e=this.jsonlWatchers.get(t);if(e){C.debug("stopJsonlWatch tabId=%s",t),e.debounceTimer&&clearTimeout(e.debounceTimer);try{e.watcher.close()}catch{}this.jsonlWatchers.delete(t)}}async onJsonlFileChange(t,e){let s=this.tabs.get(t);if(!s||"busy"!==s.cliState&&"needs-input"!==s.cliState&&"unknown"!==s.cliState&&"ready-for-review"!==s.cliState)return void this.stopJsonlWatch(t);let{currentAction:a,lastAssistantSnippet:i,reset:n,interrupted:l,lastEntryTs:r}=await H(e);l&&"busy"===s.cliState&&null!==r&&r>(s.lastInterruptTs??0)&&r>(s.lastEvent?.at??0)&&(s.lastInterruptTs=r,F.debug({tabId:t,lastEntryTs:r},"synthetic interrupt from JSONL"),this.updateTabFromHook(s.tmuxSession,"interrupt"));let o=!1;n?(null!==s.currentAction&&(s.currentAction=null,o=!0),null!==s.lastAssistantMessage&&(s.lastAssistantMessage=null,o=!0)):(null!==a&&a.summary!==s.currentAction?.summary&&(s.currentAction=a,o=!0),null!==i&&s.lastAssistantMessage!==i&&(s.lastAssistantMessage=i,o=!0)),o&&this.broadcastUpdate(t,s)}shutdown(){for(let t of(this.stopPolling(),this.rateLimitsWatcher?.stop(),[...this.jsonlWatchers.keys()]))this.stopJsonlWatch(t);for(let t of this.clients)t.readyState===e.WebSocket.OPEN&&t.close(1001,"Server shutting down");this.clients.clear()}notifyLastUserMessage(t,e){let s=(0,a.parseSessionName)(t);if(!s)return;let i=this.tabs.get(s.tabId);i&&i.lastUserMessage!==e&&(i.lastUserMessage=e,this.broadcastUpdate(s.tabId,i))}async sendWebPush(t,e,a){let i=await (0,R.getSubscriptions)();if(0===i.length)return;let n=await (0,N.getVAPIDKeys)();x.default.setVapidDetails("mailto:noreply@purplemux.app",n.publicKey,n.privateKey);let l=e.lastUserMessage?.slice(0,100)||e.tabName||t,r=(await (0,s.getWorkspaces)()).workspaces.find(t=>t.id===e.workspaceId),o=JSON.stringify({title:"needs-input"===a?"Input Required":"Task Complete",body:l,tabId:t,workspaceId:e.workspaceId,claudeSessionId:e.claudeSessionId??null,workspaceName:r?.name??"",workspaceDir:r?.directories[0]??null});if(!(0,R.isAnyDeviceVisible)())for(let t of i)try{await x.default.sendNotification(t,o)}catch(s){let e=s.statusCode;(410===e||404===e)&&await (0,R.removeSubscription)(t.endpoint),C.warn("Web push send error: %s",e)}}}t.s(["getStatusManager",0,()=>{if(!X.__ptStatusManager){let t=new G;X.__ptStatusManager=t,(0,a.setLayoutReconciler)({reconcileWorkspaceTabs:(e,s)=>t.reconcileWorkspaceTabs(e,s),removeWorkspaceTabs:e=>t.removeWorkspaceTabs(e)})}return X.__ptStatusManager}],964759)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_lib_status-manager_ts_003hlhy._.js.map
|