@yuku123/z-team-component 0.2.88 → 0.2.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/{ChangeLogView-NTgsfOSm.js → ChangeLogView-DagOxr6O.js} +1 -1
  2. package/dist/{ComponentDoc-C_9NDft5.js → ComponentDoc-CP8PmT4l.js} +3 -3
  3. package/dist/ComponentDoc-D1vtx1CE.js +3998 -0
  4. package/dist/{InvitationManagementPage-BG8Mpbt2.js → InvitationManagementPage-C-8t565B.js} +1 -1
  5. package/dist/InvitationManagementPage-DDx-AX4v.js +495 -0
  6. package/dist/{OnboardingPage-DFd0xco-.js → OnboardingPage-DUUHQLSp.js} +2 -2
  7. package/dist/OnboardingPage-DUVza4FC.js +393 -0
  8. package/dist/ScheduledTasks-BSJP-8rB.js +10708 -0
  9. package/dist/ScheduledTasks-CGNB0zlb.js +10708 -0
  10. package/dist/{SystemShell-uZ1sd-J6.js → SystemShell-DTFR-Pfd.js} +5 -5
  11. package/dist/SystemShell-DZ-W2gUt.js +689 -0
  12. package/dist/{api-0JOL66LK.js → api-BftpestH.js} +392 -391
  13. package/dist/{api-F3Y96sko.js → api-GfWm5pTp.js} +1 -1
  14. package/dist/api-nf4Uaca5.js +20 -0
  15. package/dist/{createWorkspaceWsHandler-DQZwHUBx.js → createWorkspaceWsHandler-rKc7vc8k.js} +4579 -4532
  16. package/dist/{index-UiavaizS.js → index-3qkbu-HG.js} +1520 -1509
  17. package/dist/{index-CLBXAp2N.js → index-9Vozb4E5.js} +3 -3
  18. package/dist/{index-DBb5VQw-.js → index-B1lzhb6f.js} +1 -1
  19. package/dist/{index-BmmzWO1c.js → index-B51WSpDM.js} +7 -7
  20. package/dist/{index-Ch7aeuH5.js → index-B5dDwxhs.js} +1 -1
  21. package/dist/{index-BqyNh0xw.js → index-BMQ6XkO3.js} +1 -1
  22. package/dist/{index-w2dEymcR.js → index-BR0HXBjY.js} +3 -3
  23. package/dist/index-B_H-Ynz5.js +9844 -0
  24. package/dist/index-BngdCYiY.js +149 -0
  25. package/dist/{index-B7XgDudF.js → index-BqG6XqTh.js} +2 -2
  26. package/dist/{index-BnpvrcjU.js → index-BxBGVGKQ.js} +4 -4
  27. package/dist/{index-BPvg2-3g.js → index-C1kpuot_.js} +2 -2
  28. package/dist/{index-Bfg9EVcF.js → index-C5FC0WCa.js} +5 -5
  29. package/dist/{index-Bqtk18nN.js → index-CHTu5H1U.js} +3 -3
  30. package/dist/{index-CWui9wFp.js → index-CUhSJJL0.js} +2 -2
  31. package/dist/index-D8ncig8C.js +149 -0
  32. package/dist/index-D92Y4nix.js +178 -0
  33. package/dist/index-DTFcQizU.js +3488 -0
  34. package/dist/index-D_t92tEF.js +2700 -0
  35. package/dist/{index-Czw72Bov.js → index-DcHrkop2.js} +3 -3
  36. package/dist/index-DelMCvoP.js +118 -0
  37. package/dist/{index-BYzj7oPE.js → index-DoC-nKZZ.js} +2 -2
  38. package/dist/index-Dxx0UEBW.js +93 -0
  39. package/dist/{index-D8Gfs8hx.js → index-DyFaoD5W.js} +2 -2
  40. package/dist/index-EdPtymBD.js +574 -0
  41. package/dist/index-JS2OVZ4Q.js +3488 -0
  42. package/dist/index-LkYDFjtJ.js +914 -0
  43. package/dist/{index-Dg2HcBzv.js → index-MYohlrH6.js} +4 -4
  44. package/dist/{index-s6svdmEi.js → index-VGtET31b.js} +1 -1
  45. package/dist/index-d7BD8lzt.js +242 -0
  46. package/dist/{index-C4th4Aoe.js → index-ji8TPz9K.js} +4 -4
  47. package/dist/index-mIk8zAAm.js +1143 -0
  48. package/dist/index-p1jMVRnp.js +112 -0
  49. package/dist/{index-YNiDI1gx.js → index-pScDd5cp.js} +6 -6
  50. package/dist/{index-iFmkxmf9.js → index-s_ikMJ2V.js} +1 -1
  51. package/dist/{index-0x46DewW.js → index-v3WaXkDJ.js} +3 -3
  52. package/dist/index.js +1 -1
  53. package/dist/{instance-BCsQR-qS.js → instance-CI6-4BZ6.js} +1 -1
  54. package/dist/{menuPermission-cHXJpApG.js → menuPermission-CF3r6JEV.js} +3 -3
  55. package/dist/menuPermission-CZvOK8eU.js +60 -0
  56. package/dist/pages.js +1 -1
  57. package/dist/{personal-DEVcqGLw.js → personal-D-eMMf0_.js} +2 -2
  58. package/dist/{schedule-B0EBBRli.js → schedule-ChO2xIGd.js} +1 -1
  59. package/dist/{send-default-agent-team-message-yWr8M0Tf.js → send-default-agent-team-message-c5oKdQQA.js} +1 -1
  60. package/dist/{sso-user-VnBakX7L.js → sso-user-DToM5dPy.js} +1 -1
  61. package/dist/{training-DDChztdn.js → training-B38tnwLL.js} +1 -1
  62. package/dist/{useAppStore-Db3-RUiE.js → useAppStore-BFO_h1L2.js} +1 -1
  63. package/dist/{webide-DIyLJmHA.js → webide-DTZ46LPR.js} +4 -4
  64. package/dist/z-team-component.css +2 -2
  65. package/package.json +1 -1
  66. package/dist/ScheduledTasks-C1ZHUXKI.js +0 -9809
  67. package/dist/index-CAUSIiIP.js +0 -139
  68. package/dist/index-DgwMPSIc.js +0 -3312
@@ -1,3312 +0,0 @@
1
- import { jsx as e, jsxs as l, Fragment as et } from "react/jsx-runtime";
2
- import { S as ln, T as rn, P as on } from "./webide-DIyLJmHA.js";
3
- import { RightOutlined as cn, PlusOutlined as dn, LeftOutlined as Mn, CheckOutlined as un, LoadingOutlined as Bt, EditOutlined as Gt, DeleteOutlined as En, FolderOpenOutlined as Ot, DownOutlined as Lt, UpOutlined as Dt, RedoOutlined as On, StopOutlined as xn, CloseOutlined as $n, FolderOutlined as Rn, CopyOutlined as Pn, MessageOutlined as pn, MoreOutlined as qn, DashboardOutlined as hn, MenuUnfoldOutlined as Hn, MenuFoldOutlined as Fn, SettingOutlined as mn, TeamOutlined as jn, BarChartOutlined as Kn, PieChartOutlined as Wn, CodeOutlined as Un, LinkOutlined as Vn, UnorderedListOutlined as gn, FileTextOutlined as jt, ReadOutlined as Gn, ConsoleSqlOutlined as zn, PlayCircleOutlined as Zn, ClockCircleOutlined as Qn, AppstoreOutlined as Xn } from "@ant-design/icons";
4
- import { useState as m, useRef as V, useMemo as fe, useEffect as P, useCallback as Q } from "react";
5
- import { af as Yn, ag as _n, k as it, ah as Jn, ai as es, aj as ts, ak as ns, al as ss, am as as, an as ls } from "./api-0JOL66LK.js";
6
- import { l as is, f as fn, c as Mt, a as rs, b as os, u as cs, r as ds, s as us, t as ps, d as xt, e as $t, g as hs, h as ms, i as yn, j as u, T as gs, R as Rt, D as Ct, k as _s, m as fs, F as Pt, P as ys, L as bs, A as vs, C as Ns, n as ks, o as Cs, p as ws, q as zt, v as Zt, W as Ts, w as Is, S as Ss, x as As, y as Bs, U as Ls, z as Ds, B as Ms, E as Es } from "./index-UiavaizS.js";
7
- import { u as Kt, a as kt, i as bn, T as Os, b as xs, s as Qt } from "./createWorkspaceWsHandler-DQZwHUBx.js";
8
- import { u as $e } from "./useAppStore-Db3-RUiE.js";
9
- import { h as vn, f as $s } from "./schedule-B0EBBRli.js";
10
- import Rs from "react-markdown";
11
- import Ps from "rehype-highlight";
12
- import qs from "remark-gfm";
13
- import { W as qt, b as wt, T as Nn, c as kn, a as Cn, P as wn, S as Hs, E as Fs, C as js } from "./ScheduledTasks-C1ZHUXKI.js";
14
- import { message as vt, Tooltip as Ht } from "antd";
15
- const Ks = "_container_u2p4q_1", Ws = "_sessionPanel_u2p4q_9", Us = "_sessionHeader_u2p4q_19", Vs = "_sessionHeaderActions_u2p4q_32", Gs = "_sessionBtnSm_u2p4q_37", zs = "_sessionList_u2p4q_55", Zs = "_sessionItem_u2p4q_61", Qs = "_sessionItemActive_u2p4q_79", Xs = "_sessionItemTitle_u2p4q_84", Ys = "_sessionLiveDot_u2p4q_93", Js = "_sessionItemTime_u2p4q_100", ea = "_sessionDeleteBtn_u2p4q_106", ta = "_sessionRenameBtn_u2p4q_127", na = "_sessionRenameInput_u2p4q_148", sa = "_sessionCreateRow_u2p4q_160", aa = "_sessionCreateInput_u2p4q_166", la = "_sessionCreateConfirm_u2p4q_180", ia = "_sessionCreateCancel_u2p4q_181", ra = "_sessionSearchRow_u2p4q_203", oa = "_sessionSearchInput_u2p4q_209", ca = "_sessionSearchClear_u2p4q_224", da = "_sessionEmpty_u2p4q_245", ua = "_sessionExpandBtn_u2p4q_255", pa = "_chatPanel_u2p4q_275", ha = "_chatHeader_u2p4q_284", ma = "_agentAvatar_u2p4q_296", ga = "_chatHeaderMeta_u2p4q_309", _a = "_chatHeaderName_u2p4q_317", fa = "_chatHeaderSession_u2p4q_324", ya = "_chatHeaderBadge_u2p4q_332", ba = "_streamingIndicator_u2p4q_342", va = "_threadScroll_u2p4q_351", Na = "_threadInner_u2p4q_357", ka = "_landing_u2p4q_368", Ca = "_landingLogo_u2p4q_378", wa = "_landingTitle_u2p4q_392", Ta = "_landingHint_u2p4q_398", Ia = "_newChatLanding_u2p4q_404", Sa = "_landingComposer_u2p4q_415", Aa = "_landingInput_u2p4q_432", Ba = "_chatEmpty_u2p4q_448", La = "_userRow_u2p4q_459", Da = "_userBubble_u2p4q_464", Ma = "_assistantBlock_u2p4q_478", Ea = "_md_u2p4q_488", Oa = "_mdPreWrap_u2p4q_546", xa = "_mdPreCopy_u2p4q_550", $a = "_thinkingHint_u2p4q_585", Ra = "_caretCursor_u2p4q_600", Pa = "_errorBar_u2p4q_617", qa = "_errorRetryBtn_u2p4q_626", Ha = "_stoppedBar_u2p4q_641", Fa = "_scrollTopBtn_u2p4q_651", ja = "_scrollTopBtnVisible_u2p4q_673", Ka = "_composerWrap_u2p4q_684", Wa = "_composer_u2p4q_684", Ua = "_composerInput_u2p4q_706", Va = "_sendBtn_u2p4q_724", Ga = "_stopBtn_u2p4q_725", za = "_sendBtnReady_u2p4q_745", Za = "_composerHint_u2p4q_763", Qa = "_msgMeta_u2p4q_773", Xa = "_copyBtn_u2p4q_784", Ya = "_copyBtnInline_u2p4q_814", Ja = "_copyBtnDone_u2p4q_821", el = "_landingChips_u2p4q_826", tl = "_landingChip_u2p4q_826", nl = "_userActions_u2p4q_853", sl = "_userActionBtn_u2p4q_866", al = "_editingBar_u2p4q_889", ll = "_pendingBar_u2p4q_904", il = "_editingCancel_u2p4q_925", rl = "_workdirBar_u2p4q_942", ol = "_workdirChip_u2p4q_951", cl = "_workdirCaret_u2p4q_978", dl = "_workdirPath_u2p4q_983", ul = "_dirMask_u2p4q_993", pl = "_dirModal_u2p4q_1003", hl = "_dirHead_u2p4q_1014", ml = "_dirClose_u2p4q_1024", gl = "_dirBar_u2p4q_1041", _l = "_dirUp_u2p4q_1049", fl = "_dirPathText_u2p4q_1068", yl = "_dirList_u2p4q_1077", bl = "_dirItem_u2p4q_1084", vl = "_dirEmpty_u2p4q_1109", Nl = "_dirError_u2p4q_1119", kl = "_dirFoot_u2p4q_1125", Cl = "_dirCancel_u2p4q_1133", wl = "_dirConfirm_u2p4q_1134", a = {
16
- container: Ks,
17
- sessionPanel: Ws,
18
- sessionHeader: Us,
19
- sessionHeaderActions: Vs,
20
- sessionBtnSm: Gs,
21
- sessionList: zs,
22
- sessionItem: Zs,
23
- sessionItemActive: Qs,
24
- sessionItemTitle: Xs,
25
- sessionLiveDot: Ys,
26
- sessionItemTime: Js,
27
- sessionDeleteBtn: ea,
28
- sessionRenameBtn: ta,
29
- sessionRenameInput: na,
30
- sessionCreateRow: sa,
31
- sessionCreateInput: aa,
32
- sessionCreateConfirm: la,
33
- sessionCreateCancel: ia,
34
- sessionSearchRow: ra,
35
- sessionSearchInput: oa,
36
- sessionSearchClear: ca,
37
- sessionEmpty: da,
38
- sessionExpandBtn: ua,
39
- chatPanel: pa,
40
- chatHeader: ha,
41
- agentAvatar: ma,
42
- chatHeaderMeta: ga,
43
- chatHeaderName: _a,
44
- chatHeaderSession: fa,
45
- chatHeaderBadge: ya,
46
- streamingIndicator: ba,
47
- threadScroll: va,
48
- threadInner: Na,
49
- landing: ka,
50
- landingLogo: Ca,
51
- landingTitle: wa,
52
- landingHint: Ta,
53
- newChatLanding: Ia,
54
- landingComposer: Sa,
55
- landingInput: Aa,
56
- chatEmpty: Ba,
57
- userRow: La,
58
- userBubble: Da,
59
- assistantBlock: Ma,
60
- md: Ea,
61
- mdPreWrap: Oa,
62
- mdPreCopy: xa,
63
- thinkingHint: $a,
64
- caretCursor: Ra,
65
- errorBar: Pa,
66
- errorRetryBtn: qa,
67
- stoppedBar: Ha,
68
- scrollTopBtn: Fa,
69
- scrollTopBtnVisible: ja,
70
- composerWrap: Ka,
71
- composer: Wa,
72
- composerInput: Ua,
73
- sendBtn: Va,
74
- stopBtn: Ga,
75
- sendBtnReady: za,
76
- composerHint: Za,
77
- msgMeta: Qa,
78
- copyBtn: Xa,
79
- copyBtnInline: Ya,
80
- copyBtnDone: Ja,
81
- landingChips: el,
82
- landingChip: tl,
83
- userActions: nl,
84
- userActionBtn: sl,
85
- editingBar: al,
86
- pendingBar: ll,
87
- editingCancel: il,
88
- workdirBar: rl,
89
- workdirChip: ol,
90
- workdirCaret: cl,
91
- workdirPath: dl,
92
- dirMask: ul,
93
- dirModal: pl,
94
- dirHead: hl,
95
- dirClose: ml,
96
- dirBar: gl,
97
- dirUp: _l,
98
- dirPathText: fl,
99
- dirList: yl,
100
- dirItem: bl,
101
- dirEmpty: vl,
102
- dirError: Nl,
103
- dirFoot: kl,
104
- dirCancel: Cl,
105
- dirConfirm: wl
106
- };
107
- function Tl(s) {
108
- if (s && s.trim().startsWith("{"))
109
- try {
110
- const r = JSON.parse(s);
111
- if (r && Array.isArray(r.z_team_blocks))
112
- return {
113
- blocks: r.z_team_blocks,
114
- totalMs: typeof r.totalMs == "number" ? r.totalMs : void 0,
115
- usage: r.usage ?? void 0,
116
- stopped: r.stopped === !0
117
- };
118
- } catch {
119
- }
120
- return null;
121
- }
122
- function Xt(s) {
123
- return (s || []).map((r, h) => {
124
- const _ = Tl(r.content);
125
- return {
126
- id: `local-${r.timestamp}-${r.role}-${h}`,
127
- role: r.role === "assistant" ? "assistant" : "user",
128
- blocks: _ ? _.blocks : [{ type: "text", text: r.content }],
129
- totalMs: _ == null ? void 0 : _.totalMs,
130
- usage: _ == null ? void 0 : _.usage,
131
- stopped: (_ == null ? void 0 : _.stopped) === !0
132
- };
133
- });
134
- }
135
- function lt(s) {
136
- return s.filter((r) => r.type === "text").map((r) => r.text).join("");
137
- }
138
- function Il(s) {
139
- return s >= 1e4 ? `${Math.round(s / 1e3)}k` : s >= 1e3 ? `${(s / 1e3).toFixed(1)}k` : String(s);
140
- }
141
- function Sl(s) {
142
- if (s == null || s <= 0) return "";
143
- const r = Date.now() - s;
144
- if (r < 6e4) return "刚刚";
145
- if (r < 36e5) return `${Math.floor(r / 6e4)} 分钟前`;
146
- if (r < 864e5) return `${Math.floor(r / 36e5)} 小时前`;
147
- const h = new Date(Date.now() - 864e5);
148
- if (new Date(s).toDateString() === h.toDateString()) return "昨天";
149
- const _ = new Date(s);
150
- return `${_.getMonth() + 1}-${String(_.getDate()).padStart(2, "0")}`;
151
- }
152
- const Yt = [
153
- "#2F70F1",
154
- "#52c41a",
155
- "#fa8c16",
156
- "#eb2f96",
157
- "#722ed1",
158
- "#13c2c2",
159
- "#f522d0",
160
- "#faad14"
161
- ];
162
- function Jt(s) {
163
- let r = 0;
164
- for (let h = 0; h < s.length; h++) r = r * 31 + s.charCodeAt(h) | 0;
165
- return Yt[Math.abs(r) % Yt.length];
166
- }
167
- function Et(s) {
168
- return s ? s.charAt(0).toUpperCase() : "?";
169
- }
170
- function Al({ children: s }) {
171
- const r = V(null);
172
- return /* @__PURE__ */ l("div", { className: a.mdPreWrap, children: [
173
- /* @__PURE__ */ e("div", { className: a.mdPreCopy, children: /* @__PURE__ */ e(Ft, { getText: () => {
174
- var h;
175
- return ((h = r.current) == null ? void 0 : h.textContent) ?? "";
176
- } }) }),
177
- /* @__PURE__ */ e("pre", { ref: r, children: s })
178
- ] });
179
- }
180
- function Bl({ text: s }) {
181
- return /* @__PURE__ */ e("div", { className: a.md, children: /* @__PURE__ */ e(
182
- Rs,
183
- {
184
- remarkPlugins: [qs],
185
- rehypePlugins: [Ps],
186
- components: {
187
- pre: (r) => /* @__PURE__ */ e(Al, { children: r.children })
188
- },
189
- children: s
190
- }
191
- ) });
192
- }
193
- function Ll({ startedAtMs: s }) {
194
- const [, r] = m(0);
195
- P(() => {
196
- const _ = window.setInterval(() => r((I) => I + 1), 1e3);
197
- return () => window.clearInterval(_);
198
- }, []);
199
- const h = Math.max(1, Math.round((Date.now() - s) / 1e3));
200
- return /* @__PURE__ */ l("div", { className: a.msgMeta, children: [
201
- h,
202
- "s…"
203
- ] });
204
- }
205
- function Dl(s) {
206
- var r;
207
- if ((r = navigator.clipboard) != null && r.writeText)
208
- return navigator.clipboard.writeText(s).catch(() => {
209
- }), !0;
210
- try {
211
- const h = document.createElement("textarea");
212
- h.value = s, h.style.position = "fixed", h.style.opacity = "0", document.body.appendChild(h), h.select();
213
- const _ = document.execCommand("copy");
214
- return document.body.removeChild(h), _;
215
- } catch {
216
- return !1;
217
- }
218
- }
219
- function Ft({
220
- getText: s,
221
- inline: r,
222
- label: h = "复制正文"
223
- }) {
224
- const [_, I] = m(!1);
225
- return /* @__PURE__ */ e(
226
- "button",
227
- {
228
- type: "button",
229
- className: `${a.copyBtn} ${r ? a.copyBtnInline : ""} ${_ ? a.copyBtnDone : ""}`,
230
- onClick: () => {
231
- const M = s();
232
- !M || !Dl(M) || (I(!0), window.setTimeout(() => I(!1), 1600));
233
- },
234
- title: h,
235
- "aria-label": h,
236
- children: _ ? /* @__PURE__ */ e(un, {}) : /* @__PURE__ */ e(Pn, {})
237
- }
238
- );
239
- }
240
- const en = "ft_local_workdir", tn = [
241
- "查看当前目录的文件列表",
242
- "总结当前目录里各文件的内容",
243
- "帮我写一个脚本统计各文件的行数",
244
- "说明一下你能使用哪些工具"
245
- ];
246
- function Tn({
247
- agent: s,
248
- newSessionTrigger: r = 0,
249
- autoSendDraft: h = null,
250
- onAutoSendConsumed: _,
251
- openSessionId: I = null,
252
- onOpenSessionConsumed: M,
253
- onSessionsMutated: b
254
- }) {
255
- var Vt;
256
- const E = $e((t) => t.currentUser), Y = Kt(), [x, H] = m([]), [X, K] = m(""), [w, C] = m(null), [J, S] = m(""), G = V(!1), te = fe(() => {
257
- const t = X.trim().toLowerCase();
258
- return t ? x.filter((o) => o.title.toLowerCase().includes(t)) : x;
259
- }, [x, X]), [N, U] = m(
260
- null
261
- ), [W, A] = m([]), [ne, ee] = m(""), [F, $] = m(!1), q = V(!1), y = V(null), [se, Ie] = m(null), ae = V(null), he = V(null), ke = V(null);
262
- P(() => {
263
- ke.current = N;
264
- }, [N]);
265
- const Ce = V(/* @__PURE__ */ new Map()), tt = V(null), ye = (t) => {
266
- q.current = t, $(t);
267
- }, [me, Se] = m(!1), [ce, De] = m(""), [we, Re] = m(!1), [Pe, Ae] = m(!1), [le, be] = m(""), [qe, Be] = m(
268
- () => localStorage.getItem("ft_local_session_collapsed") !== "false"
269
- ), [rt, i] = m(!0), [T, ie] = m(!1), [ge, He] = m(null), [Fe, Tt] = m(
270
- () => localStorage.getItem(en)
271
- ), [We, Ye] = m(!1), [O, ot] = m(null), [nt, pe] = m(!1), [Ue, re] = m(null), st = fe(
272
- () => {
273
- var t;
274
- return ((t = x.find((o) => o.id === N)) == null ? void 0 : t.workdir) ?? null;
275
- },
276
- [x, N]
277
- ), Ve = N ? st : Fe, Me = Q(async (t) => {
278
- pe(!0), re(null);
279
- try {
280
- ot(await is(t));
281
- } catch (o) {
282
- re(o instanceof Error ? o.message : "读取目录失败");
283
- } finally {
284
- pe(!1);
285
- }
286
- }, []), ct = () => {
287
- Ye(!0), Me((O == null ? void 0 : O.path) ?? Ve ?? void 0);
288
- }, ht = async (t) => {
289
- if (Ye(!1), localStorage.setItem(en, t), Tt(t), !!N)
290
- try {
291
- const o = await cs(N, t);
292
- H((d) => d.map((k) => k.id === o.id ? o : k)), b == null || b();
293
- } catch (o) {
294
- re(o instanceof Error ? o.message : "绑定工作目录失败");
295
- }
296
- }, dt = (t) => {
297
- if (!t) return "选择工作目录";
298
- const o = t.split("/").filter(Boolean);
299
- return o.length ? o[o.length - 1] : t;
300
- }, Le = V(null), de = V(null), Ge = V(null), ze = V(null), je = V(!0), Ee = V(!1), Te = V([]);
301
- P(() => {
302
- Te.current = W;
303
- }, [W]);
304
- const Oe = V(null), _e = V(null), at = Q(
305
- (t, o) => {
306
- const d = _e.current;
307
- if (d && d.sid === t) {
308
- d.messages = o(d.messages), ke.current === t && A(d.messages);
309
- return;
310
- }
311
- A((k) => o(k));
312
- },
313
- []
314
- ), mt = F ? ((Vt = _e.current) == null ? void 0 : Vt.sid) ?? null : null, gt = Q(async () => {
315
- try {
316
- const t = await fn(s == null ? void 0 : s.localAgentId);
317
- return H(t), i(!0), t;
318
- } catch {
319
- return i(!1), H([]), [];
320
- }
321
- }, [s == null ? void 0 : s.localAgentId]);
322
- P(() => {
323
- U(null), A([]), K(""), gt().then((t) => {
324
- if (t.length > 0) {
325
- const o = [...t].sort(
326
- (d, k) => new Date(k.updatedAt).getTime() - new Date(d.updatedAt).getTime()
327
- )[0];
328
- U(o.id);
329
- }
330
- });
331
- }, [gt]), P(() => {
332
- r > 0 && (async () => {
333
- try {
334
- const t = await Mt(
335
- "新会话",
336
- s == null ? void 0 : s.localAgentId,
337
- Fe
338
- );
339
- H((o) => [t, ...o]), b == null || b(), Ee.current = !0, U(t.id), A([]), K("");
340
- } catch {
341
- Ae(!0), be("");
342
- }
343
- })();
344
- }, [r]);
345
- const Je = V(!1);
346
- P(() => {
347
- !h || Je.current || (Je.current = !0, _ == null || _(), bt(h));
348
- }, []);
349
- const _t = V(null);
350
- P(() => {
351
- !I || _t.current === I || (_t.current = I, U(I), M == null || M());
352
- }, [I, M]), P(() => {
353
- const t = tt.current;
354
- if (t != null && t !== N) {
355
- Ce.current.set(t, ne);
356
- const k = Ce.current.get(N ?? "") ?? "";
357
- ee(k), requestAnimationFrame(() => {
358
- const g = de.current;
359
- g && (g.style.height = "auto", g.style.height = Math.min(g.scrollHeight, 180) + "px");
360
- });
361
- }
362
- if (tt.current = N, Oe.current !== N && (Oe.current = null), !N) {
363
- A([]), Se(!1);
364
- return;
365
- }
366
- const o = _e.current;
367
- if (o && o.sid === N) {
368
- if (je.current = !0, A(o.messages), o.messages.some((k) => k.streaming || k.error)) return;
369
- _e.current = null;
370
- }
371
- if (Ee.current) {
372
- Ee.current = !1, Se(!1);
373
- return;
374
- }
375
- let d = !1;
376
- return Se(!0), rs(N).then((k) => {
377
- if (d) return;
378
- const g = _e.current;
379
- q.current || g && g.sid === N || Oe.current === N || (Oe.current = null, A(Xt(k.messages)));
380
- }).catch(() => {
381
- d || q.current || Oe.current === N || A([]);
382
- }).finally(() => {
383
- d || Se(!1);
384
- }), () => {
385
- d = !0;
386
- };
387
- }, [N]), P(() => {
388
- je.current && Le.current && (Le.current.scrollTop = Le.current.scrollHeight);
389
- }, [W]);
390
- const It = Q(() => {
391
- const t = Le.current;
392
- if (!t) return;
393
- const o = t.scrollHeight - t.scrollTop - t.clientHeight;
394
- je.current = o < 80, ie(o > 120);
395
- }, []), St = Q(() => {
396
- const t = Le.current;
397
- t && (t.scrollTop = t.scrollHeight), je.current = !0, ie(!1);
398
- }, []);
399
- P(() => {
400
- localStorage.setItem(
401
- "ft_local_session_collapsed",
402
- qe ? "true" : "false"
403
- );
404
- }, [qe]);
405
- const ft = async () => {
406
- const t = le.trim() || "新会话";
407
- try {
408
- const o = await Mt(
409
- t,
410
- s == null ? void 0 : s.localAgentId,
411
- Fe
412
- );
413
- H((d) => [o, ...d]), b == null || b(), Ee.current = !0, U(o.id), A([]), Ae(!1), be(""), K("");
414
- } catch {
415
- }
416
- }, yt = (t) => {
417
- C(t.id), S(t.title), G.current = !1;
418
- }, ve = async () => {
419
- if (G.current) return;
420
- G.current = !0;
421
- const t = w, o = J.trim();
422
- if (C(null), !(!t || !o))
423
- try {
424
- await ds(t, o), H(
425
- (d) => d.map((k) => k.id === t ? { ...k, title: o } : k)
426
- );
427
- } catch {
428
- }
429
- }, n = async (t) => {
430
- if (await kt({ content: "确定删除此会话吗?" })) {
431
- q.current && ze.current === t && v();
432
- try {
433
- await Yn(t), H((o) => o.filter((d) => d.id !== t)), N === t && (U(null), A([]));
434
- } catch {
435
- }
436
- }
437
- }, c = Q(
438
- (t, o, d, k) => {
439
- at(
440
- t,
441
- (g) => g.map((D) => {
442
- if (D.id !== o) return D;
443
- const j = Date.now();
444
- let B = {};
445
- d === "thinking" && D.thinkingStartMs == null ? B = { thinkingStartMs: j } : d === "text" && D.thinkingStartMs != null && D.thinkingMs == null && (B = { thinkingMs: j - D.thinkingStartMs });
446
- const Z = [...D.blocks], ue = Z[Z.length - 1];
447
- return ue != null && (d === "text" && ue.type === "text" || d === "thinking" && ue.type === "thinking") && ue ? Z[Z.length - 1] = {
448
- ...ue,
449
- text: ue.text + k
450
- } : Z.push({ type: d, text: k }), { ...D, ...B, blocks: Z };
451
- })
452
- );
453
- },
454
- [at]
455
- ), f = Q(
456
- (t, o, d) => {
457
- at(
458
- t,
459
- (k) => k.map((g) => {
460
- if (g.id !== o) return g;
461
- const D = Date.now(), j = g.thinkingStartMs != null && g.thinkingMs == null ? { thinkingMs: D - g.thinkingStartMs } : {}, B = [...g.blocks];
462
- if (d.kind === "tool_call")
463
- B.push({
464
- type: "tool_call",
465
- id: d.id,
466
- name: d.name,
467
- input: d.input,
468
- _t0: D
469
- });
470
- else if (d.kind === "tool_end")
471
- for (let Z = B.length - 1; Z >= 0; Z--) {
472
- const ue = B[Z];
473
- if (ue.type === "tool_call" && d.id && ue.id === d.id) {
474
- B[Z] = { ...ue, input: d.input };
475
- break;
476
- }
477
- }
478
- else d.kind === "tool_result" && B.push({
479
- type: "tool_result",
480
- id: d.id,
481
- content: d.content,
482
- _t1: D
483
- });
484
- return { ...g, ...j, blocks: B };
485
- })
486
- );
487
- },
488
- [at]
489
- ), v = Q(() => {
490
- var g;
491
- const t = ze.current;
492
- ze.current = null, (g = Ge.current) == null || g.abort(), Ge.current = null, ye(!1), t && os(t).catch(() => {
493
- });
494
- const o = _e.current;
495
- _e.current = null;
496
- const d = (D) => D.map(
497
- (j) => j.streaming ? {
498
- ...j,
499
- streaming: !1,
500
- stopped: !0,
501
- // 停止回合也结算耗时(与 onComplete 一致),避免「已停止生成」缺耗时显示
502
- durationMs: j.startedAtMs != null ? Date.now() - j.startedAtMs : void 0
503
- } : j
504
- );
505
- o && t && o.sid === t ? ke.current === t && A(d(o.messages)) : A((D) => d(D));
506
- const k = ae.current;
507
- ae.current = null, he.current = null, Ie(null), k && ee((D) => D ? D + `
508
- ` + k : k);
509
- }, []);
510
- P(() => {
511
- const t = (o) => {
512
- if (o.key !== "Escape" || o.isComposing) return;
513
- const d = o.target;
514
- d && (d.tagName === "TEXTAREA" || d.tagName === "INPUT") || (F ? (o.preventDefault(), v()) : ge != null && (o.preventDefault(), He(null), de.current && (de.current.style.height = "auto")));
515
- };
516
- return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
517
- }, [F, ge, v]);
518
- const R = async (t, o) => {
519
- const d = o ?? N;
520
- if (!d || !t || q.current) return;
521
- y.current = null, Se(!1);
522
- const k = {
523
- id: `local-user-${Date.now()}`,
524
- role: "user",
525
- blocks: [{ type: "text", text: t }]
526
- }, g = `local-assistant-${Date.now()}`, D = {
527
- id: g,
528
- role: "assistant",
529
- blocks: [],
530
- streaming: !0,
531
- startedAtMs: Date.now()
532
- };
533
- Oe.current = d, A((B) => {
534
- const Z = [...B, k, D];
535
- return _e.current = { sid: d, messages: Z }, Z;
536
- }), ye(!0), ze.current = d, je.current = !0;
537
- const j = new AbortController();
538
- Ge.current = j, await us(
539
- d,
540
- t,
541
- {
542
- onToken: (B) => c(d, g, "text", B),
543
- onReasoning: (B) => c(d, g, "thinking", B),
544
- onEvent: (B) => f(d, g, B),
545
- onFinal: (B) => {
546
- y.current = B;
547
- },
548
- onError: (B) => {
549
- y.current = null, ye(!1), Ge.current = null, ze.current = null;
550
- const Z = _e.current, ue = (xe) => xe.map(
551
- (Ne) => Ne.id === g ? {
552
- ...Ne,
553
- streaming: !1,
554
- // 出错回合也结算耗时(重发/重试前能看到该回合跑了多久)
555
- durationMs: Ne.startedAtMs != null ? Date.now() - Ne.startedAtMs : void 0,
556
- error: Ne.blocks.length ? B.message : `[错误] ${B.message}`
557
- } : Ne
558
- );
559
- Z && Z.sid === d ? (Z.messages = ue(Z.messages), ke.current === d && A(Z.messages)) : A((xe) => ue(xe));
560
- const Ke = ae.current;
561
- ae.current = null, he.current = null, Ie(null), Ke && ee((xe) => xe ? xe + `
562
- ` + Ke : Ke);
563
- },
564
- onComplete: () => {
565
- ye(!1), Ge.current = null, ze.current = null;
566
- const B = y.current;
567
- y.current = null;
568
- const Z = _e.current;
569
- _e.current = null;
570
- const ue = (Ne) => Ne.map(
571
- (Ze) => Ze.id === g ? {
572
- ...Ze,
573
- streaming: !1,
574
- durationMs: (B == null ? void 0 : B.totalMs) ?? (Ze.startedAtMs != null ? Date.now() - Ze.startedAtMs : void 0),
575
- totalMs: (B == null ? void 0 : B.totalMs) ?? Ze.totalMs,
576
- stopped: Ze.stopped || (B == null ? void 0 : B.stopped) === !0,
577
- usage: Ze.usage ?? (B == null ? void 0 : B.usage)
578
- } : Ze
579
- );
580
- Z && Z.sid === d ? ke.current === d && A(ue(Z.messages)) : A((Ne) => ue(Ne));
581
- const Ke = ae.current, xe = he.current;
582
- ae.current = null, he.current = null, Ie(null), Ke && (xe && ke.current === xe ? R(Ke, xe) : ee((Ne) => Ne ? Ne + `
583
- ` + Ke : Ke));
584
- }
585
- },
586
- {
587
- agentType: s == null ? void 0 : s.localAgentType,
588
- agentId: s == null ? void 0 : s.localAgentId,
589
- signal: j.signal
590
- }
591
- );
592
- }, L = async (t, o) => {
593
- if (N)
594
- try {
595
- const { session: d, previousId: k } = await ps(
596
- N,
597
- t
598
- );
599
- Ee.current = !0, H(
600
- (g) => g.map((D) => D.id === k ? d : D)
601
- ), U(d.id), A(Xt(d.messages)), await R(o, d.id);
602
- } catch {
603
- await R(o);
604
- }
605
- }, z = (t, o) => {
606
- F || (ee(o), He(t), requestAnimationFrame(() => {
607
- const d = de.current;
608
- d && (d.focus(), d.style.height = "auto", d.style.height = Math.min(d.scrollHeight, 180) + "px");
609
- }));
610
- }, ut = () => {
611
- He(null), de.current && (de.current.style.height = "auto");
612
- }, An = () => {
613
- const t = ae.current;
614
- ae.current = null, Ie(null), t && ee((o) => o ? o + `
615
- ` + t : t);
616
- }, bt = async (t) => {
617
- const o = (t ?? ce).trim();
618
- if (!(!o || we || q.current)) {
619
- Re(!0);
620
- try {
621
- const d = /* @__PURE__ */ new Date(), k = (j) => String(j).padStart(2, "0"), g = `${k(d.getMonth() + 1)}${k(d.getDate())} ${k(
622
- d.getHours()
623
- )}:${k(d.getMinutes())}`, D = await Mt(
624
- g,
625
- s == null ? void 0 : s.localAgentId,
626
- Fe
627
- );
628
- H((j) => [D, ...j]), b == null || b(), Ee.current = !0, U(D.id), A([]), De(""), await R(o, D.id);
629
- } catch {
630
- } finally {
631
- Re(!1);
632
- }
633
- }
634
- }, Wt = () => {
635
- const t = ne.trim();
636
- if (t) {
637
- if (F) {
638
- ae.current = ae.current ? ae.current + `
639
- ` + t : t, he.current = N, Ie(ae.current), ee(""), Ce.current.delete(N ?? ""), de.current && (de.current.style.height = "auto");
640
- return;
641
- }
642
- if (ee(""), Ce.current.delete(N ?? ""), de.current && (de.current.style.height = "auto"), ge != null) {
643
- const o = ge;
644
- He(null), L(o, t);
645
- return;
646
- }
647
- R(t);
648
- }
649
- }, Bn = (t) => {
650
- bn(t, Y.sendKey) && !t.nativeEvent.isComposing && (t.preventDefault(), Wt()), t.key === "Escape" && (F ? v() : ge != null && ut());
651
- }, Ln = (t) => {
652
- ee(t.target.value);
653
- const o = t.target;
654
- o.style.height = "auto", o.style.height = Math.min(o.scrollHeight, 180) + "px";
655
- }, At = Jt("local-default");
656
- Jt(
657
- (E == null ? void 0 : E.username) || (E == null ? void 0 : E.display_name) || "user"
658
- );
659
- const Dn = (t) => {
660
- const o = /* @__PURE__ */ new Map();
661
- for (const g of t.blocks)
662
- g.type === "tool_result" && g.id && o.set(g.id, g);
663
- const d = /* @__PURE__ */ new Set();
664
- for (const g of t.blocks)
665
- g.type === "tool_call" && g.id && o.has(g.id) && d.add(g.id);
666
- const k = [];
667
- return t.blocks.forEach((g, D) => {
668
- if (g.type === "thinking")
669
- k.push(
670
- /* @__PURE__ */ e(
671
- Os,
672
- {
673
- text: g.text,
674
- streaming: !!t.streaming,
675
- startedAtMs: t.thinkingStartMs,
676
- durationMs: t.thinkingMs ?? g.durationMs
677
- },
678
- D
679
- )
680
- );
681
- else if (g.type === "tool_call") {
682
- const j = g.id ? o.get(g.id) : void 0, B = g._t0 != null && (j == null ? void 0 : j._t1) != null ? Math.max(1, j._t1 - g._t0) : g.durationMs;
683
- k.push(
684
- /* @__PURE__ */ e(
685
- xs,
686
- {
687
- call: g,
688
- result: j,
689
- running: !!t.streaming && j === void 0,
690
- durationMs: B,
691
- startedAtMs: g._t0
692
- },
693
- D
694
- )
695
- );
696
- } else if (g.type === "tool_result") {
697
- if (g.id && d.has(g.id)) return;
698
- k.push(
699
- /* @__PURE__ */ e("div", { className: a.toolItem, children: /* @__PURE__ */ l("div", { className: a.toolBody, children: [
700
- /* @__PURE__ */ e("div", { className: a.toolSectionLabel, children: "工具结果" }),
701
- /* @__PURE__ */ e("pre", { className: a.toolPre, children: g.content || "(空)" })
702
- ] }) }, D)
703
- );
704
- } else g.type === "text" && g.text && k.push(/* @__PURE__ */ e(Bl, { text: g.text }, D));
705
- }), k;
706
- };
707
- if (!rt)
708
- return /* @__PURE__ */ e("div", { className: a.container, children: /* @__PURE__ */ e("div", { className: a.chatPanel, children: /* @__PURE__ */ e("div", { className: a.chatEmpty, children: "本地 Agent 未启动,请检查桌面端是否正常运行" }) }) });
709
- const Ut = x.find((t) => t.id === N);
710
- return /* @__PURE__ */ l("div", { className: a.container, children: [
711
- qe ? /* @__PURE__ */ e(
712
- "button",
713
- {
714
- type: "button",
715
- className: a.sessionExpandBtn,
716
- onClick: () => Be(!1),
717
- title: "展开会话列表",
718
- children: /* @__PURE__ */ e(cn, {})
719
- }
720
- ) : /* @__PURE__ */ l("div", { className: a.sessionPanel, children: [
721
- /* @__PURE__ */ l("div", { className: a.sessionHeader, children: [
722
- /* @__PURE__ */ e("span", { children: "会话" }),
723
- /* @__PURE__ */ l("div", { className: a.sessionHeaderActions, children: [
724
- /* @__PURE__ */ e(
725
- "button",
726
- {
727
- type: "button",
728
- className: a.sessionBtnSm,
729
- onClick: () => {
730
- Ae(!0), be("");
731
- },
732
- title: "新建会话",
733
- children: /* @__PURE__ */ e(dn, {})
734
- }
735
- ),
736
- /* @__PURE__ */ e(
737
- "button",
738
- {
739
- type: "button",
740
- className: a.sessionBtnSm,
741
- onClick: () => Be(!0),
742
- title: "收起会话列表",
743
- children: /* @__PURE__ */ e(Mn, {})
744
- }
745
- )
746
- ] })
747
- ] }),
748
- /* @__PURE__ */ l("div", { className: a.sessionSearchRow, children: [
749
- /* @__PURE__ */ e(
750
- "input",
751
- {
752
- className: a.sessionSearchInput,
753
- type: "text",
754
- placeholder: "搜索会话",
755
- value: X,
756
- onChange: (t) => K(t.target.value)
757
- }
758
- ),
759
- X && /* @__PURE__ */ e(
760
- "button",
761
- {
762
- type: "button",
763
- className: a.sessionSearchClear,
764
- onClick: () => K(""),
765
- title: "清除搜索",
766
- children: "✕"
767
- }
768
- )
769
- ] }),
770
- /* @__PURE__ */ l("div", { className: a.sessionList, children: [
771
- Pe && /* @__PURE__ */ l("div", { className: a.sessionCreateRow, children: [
772
- /* @__PURE__ */ e(
773
- "input",
774
- {
775
- className: a.sessionCreateInput,
776
- type: "text",
777
- placeholder: "输入会话名称",
778
- value: le,
779
- autoFocus: !0,
780
- onChange: (t) => be(t.target.value),
781
- onKeyDown: (t) => {
782
- t.key === "Enter" && ft(), t.key === "Escape" && (Ae(!1), be(""));
783
- }
784
- }
785
- ),
786
- /* @__PURE__ */ e(
787
- "button",
788
- {
789
- type: "button",
790
- className: a.sessionCreateConfirm,
791
- onClick: () => void ft(),
792
- title: "确认创建",
793
- children: /* @__PURE__ */ e(un, {})
794
- }
795
- ),
796
- /* @__PURE__ */ e(
797
- "button",
798
- {
799
- type: "button",
800
- className: a.sessionCreateCancel,
801
- onClick: () => {
802
- Ae(!1), be("");
803
- },
804
- title: "取消",
805
- children: "✕"
806
- }
807
- )
808
- ] }),
809
- x.length === 0 && !Pe ? /* @__PURE__ */ l("div", { className: a.sessionEmpty, children: [
810
- /* @__PURE__ */ e("span", { children: "暂无会话" }),
811
- /* @__PURE__ */ e("span", { children: "点击「+」开始聊天" })
812
- ] }) : te.length === 0 ? /* @__PURE__ */ l("div", { className: a.sessionEmpty, children: [
813
- /* @__PURE__ */ e("span", { children: "无匹配会话" }),
814
- /* @__PURE__ */ e("span", { children: "换个关键词试试" })
815
- ] }) : te.map((t) => /* @__PURE__ */ l(
816
- "div",
817
- {
818
- className: `${a.sessionItem} ${N === t.id ? a.sessionItemActive : ""}`,
819
- onClick: () => U(t.id),
820
- children: [
821
- w === t.id ? /* @__PURE__ */ e(
822
- "input",
823
- {
824
- className: a.sessionRenameInput,
825
- type: "text",
826
- value: J,
827
- autoFocus: !0,
828
- onFocus: (o) => o.currentTarget.select(),
829
- onClick: (o) => o.stopPropagation(),
830
- onChange: (o) => S(o.target.value),
831
- onKeyDown: (o) => {
832
- o.key === "Enter" && ve(), o.key === "Escape" && (G.current = !0, C(null));
833
- },
834
- onBlur: () => void ve()
835
- }
836
- ) : /* @__PURE__ */ l(
837
- "span",
838
- {
839
- className: a.sessionItemTitle,
840
- title: t.title,
841
- onDoubleClick: () => yt(t),
842
- children: [
843
- t.id === mt && /* @__PURE__ */ e(
844
- Bt,
845
- {
846
- spin: !0,
847
- className: a.sessionLiveDot
848
- }
849
- ),
850
- t.title
851
- ]
852
- }
853
- ),
854
- w !== t.id && /* @__PURE__ */ e("span", { className: a.sessionItemTime, children: Sl(t.updatedAt) }),
855
- /* @__PURE__ */ e(
856
- "button",
857
- {
858
- type: "button",
859
- className: a.sessionRenameBtn,
860
- onClick: (o) => {
861
- o.stopPropagation(), yt(t);
862
- },
863
- title: "重命名会话",
864
- children: /* @__PURE__ */ e(Gt, {})
865
- }
866
- ),
867
- /* @__PURE__ */ e(
868
- "button",
869
- {
870
- type: "button",
871
- className: a.sessionDeleteBtn,
872
- onClick: (o) => {
873
- o.stopPropagation(), n(t.id);
874
- },
875
- title: "删除会话",
876
- children: /* @__PURE__ */ e(En, {})
877
- }
878
- )
879
- ]
880
- },
881
- t.id
882
- ))
883
- ] })
884
- ] }),
885
- /* @__PURE__ */ l("div", { className: a.chatPanel, children: [
886
- /* @__PURE__ */ l("div", { className: a.chatHeader, children: [
887
- /* @__PURE__ */ e(
888
- "div",
889
- {
890
- className: a.agentAvatar,
891
- style: { backgroundColor: At },
892
- children: Et((s == null ? void 0 : s.displayName) || "本地 Agent")
893
- }
894
- ),
895
- /* @__PURE__ */ l("div", { className: a.chatHeaderMeta, children: [
896
- /* @__PURE__ */ e("span", { className: a.chatHeaderName, children: (s == null ? void 0 : s.displayName) || "本地 Agent" }),
897
- Ut && /* @__PURE__ */ e("span", { className: a.chatHeaderSession, children: Ut.title })
898
- ] }),
899
- /* @__PURE__ */ e("span", { className: a.chatHeaderBadge, children: (s == null ? void 0 : s.localAgentType) === "jar" ? "内置模型" : s == null ? void 0 : s.localAgentType }),
900
- F && /* @__PURE__ */ l("span", { className: a.streamingIndicator, children: [
901
- /* @__PURE__ */ e(Bt, {}),
902
- " 工作中…"
903
- ] })
904
- ] }),
905
- N ? /* @__PURE__ */ l(et, { children: [
906
- /* @__PURE__ */ e(
907
- "div",
908
- {
909
- className: a.threadScroll,
910
- ref: Le,
911
- onScroll: It,
912
- children: /* @__PURE__ */ e("div", { className: a.threadInner, children: me && W.length === 0 ? /* @__PURE__ */ e("div", { className: a.chatEmpty, children: "加载中…" }) : W.length === 0 ? /* @__PURE__ */ l("div", { className: a.landing, children: [
913
- /* @__PURE__ */ e(
914
- "div",
915
- {
916
- className: a.landingLogo,
917
- style: { backgroundColor: At },
918
- children: Et((s == null ? void 0 : s.displayName) || "本地 Agent")
919
- }
920
- ),
921
- /* @__PURE__ */ l("div", { className: a.landingTitle, children: [
922
- "与 ",
923
- (s == null ? void 0 : s.displayName) || "本地 Agent",
924
- " 协作"
925
- ] }),
926
- /* @__PURE__ */ e("div", { className: a.landingHint, children: "思考过程与工具调用实时可见 · Enter 发送 · Esc 停止" }),
927
- /* @__PURE__ */ e("div", { className: a.landingChips, children: tn.map((t) => /* @__PURE__ */ e(
928
- "button",
929
- {
930
- type: "button",
931
- className: a.landingChip,
932
- onClick: () => void R(t),
933
- children: t
934
- },
935
- t
936
- )) })
937
- ] }) : W.map(
938
- (t, o) => t.role === "user" ? /* @__PURE__ */ l("div", { className: a.userRow, children: [
939
- /* @__PURE__ */ e("div", { className: a.userBubble, children: lt(t.blocks) }),
940
- !F && /* @__PURE__ */ l("div", { className: a.userActions, children: [
941
- /* @__PURE__ */ e(
942
- Ft,
943
- {
944
- inline: !0,
945
- label: "复制",
946
- getText: () => lt(t.blocks)
947
- }
948
- ),
949
- /* @__PURE__ */ e(
950
- "button",
951
- {
952
- type: "button",
953
- className: a.userActionBtn,
954
- title: "编辑重发(其后内容将被截断)",
955
- "aria-label": "编辑重发",
956
- onClick: () => z(o, lt(t.blocks)),
957
- children: /* @__PURE__ */ e(Gt, {})
958
- }
959
- ),
960
- /* @__PURE__ */ e(
961
- "button",
962
- {
963
- type: "button",
964
- className: a.userActionBtn,
965
- title: "重发(截断后原样重发)",
966
- "aria-label": "重发",
967
- onClick: () => void L(
968
- o,
969
- lt(t.blocks)
970
- ),
971
- children: /* @__PURE__ */ e(On, {})
972
- }
973
- )
974
- ] })
975
- ] }, t.id) : /* @__PURE__ */ l("div", { className: a.assistantBlock, children: [
976
- Dn(t),
977
- t.streaming && t.blocks.length === 0 && /* @__PURE__ */ e("span", { className: a.thinkingHint, children: "正在思考…" }),
978
- t.streaming && t.startedAtMs != null && /* @__PURE__ */ e(Ll, { startedAtMs: t.startedAtMs }),
979
- t.streaming && t.blocks.every(
980
- (d) => d.type !== "tool_call" && d.type !== "thinking"
981
- ) && /* @__PURE__ */ e("span", { className: a.caretCursor }),
982
- !t.streaming && (t.durationMs != null || t.totalMs != null) && /* @__PURE__ */ l("div", { className: a.msgMeta, children: [
983
- ((t.durationMs ?? t.totalMs) / 1e3).toFixed(1),
984
- "s",
985
- (() => {
986
- var D, j;
987
- const d = ((D = t.usage) == null ? void 0 : D.inputTokens) ?? 0, k = ((j = t.usage) == null ? void 0 : j.outputTokens) ?? 0, g = d + k;
988
- return g > 0 ? ` · ${Il(g)} tokens` : "";
989
- })()
990
- ] }),
991
- !t.streaming && /* @__PURE__ */ e(
992
- Ft,
993
- {
994
- getText: () => lt(t.blocks)
995
- }
996
- ),
997
- t.error && /* @__PURE__ */ l("div", { className: a.errorBar, children: [
998
- t.error,
999
- !F && ge == null && /* @__PURE__ */ e(
1000
- "button",
1001
- {
1002
- type: "button",
1003
- className: a.errorRetryBtn,
1004
- title: "重试:重发上一条用户消息(其后内容截断)",
1005
- onClick: () => {
1006
- let d = o - 1;
1007
- for (; d >= 0 && W[d].role !== "user"; )
1008
- d--;
1009
- d >= 0 && L(
1010
- d,
1011
- lt(W[d].blocks)
1012
- );
1013
- },
1014
- children: "重试"
1015
- }
1016
- )
1017
- ] }),
1018
- t.stopped && /* @__PURE__ */ e("div", { className: a.stoppedBar, children: "已停止生成" })
1019
- ] }, t.id)
1020
- ) })
1021
- }
1022
- ),
1023
- /* @__PURE__ */ e(
1024
- "button",
1025
- {
1026
- type: "button",
1027
- className: `${a.scrollTopBtn} ${T ? a.scrollTopBtnVisible : ""}`,
1028
- onClick: St,
1029
- title: "回到最新消息",
1030
- "aria-label": "回到最新消息",
1031
- children: /* @__PURE__ */ e(Lt, {})
1032
- }
1033
- ),
1034
- /* @__PURE__ */ l("div", { className: a.composerWrap, children: [
1035
- ge != null && /* @__PURE__ */ l("div", { className: a.editingBar, children: [
1036
- /* @__PURE__ */ e("span", { children: "正在编辑历史消息:发送后其后内容将被丢弃,并以全新上下文重发" }),
1037
- /* @__PURE__ */ e(
1038
- "button",
1039
- {
1040
- type: "button",
1041
- className: a.editingCancel,
1042
- onClick: ut,
1043
- title: "取消编辑",
1044
- children: "取消"
1045
- }
1046
- )
1047
- ] }),
1048
- se != null && /* @__PURE__ */ l("div", { className: a.pendingBar, children: [
1049
- /* @__PURE__ */ l("span", { children: [
1050
- "已排队:「",
1051
- se.slice(0, 30),
1052
- se.length > 30 ? "…" : "",
1053
- "」生成结束后自动发送"
1054
- ] }),
1055
- /* @__PURE__ */ e(
1056
- "button",
1057
- {
1058
- type: "button",
1059
- className: a.editingCancel,
1060
- onClick: An,
1061
- title: "取消排队消息(回填输入框)",
1062
- children: "取消"
1063
- }
1064
- )
1065
- ] }),
1066
- /* @__PURE__ */ l("div", { className: a.workdirBar, children: [
1067
- /* @__PURE__ */ l(
1068
- "button",
1069
- {
1070
- type: "button",
1071
- className: a.workdirChip,
1072
- onClick: ct,
1073
- title: Ve ? "当前会话绑定的工作目录(点击更换)" : "给这个会话绑定本机工作目录",
1074
- children: [
1075
- /* @__PURE__ */ e(Ot, {}),
1076
- /* @__PURE__ */ e("span", { children: dt(Ve) }),
1077
- /* @__PURE__ */ e(Lt, { className: a.workdirCaret })
1078
- ]
1079
- }
1080
- ),
1081
- /* @__PURE__ */ e("span", { className: a.workdirPath, title: Ve ?? "", children: Ve ?? "未绑定目录:任务不带目录上下文" })
1082
- ] }),
1083
- /* @__PURE__ */ l("div", { className: a.composer, children: [
1084
- /* @__PURE__ */ e(
1085
- "textarea",
1086
- {
1087
- ref: de,
1088
- className: a.composerInput,
1089
- placeholder: F ? N === mt ? "正在工作中…(Esc 停止)" : "后台回合进行中,输入将排队发送" : "向 Agent 发消息,Enter 发送,Shift+Enter 换行",
1090
- value: ne,
1091
- onChange: Ln,
1092
- onKeyDown: Bn,
1093
- rows: 1
1094
- }
1095
- ),
1096
- F ? /* @__PURE__ */ e(
1097
- "button",
1098
- {
1099
- type: "button",
1100
- className: a.stopBtn,
1101
- onClick: v,
1102
- title: "停止生成(Esc)",
1103
- "aria-label": "停止生成",
1104
- children: /* @__PURE__ */ e(xn, {})
1105
- }
1106
- ) : /* @__PURE__ */ e(
1107
- "button",
1108
- {
1109
- type: "button",
1110
- className: `${a.sendBtn} ${ne.trim() ? a.sendBtnReady : ""}`,
1111
- disabled: !ne.trim(),
1112
- onClick: Wt,
1113
- title: "发送",
1114
- "aria-label": "发送",
1115
- children: /* @__PURE__ */ e(Dt, {})
1116
- }
1117
- )
1118
- ] }),
1119
- /* @__PURE__ */ e("div", { className: a.composerHint, children: F ? "Agent 正在工作中,可按 Esc 或点击停止按钮中断" : "Enter 发送 · Shift+Enter 换行 · 思考与工具调用自动展示" })
1120
- ] })
1121
- ] }) : x.length === 0 ? (
1122
- /* 无会话:居中大输入框,发送自动建会话(时间戳命名) */
1123
- /* @__PURE__ */ l("div", { className: a.newChatLanding, children: [
1124
- /* @__PURE__ */ e(
1125
- "div",
1126
- {
1127
- className: a.landingLogo,
1128
- style: { backgroundColor: At },
1129
- children: Et((s == null ? void 0 : s.displayName) || "本地 Agent")
1130
- }
1131
- ),
1132
- /* @__PURE__ */ l("div", { className: a.landingTitle, children: [
1133
- "与 ",
1134
- (s == null ? void 0 : s.displayName) || "本地 Agent",
1135
- " 协作"
1136
- ] }),
1137
- /* @__PURE__ */ e("div", { className: a.landingHint, children: "输入即自动创建会话 · Enter 发送 · Esc 停止" }),
1138
- /* @__PURE__ */ l("div", { className: a.workdirBar, children: [
1139
- /* @__PURE__ */ l(
1140
- "button",
1141
- {
1142
- type: "button",
1143
- className: a.workdirChip,
1144
- onClick: ct,
1145
- title: "选择这次任务在本机哪个目录下执行",
1146
- children: [
1147
- /* @__PURE__ */ e(Ot, {}),
1148
- /* @__PURE__ */ e("span", { children: dt(Fe) }),
1149
- /* @__PURE__ */ e(Lt, { className: a.workdirCaret })
1150
- ]
1151
- }
1152
- ),
1153
- /* @__PURE__ */ e("span", { className: a.workdirPath, title: Fe ?? "", children: Fe ?? "未绑定目录:任务不带目录上下文" })
1154
- ] }),
1155
- /* @__PURE__ */ l("div", { className: a.landingComposer, children: [
1156
- /* @__PURE__ */ e(
1157
- "textarea",
1158
- {
1159
- className: a.landingInput,
1160
- placeholder: "描述你的任务,发送后自动创建会话…",
1161
- value: ce,
1162
- autoFocus: !0,
1163
- onChange: (t) => De(t.target.value),
1164
- onKeyDown: (t) => {
1165
- t.key === "Enter" && !t.shiftKey && !t.nativeEvent.isComposing && (t.preventDefault(), bt());
1166
- },
1167
- rows: 3
1168
- }
1169
- ),
1170
- /* @__PURE__ */ e(
1171
- "button",
1172
- {
1173
- type: "button",
1174
- className: `${a.sendBtn} ${ce.trim() && !we ? a.sendBtnReady : ""}`,
1175
- disabled: !ce.trim() || we,
1176
- onClick: () => void bt(),
1177
- title: "发送并创建会话",
1178
- "aria-label": "发送并创建会话",
1179
- children: /* @__PURE__ */ e(Dt, {})
1180
- }
1181
- )
1182
- ] }),
1183
- /* @__PURE__ */ e("div", { className: a.landingChips, children: tn.map((t) => /* @__PURE__ */ e(
1184
- "button",
1185
- {
1186
- type: "button",
1187
- className: a.landingChip,
1188
- onClick: () => void bt(t),
1189
- children: t
1190
- },
1191
- t
1192
- )) })
1193
- ] })
1194
- ) : /* @__PURE__ */ e("div", { className: a.chatEmpty, children: "请在左侧选择或创建一个会话" })
1195
- ] }),
1196
- We && /* @__PURE__ */ e(
1197
- "div",
1198
- {
1199
- className: a.dirMask,
1200
- role: "presentation",
1201
- onMouseDown: () => Ye(!1),
1202
- children: /* @__PURE__ */ l(
1203
- "div",
1204
- {
1205
- className: a.dirModal,
1206
- role: "dialog",
1207
- "aria-label": "选择工作目录",
1208
- onMouseDown: (t) => t.stopPropagation(),
1209
- children: [
1210
- /* @__PURE__ */ l("div", { className: a.dirHead, children: [
1211
- /* @__PURE__ */ e("span", { children: "选择工作目录" }),
1212
- /* @__PURE__ */ e(
1213
- "button",
1214
- {
1215
- type: "button",
1216
- className: a.dirClose,
1217
- onClick: () => Ye(!1),
1218
- "aria-label": "关闭",
1219
- children: /* @__PURE__ */ e($n, {})
1220
- }
1221
- )
1222
- ] }),
1223
- /* @__PURE__ */ l("div", { className: a.dirBar, children: [
1224
- /* @__PURE__ */ e(
1225
- "button",
1226
- {
1227
- type: "button",
1228
- className: a.dirUp,
1229
- disabled: !(O != null && O.parent) || nt,
1230
- onClick: () => (O == null ? void 0 : O.parent) && void Me(O.parent),
1231
- title: "上一级",
1232
- "aria-label": "上一级",
1233
- children: /* @__PURE__ */ e(Dt, {})
1234
- }
1235
- ),
1236
- /* @__PURE__ */ e("span", { className: a.dirPathText, title: O == null ? void 0 : O.path, children: (O == null ? void 0 : O.path) ?? "…" })
1237
- ] }),
1238
- /* @__PURE__ */ e("div", { className: a.dirList, children: nt ? /* @__PURE__ */ l("div", { className: a.dirEmpty, children: [
1239
- /* @__PURE__ */ e(Bt, {}),
1240
- " 读取中…"
1241
- ] }) : O && O.entries.length > 0 ? O.entries.map((t) => /* @__PURE__ */ l(
1242
- "button",
1243
- {
1244
- type: "button",
1245
- className: a.dirItem,
1246
- onClick: () => void Me(t.path),
1247
- children: [
1248
- /* @__PURE__ */ e(Rn, {}),
1249
- /* @__PURE__ */ e("span", { children: t.name })
1250
- ]
1251
- },
1252
- t.path
1253
- )) : /* @__PURE__ */ e("div", { className: a.dirEmpty, children: "没有子目录" }) }),
1254
- Ue && /* @__PURE__ */ e("div", { className: a.dirError, children: Ue }),
1255
- /* @__PURE__ */ l("div", { className: a.dirFoot, children: [
1256
- /* @__PURE__ */ e(
1257
- "button",
1258
- {
1259
- type: "button",
1260
- className: a.dirCancel,
1261
- onClick: () => Ye(!1),
1262
- children: "取消"
1263
- }
1264
- ),
1265
- /* @__PURE__ */ e(
1266
- "button",
1267
- {
1268
- type: "button",
1269
- className: a.dirConfirm,
1270
- disabled: !O || nt,
1271
- onClick: () => O && void ht(O.path),
1272
- children: "用这个目录"
1273
- }
1274
- )
1275
- ] })
1276
- ]
1277
- }
1278
- )
1279
- }
1280
- )
1281
- ] });
1282
- }
1283
- const Ml = "_sidebarInner_1vu3c_1", El = "_header_1vu3c_8", Ol = "_headerActions_1vu3c_19", xl = "_tabBar_1vu3c_26", $l = "_tab_1vu3c_26", Rl = "_tabActive_1vu3c_50", Pl = "_btnSm_1vu3c_66", ql = "_agentSection_1vu3c_84", Hl = "_agentItem_1vu3c_90", Fl = "_agentItemActive_1vu3c_112", jl = "_agentAvatar_1vu3c_117", Kl = "_agentName_1vu3c_130", Wl = "_emptyState_1vu3c_156", Ul = "_createInputRow_1vu3c_168", Vl = "_createInput_1vu3c_168", Gl = "_createConfirmBtn_1vu3c_188", zl = "_contextMenu_1vu3c_205", Zl = "_contextMenuItem_1vu3c_216", Ql = "_contextMenuItemDanger_1vu3c_231", Xl = "_contextMenuDivider_1vu3c_239", Yl = "_renameOverlay_1vu3c_246", Jl = "_renameDialog_1vu3c_259", ei = "_renameTitle_1vu3c_267", ti = "_renameInput_1vu3c_274", ni = "_renameActions_1vu3c_289", si = "_renameBtn_1vu3c_295", ai = "_renameBtnPrimary_1vu3c_309", li = "_agentDetailBtn_1vu3c_326", ii = "_agentItemShared_1vu3c_358", ri = "_agentInfo_1vu3c_362", oi = "_agentOwner_1vu3c_374", ci = "_sharedBadge_1vu3c_382", di = "_createLocalDialog_1vu3c_430", ui = "_createLocalLabel_1vu3c_438", pi = "_agentTypeCards_1vu3c_446", hi = "_agentTypeCard_1vu3c_446", mi = "_agentTypeIcon_1vu3c_474", gi = "_agentTypeBody_1vu3c_487", _i = "_agentTypeTitle_1vu3c_494", fi = "_agentTypeDesc_1vu3c_500", yi = "_agentTypeBadge_1vu3c_506", p = {
1284
- sidebarInner: Ml,
1285
- header: El,
1286
- headerActions: Ol,
1287
- tabBar: xl,
1288
- tab: $l,
1289
- tabActive: Rl,
1290
- btnSm: Pl,
1291
- agentSection: ql,
1292
- agentItem: Hl,
1293
- agentItemActive: Fl,
1294
- agentAvatar: jl,
1295
- agentName: Kl,
1296
- emptyState: Wl,
1297
- createInputRow: Ul,
1298
- createInput: Vl,
1299
- createConfirmBtn: Gl,
1300
- contextMenu: zl,
1301
- contextMenuItem: Zl,
1302
- contextMenuItemDanger: Ql,
1303
- contextMenuDivider: Xl,
1304
- renameOverlay: Yl,
1305
- renameDialog: Jl,
1306
- renameTitle: ei,
1307
- renameInput: ti,
1308
- renameActions: ni,
1309
- renameBtn: si,
1310
- renameBtnPrimary: ai,
1311
- agentDetailBtn: li,
1312
- agentItemShared: ii,
1313
- agentInfo: ri,
1314
- agentOwner: oi,
1315
- sharedBadge: ci,
1316
- createLocalDialog: di,
1317
- createLocalLabel: ui,
1318
- agentTypeCards: pi,
1319
- agentTypeCard: hi,
1320
- agentTypeIcon: mi,
1321
- agentTypeBody: gi,
1322
- agentTypeTitle: _i,
1323
- agentTypeDesc: fi,
1324
- agentTypeBadge: yi
1325
- }, nn = [
1326
- "#2F70F1",
1327
- "#52c41a",
1328
- "#fa8c16",
1329
- "#eb2f96",
1330
- "#722ed1",
1331
- "#13c2c2",
1332
- "#f5222d",
1333
- "#faad14"
1334
- ];
1335
- function sn(s) {
1336
- let r = 0;
1337
- for (let h = 0; h < s.length; h++) r = r * 31 + s.charCodeAt(h) | 0;
1338
- return nn[Math.abs(r) % nn.length];
1339
- }
1340
- function an(s) {
1341
- return s ? s.charAt(0).toUpperCase() : "?";
1342
- }
1343
- const Nt = "-1";
1344
- function bi({
1345
- selectedAgentId: s,
1346
- selectedLocalAgentId: r,
1347
- onSelectAgent: h,
1348
- onShowDetail: _,
1349
- onChatWithAgent: I
1350
- }) {
1351
- const M = $e((i) => i.token), b = $e((i) => i.personalChatNav), [E, Y] = m(
1352
- b.tab === "shared" ? "shared" : "remote"
1353
- ), [x, H] = m([]), [X, K] = m(!1), [w, C] = m(!1), [J, S] = m(""), [G, te] = m(!1), [N, U] = m(null), [W, A] = m(null), [ne, ee] = m(!1), [F, $] = m([]), [q, y] = m(!1), [se, Ie] = m(null), [ae, he] = m(!1), [ke, Ce] = m([]), [tt, ye] = m(!1), [me, Se] = m(!1), ce = V(null), De = Q(async () => {
1354
- K(!0);
1355
- try {
1356
- const i = await _n(M);
1357
- H(i), s && !i.find((T) => it(T.id, s)) && h(null);
1358
- } catch {
1359
- } finally {
1360
- K(!1);
1361
- }
1362
- }, [M, s, h]), we = Q(async () => {
1363
- y(!0);
1364
- try {
1365
- const i = await Jn(M);
1366
- $(i);
1367
- } catch {
1368
- } finally {
1369
- y(!1);
1370
- }
1371
- }, [M]);
1372
- P(() => {
1373
- b.trigger > 0 && b.tab && Y(b.tab);
1374
- }, [b.trigger]), P(() => {
1375
- E === "remote" ? De() : E === "shared" && we();
1376
- }, [De, we, E]);
1377
- const Re = Q(async () => {
1378
- try {
1379
- const i = await xt();
1380
- Ce(i);
1381
- } catch {
1382
- Ce([]);
1383
- }
1384
- }, []);
1385
- P(() => {
1386
- E === "local" && $t().then((i) => {
1387
- he(i), i && Re();
1388
- });
1389
- }, [E, Re]), P(() => {
1390
- if (!N) return;
1391
- const i = (T) => {
1392
- ce.current && !ce.current.contains(T.target) && U(null);
1393
- };
1394
- return document.addEventListener("mousedown", i), () => document.removeEventListener("mousedown", i);
1395
- }, [N]);
1396
- const Pe = async () => {
1397
- const i = J.trim();
1398
- if (i) {
1399
- te(!0);
1400
- try {
1401
- const T = await es(i, M);
1402
- H((ie) => [...ie, T]), S(""), C(!1), h(T);
1403
- } catch {
1404
- } finally {
1405
- te(!1);
1406
- }
1407
- }
1408
- }, Ae = async (i) => {
1409
- if (i === "jar") {
1410
- ye(!1), I({
1411
- id: Nt,
1412
- userId: "local",
1413
- agentHubAgentId: null,
1414
- agentCode: "local-default",
1415
- displayName: "本地 Agent",
1416
- avatar: null,
1417
- isLocal: !0
1418
- });
1419
- return;
1420
- }
1421
- if (!ae) {
1422
- if (!await $t()) {
1423
- vt.error(
1424
- "本地 Agent 未启动,请通过菜单栏「重启 Agent」启动后再试"
1425
- );
1426
- return;
1427
- }
1428
- he(!0);
1429
- }
1430
- Se(!0);
1431
- try {
1432
- const T = i === "hermes" ? "hermes" : "claude-code";
1433
- await hs(T, i), vt.success(`已引入 ${T},点击列表项即可开始对话`), ye(!1), await Re();
1434
- } catch (T) {
1435
- vt.error(
1436
- T.message || "创建失败,请检查本地 Agent 是否正常运行"
1437
- );
1438
- } finally {
1439
- Se(!1);
1440
- }
1441
- }, le = async (i) => {
1442
- if (await kt({ content: "确定删除此 Agent?" }))
1443
- try {
1444
- await ms(i), await Re();
1445
- } catch (T) {
1446
- vt.error(T.message || "删除失败");
1447
- }
1448
- }, be = async (i) => {
1449
- if (await kt({
1450
- content: `确定删除 Agent「${i.displayName}」吗?所有会话记录将一并删除。`
1451
- }))
1452
- try {
1453
- await ts(i.id, M), H((T) => T.filter((ie) => ie.id !== i.id)), it(s, i.id) && h(null);
1454
- } catch {
1455
- }
1456
- }, qe = async () => {
1457
- if (!W) return;
1458
- const i = W.value.trim();
1459
- if (!i || i === W.agent.displayName) {
1460
- A(null);
1461
- return;
1462
- }
1463
- ee(!0);
1464
- try {
1465
- const T = await ns(
1466
- W.agent.id,
1467
- i,
1468
- M
1469
- );
1470
- H((ie) => ie.map((ge) => ge.id === T.id ? T : ge)), it(s, T.id) && h(T), A(null);
1471
- } catch {
1472
- } finally {
1473
- ee(!1);
1474
- }
1475
- }, Be = async (i) => {
1476
- const T = i.shared === 1;
1477
- if (await kt({
1478
- title: T ? "取消共享" : "共享 Agent",
1479
- content: T ? `确定取消共享 Agent「${i.displayName}」吗?取消后其他用户将无法与此 Agent 聊天。` : `确定共享 Agent「${i.displayName}」吗?共享后其他用户可以与此 Agent 发起聊天。`,
1480
- danger: !1
1481
- })) {
1482
- Ie(i.id);
1483
- try {
1484
- const ie = await ss(
1485
- i.id,
1486
- !T,
1487
- M
1488
- );
1489
- H((ge) => ge.map((He) => He.id === ie.id ? ie : He));
1490
- } catch {
1491
- } finally {
1492
- Ie(null);
1493
- }
1494
- }
1495
- }, rt = (i, T) => {
1496
- i.preventDefault(), i.stopPropagation(), U({ x: i.clientX, y: i.clientY, agent: T });
1497
- };
1498
- return /* @__PURE__ */ l("div", { className: p.sidebarInner, children: [
1499
- /* @__PURE__ */ l("div", { className: p.header, children: [
1500
- /* @__PURE__ */ e("span", { children: "个人 Agent" }),
1501
- E === "remote" && /* @__PURE__ */ e("div", { className: p.headerActions, children: /* @__PURE__ */ e(
1502
- "button",
1503
- {
1504
- type: "button",
1505
- className: p.btnSm,
1506
- onClick: () => {
1507
- C((i) => !i), S("");
1508
- },
1509
- title: "新建个人 Agent",
1510
- children: "+ 新建"
1511
- }
1512
- ) }),
1513
- E === "local" && /* @__PURE__ */ e("div", { className: p.headerActions, children: /* @__PURE__ */ e(
1514
- "button",
1515
- {
1516
- type: "button",
1517
- className: p.btnSm,
1518
- onClick: () => ye(!0),
1519
- title: "新建本地 Agent",
1520
- children: "+ 新增"
1521
- }
1522
- ) })
1523
- ] }),
1524
- /* @__PURE__ */ l("div", { className: p.tabBar, children: [
1525
- /* @__PURE__ */ e(
1526
- "button",
1527
- {
1528
- type: "button",
1529
- className: `${p.tab} ${E === "local" ? p.tabActive : ""}`,
1530
- onClick: () => Y("local"),
1531
- title: "本地 Agent",
1532
- children: "本地"
1533
- }
1534
- ),
1535
- /* @__PURE__ */ e(
1536
- "button",
1537
- {
1538
- type: "button",
1539
- className: `${p.tab} ${E === "remote" ? p.tabActive : ""}`,
1540
- onClick: () => Y("remote"),
1541
- children: "远程"
1542
- }
1543
- ),
1544
- /* @__PURE__ */ e(
1545
- "button",
1546
- {
1547
- type: "button",
1548
- className: `${p.tab} ${E === "shared" ? p.tabActive : ""}`,
1549
- onClick: () => Y("shared"),
1550
- children: "共享"
1551
- }
1552
- )
1553
- ] }),
1554
- E === "local" ? /* @__PURE__ */ e("div", { className: p.agentSection, children: ae ? /* @__PURE__ */ e(et, { children: ke.map((i) => /* @__PURE__ */ l(
1555
- "div",
1556
- {
1557
- className: `${p.agentItem} ${it(s, Nt) && (i.type === "jar" && !r || r === i.id) ? p.agentItemActive : ""}`,
1558
- onClick: () => {
1559
- i.type === "jar" ? h({
1560
- id: Nt,
1561
- userId: "local",
1562
- agentHubAgentId: null,
1563
- agentCode: "local-default",
1564
- displayName: i.name,
1565
- avatar: null,
1566
- isLocal: !0
1567
- }) : h({
1568
- id: Nt,
1569
- userId: "local",
1570
- agentHubAgentId: null,
1571
- agentCode: i.name,
1572
- displayName: i.name,
1573
- avatar: null,
1574
- isLocal: !0,
1575
- localAgentId: i.id,
1576
- localAgentType: i.type
1577
- });
1578
- },
1579
- children: [
1580
- /* @__PURE__ */ e(
1581
- "div",
1582
- {
1583
- className: p.agentAvatar,
1584
- style: {
1585
- backgroundColor: i.type === "hermes" ? "#722ed1" : i.type === "claude-code" ? "#eb2f96" : "#52c41a"
1586
- },
1587
- children: i.type === "hermes" ? "H" : i.type === "claude-code" ? "C" : "L"
1588
- }
1589
- ),
1590
- /* @__PURE__ */ e("span", { className: p.agentName, children: i.name }),
1591
- i.type !== "jar" && /* @__PURE__ */ e(
1592
- "button",
1593
- {
1594
- type: "button",
1595
- className: p.agentDetailBtn,
1596
- onClick: (T) => {
1597
- T.stopPropagation(), le(i.id);
1598
- },
1599
- title: "删除",
1600
- children: /* @__PURE__ */ e("span", { style: { fontSize: 14 }, children: "×" })
1601
- }
1602
- )
1603
- ]
1604
- },
1605
- i.id
1606
- )) }) : /* @__PURE__ */ l("div", { className: p.emptyState, children: [
1607
- /* @__PURE__ */ e("span", { children: "本地 Agent 未启动" }),
1608
- /* @__PURE__ */ e("span", { children: "请检查桌面端是否正常运行" })
1609
- ] }) }) : E === "shared" ? /* @__PURE__ */ e("div", { className: p.agentSection, children: q && F.length === 0 ? /* @__PURE__ */ e("div", { className: p.emptyState, children: "加载中..." }) : F.length === 0 ? /* @__PURE__ */ l("div", { className: p.emptyState, children: [
1610
- /* @__PURE__ */ e("span", { children: "暂无共享 Agent" }),
1611
- /* @__PURE__ */ e("span", { children: "其他用户共享的 Agent 会显示在这里" })
1612
- ] }) : F.map((i) => /* @__PURE__ */ l(
1613
- "div",
1614
- {
1615
- className: `${p.agentItem} ${p.agentItemShared}`,
1616
- onClick: () => I(i),
1617
- title: `点击与「${i.displayName}」聊天`,
1618
- children: [
1619
- /* @__PURE__ */ e(
1620
- "div",
1621
- {
1622
- className: p.agentAvatar,
1623
- style: {
1624
- backgroundColor: sn(
1625
- i.agentCode || i.displayName
1626
- )
1627
- },
1628
- children: an(i.displayName)
1629
- }
1630
- ),
1631
- /* @__PURE__ */ l("div", { className: p.agentInfo, children: [
1632
- /* @__PURE__ */ e("span", { className: p.agentName, children: i.displayName }),
1633
- /* @__PURE__ */ l("span", { className: p.agentOwner, children: [
1634
- "来自: ",
1635
- i.userId
1636
- ] })
1637
- ] }),
1638
- /* @__PURE__ */ e(
1639
- "button",
1640
- {
1641
- type: "button",
1642
- className: p.agentDetailBtn,
1643
- onClick: (T) => {
1644
- T.stopPropagation(), I(i);
1645
- },
1646
- title: "开始聊天",
1647
- children: /* @__PURE__ */ e(pn, { style: { fontSize: 12 } })
1648
- }
1649
- )
1650
- ]
1651
- },
1652
- i.id
1653
- )) }) : /* @__PURE__ */ l(et, { children: [
1654
- w && /* @__PURE__ */ l("div", { className: p.createInputRow, children: [
1655
- /* @__PURE__ */ e(
1656
- "input",
1657
- {
1658
- className: p.createInput,
1659
- type: "text",
1660
- placeholder: "输入 Agent 名称",
1661
- value: J,
1662
- autoFocus: !0,
1663
- onChange: (i) => S(i.target.value),
1664
- onKeyDown: (i) => {
1665
- i.key === "Enter" && Pe(), i.key === "Escape" && (C(!1), S(""));
1666
- }
1667
- }
1668
- ),
1669
- /* @__PURE__ */ e(
1670
- "button",
1671
- {
1672
- type: "button",
1673
- className: p.createConfirmBtn,
1674
- disabled: !J.trim() || G,
1675
- onClick: Pe,
1676
- children: G ? "..." : "创建"
1677
- }
1678
- )
1679
- ] }),
1680
- /* @__PURE__ */ e("div", { className: p.agentSection, children: X && x.length === 0 ? /* @__PURE__ */ e("div", { className: p.emptyState, children: "加载中..." }) : x.length === 0 ? /* @__PURE__ */ l("div", { className: p.emptyState, children: [
1681
- /* @__PURE__ */ e("span", { children: "暂无个人 Agent" }),
1682
- /* @__PURE__ */ e("span", { children: "点击「新建」创建一个" })
1683
- ] }) : x.map((i) => /* @__PURE__ */ l(
1684
- "div",
1685
- {
1686
- className: `${p.agentItem} ${it(s, i.id) ? p.agentItemActive : ""}`,
1687
- onClick: () => h(i),
1688
- onContextMenu: (T) => rt(T, i),
1689
- children: [
1690
- /* @__PURE__ */ e(
1691
- "div",
1692
- {
1693
- className: p.agentAvatar,
1694
- style: {
1695
- backgroundColor: sn(
1696
- i.agentCode || i.displayName
1697
- )
1698
- },
1699
- children: an(i.displayName)
1700
- }
1701
- ),
1702
- /* @__PURE__ */ l("span", { className: p.agentName, children: [
1703
- i.displayName,
1704
- i.shared === 1 && /* @__PURE__ */ e("span", { className: p.sharedBadge, children: "共享" })
1705
- ] }),
1706
- /* @__PURE__ */ e(
1707
- "button",
1708
- {
1709
- type: "button",
1710
- className: p.agentDetailBtn,
1711
- onClick: (T) => {
1712
- T.stopPropagation();
1713
- const ie = T.currentTarget.getBoundingClientRect();
1714
- U({
1715
- x: ie.right - 120,
1716
- y: ie.bottom + 4,
1717
- agent: i
1718
- });
1719
- },
1720
- title: "更多操作",
1721
- children: /* @__PURE__ */ e(qn, { style: { fontSize: 14 } })
1722
- }
1723
- )
1724
- ]
1725
- },
1726
- i.id
1727
- )) })
1728
- ] }),
1729
- N && /* @__PURE__ */ l(
1730
- "div",
1731
- {
1732
- ref: ce,
1733
- className: p.contextMenu,
1734
- style: { top: N.y, left: N.x },
1735
- children: [
1736
- /* @__PURE__ */ e(
1737
- "div",
1738
- {
1739
- className: p.contextMenuItem,
1740
- onClick: () => {
1741
- I(N.agent), U(null);
1742
- },
1743
- children: "开始聊天"
1744
- }
1745
- ),
1746
- /* @__PURE__ */ e(
1747
- "div",
1748
- {
1749
- className: p.contextMenuItem,
1750
- onClick: () => {
1751
- _(N.agent), U(null);
1752
- },
1753
- children: "Agent 配置"
1754
- }
1755
- ),
1756
- /* @__PURE__ */ e("div", { className: p.contextMenuDivider }),
1757
- /* @__PURE__ */ e(
1758
- "div",
1759
- {
1760
- className: p.contextMenuItem,
1761
- onClick: () => {
1762
- A({
1763
- agent: N.agent,
1764
- value: N.agent.displayName
1765
- }), U(null);
1766
- },
1767
- children: "重命名"
1768
- }
1769
- ),
1770
- /* @__PURE__ */ e(
1771
- "div",
1772
- {
1773
- className: p.contextMenuItem,
1774
- onClick: () => {
1775
- se === null && Be(N.agent), U(null);
1776
- },
1777
- children: N.agent.shared === 1 ? "取消共享" : "共享给他人"
1778
- }
1779
- ),
1780
- /* @__PURE__ */ e("div", { className: p.contextMenuDivider }),
1781
- /* @__PURE__ */ e(
1782
- "div",
1783
- {
1784
- className: `${p.contextMenuItem} ${p.contextMenuItemDanger}`,
1785
- onClick: () => {
1786
- be(N.agent), U(null);
1787
- },
1788
- children: "删除"
1789
- }
1790
- )
1791
- ]
1792
- }
1793
- ),
1794
- tt && /* @__PURE__ */ e(
1795
- "div",
1796
- {
1797
- className: p.renameOverlay,
1798
- onClick: () => !me && ye(!1),
1799
- children: /* @__PURE__ */ l(
1800
- "div",
1801
- {
1802
- className: p.createLocalDialog,
1803
- onClick: (i) => i.stopPropagation(),
1804
- children: [
1805
- /* @__PURE__ */ e("div", { className: p.renameTitle, children: "新建本地 Agent" }),
1806
- /* @__PURE__ */ e("div", { className: p.createLocalLabel, children: me ? "正在创建..." : "点击选择,直接开始聊天" }),
1807
- /* @__PURE__ */ l("div", { className: p.agentTypeCards, children: [
1808
- /* @__PURE__ */ l(
1809
- "div",
1810
- {
1811
- className: p.agentTypeCard,
1812
- onClick: () => Ae("jar"),
1813
- children: [
1814
- /* @__PURE__ */ e(
1815
- "div",
1816
- {
1817
- className: p.agentTypeIcon,
1818
- style: { backgroundColor: "#52c41a" },
1819
- children: "L"
1820
- }
1821
- ),
1822
- /* @__PURE__ */ l("div", { className: p.agentTypeBody, children: [
1823
- /* @__PURE__ */ l("div", { className: p.agentTypeTitle, children: [
1824
- "自研",
1825
- " ",
1826
- /* @__PURE__ */ e("span", { className: p.agentTypeBadge, children: "已运行" })
1827
- ] }),
1828
- /* @__PURE__ */ e("div", { className: p.agentTypeDesc, children: "自研 Java Agent,内置 ReAct 推理引擎与工具调用" })
1829
- ] })
1830
- ]
1831
- }
1832
- ),
1833
- /* @__PURE__ */ l(
1834
- "div",
1835
- {
1836
- className: p.agentTypeCard,
1837
- onClick: () => Ae("hermes"),
1838
- children: [
1839
- /* @__PURE__ */ e(
1840
- "div",
1841
- {
1842
- className: p.agentTypeIcon,
1843
- style: { backgroundColor: "#722ed1" },
1844
- children: "H"
1845
- }
1846
- ),
1847
- /* @__PURE__ */ l("div", { className: p.agentTypeBody, children: [
1848
- /* @__PURE__ */ e("div", { className: p.agentTypeTitle, children: "Hermes" }),
1849
- /* @__PURE__ */ e("div", { className: p.agentTypeDesc, children: "本地 Hermes CLI,支持 tool-calling 与多模型切换" })
1850
- ] })
1851
- ]
1852
- }
1853
- ),
1854
- /* @__PURE__ */ l(
1855
- "div",
1856
- {
1857
- className: p.agentTypeCard,
1858
- onClick: () => Ae("claude-code"),
1859
- children: [
1860
- /* @__PURE__ */ e(
1861
- "div",
1862
- {
1863
- className: p.agentTypeIcon,
1864
- style: { backgroundColor: "#eb2f96" },
1865
- children: "C"
1866
- }
1867
- ),
1868
- /* @__PURE__ */ l("div", { className: p.agentTypeBody, children: [
1869
- /* @__PURE__ */ e("div", { className: p.agentTypeTitle, children: "Claude Code" }),
1870
- /* @__PURE__ */ e("div", { className: p.agentTypeDesc, children: "Anthropic Claude CLI 编码助手" })
1871
- ] })
1872
- ]
1873
- }
1874
- )
1875
- ] }),
1876
- /* @__PURE__ */ e("div", { className: p.renameActions, children: /* @__PURE__ */ e(
1877
- "button",
1878
- {
1879
- type: "button",
1880
- className: p.renameBtn,
1881
- onClick: () => ye(!1),
1882
- disabled: me,
1883
- children: "取消"
1884
- }
1885
- ) })
1886
- ]
1887
- }
1888
- )
1889
- }
1890
- ),
1891
- W && /* @__PURE__ */ e(
1892
- "div",
1893
- {
1894
- className: p.renameOverlay,
1895
- onClick: () => !ne && A(null),
1896
- children: /* @__PURE__ */ l(
1897
- "div",
1898
- {
1899
- className: p.renameDialog,
1900
- onClick: (i) => i.stopPropagation(),
1901
- children: [
1902
- /* @__PURE__ */ e("div", { className: p.renameTitle, children: "重命名 Agent" }),
1903
- /* @__PURE__ */ e(
1904
- "input",
1905
- {
1906
- className: p.renameInput,
1907
- type: "text",
1908
- value: W.value,
1909
- autoFocus: !0,
1910
- onChange: (i) => A({ ...W, value: i.target.value }),
1911
- onKeyDown: (i) => {
1912
- i.key === "Enter" && qe(), i.key === "Escape" && A(null);
1913
- }
1914
- }
1915
- ),
1916
- /* @__PURE__ */ l("div", { className: p.renameActions, children: [
1917
- /* @__PURE__ */ e(
1918
- "button",
1919
- {
1920
- type: "button",
1921
- className: p.renameBtn,
1922
- onClick: () => A(null),
1923
- disabled: ne,
1924
- children: "取消"
1925
- }
1926
- ),
1927
- /* @__PURE__ */ e(
1928
- "button",
1929
- {
1930
- type: "button",
1931
- className: p.renameBtnPrimary,
1932
- disabled: !W.value.trim() || ne,
1933
- onClick: qe,
1934
- children: ne ? "..." : "确定"
1935
- }
1936
- )
1937
- ] })
1938
- ]
1939
- }
1940
- )
1941
- }
1942
- )
1943
- ] });
1944
- }
1945
- const vi = "_shell_1w53k_2", Ni = "_inset_1w53k_33", ki = "_main_1w53k_40", Ci = "_pane_1w53k_52", wi = "_skipLink_1w53k_62", Ti = "_personalMainArea_1w53k_82", Ii = "_personalSidebar_1w53k_90", Si = "_personalChatArea_1w53k_103", Qe = {
1946
- shell: vi,
1947
- inset: Ni,
1948
- main: ki,
1949
- pane: Ci,
1950
- skipLink: wi,
1951
- personalMainArea: Ti,
1952
- personalSidebar: Ii,
1953
- personalChatArea: Si
1954
- }, Ai = "_sidebar_y5tuo_1", Bi = "_collapsed_y5tuo_12", Li = "_sideHeader_y5tuo_17", Di = "_sideHeaderIcon_y5tuo_32", Mi = "_sideHeaderTitle_y5tuo_45", Ei = "_sideContent_y5tuo_54", Oi = "_groupLabel_y5tuo_61", xi = "_navList_y5tuo_71", $i = "_navItem_y5tuo_77", Ri = "_navItemActive_y5tuo_109", Pi = "_navIcon_y5tuo_114", qi = "_navLabel_y5tuo_120", Hi = "_sideFooter_y5tuo_131", Fi = "_footHint_y5tuo_138", oe = {
1955
- sidebar: Ai,
1956
- collapsed: Bi,
1957
- sideHeader: Li,
1958
- sideHeaderIcon: Di,
1959
- sideHeaderTitle: Mi,
1960
- sideContent: Ei,
1961
- groupLabel: Oi,
1962
- navList: xi,
1963
- navItem: $i,
1964
- navItemActive: Ri,
1965
- navIcon: Pi,
1966
- navLabel: qi,
1967
- sideFooter: Hi,
1968
- footHint: Fi
1969
- };
1970
- function ji({
1971
- items: s,
1972
- activeTab: r,
1973
- collapsed: h,
1974
- footerItems: _,
1975
- onSelect: I,
1976
- onSwitchMode: M
1977
- }) {
1978
- return /* @__PURE__ */ l(
1979
- "aside",
1980
- {
1981
- className: `${oe.sidebar} ${h ? oe.collapsed : ""}`,
1982
- "aria-label": "个人工作台导航",
1983
- children: [
1984
- /* @__PURE__ */ l("div", { className: oe.sideHeader, children: [
1985
- /* @__PURE__ */ e("span", { className: oe.sideHeaderIcon, children: /* @__PURE__ */ e(hn, {}) }),
1986
- !h && /* @__PURE__ */ e("span", { className: oe.sideHeaderTitle, children: "个人工作台" })
1987
- ] }),
1988
- /* @__PURE__ */ l("div", { className: oe.sideContent, children: [
1989
- !h && /* @__PURE__ */ e("p", { className: oe.groupLabel, children: "我的工作空间" }),
1990
- /* @__PURE__ */ e("nav", { className: oe.navList, "aria-label": "个人模块", children: s.map((b) => {
1991
- const E = r === b.key, Y = /* @__PURE__ */ l(
1992
- "button",
1993
- {
1994
- type: "button",
1995
- className: `${oe.navItem} ${E ? oe.navItemActive : ""}`,
1996
- onClick: () => I(b.key),
1997
- "aria-current": E ? "page" : void 0,
1998
- children: [
1999
- /* @__PURE__ */ e("span", { className: oe.navIcon, children: b.icon }),
2000
- !h && /* @__PURE__ */ e("span", { className: oe.navLabel, children: b.label })
2001
- ]
2002
- },
2003
- b.key
2004
- );
2005
- return h ? /* @__PURE__ */ e(Ht, { placement: "right", title: b.label, children: Y }, b.key) : Y;
2006
- }) })
2007
- ] }),
2008
- /* @__PURE__ */ l("div", { className: oe.sideFooter, children: [
2009
- _.length > 0 && /* @__PURE__ */ e("nav", { className: oe.navList, "aria-label": "快捷切换", children: _.map((b) => {
2010
- const E = /* @__PURE__ */ l(
2011
- "button",
2012
- {
2013
- type: "button",
2014
- className: oe.navItem,
2015
- onClick: () => M == null ? void 0 : M(b.mode),
2016
- children: [
2017
- /* @__PURE__ */ e("span", { className: oe.navIcon, children: b.icon }),
2018
- !h && /* @__PURE__ */ e("span", { className: oe.navLabel, children: b.label })
2019
- ]
2020
- },
2021
- b.mode
2022
- );
2023
- return h ? /* @__PURE__ */ e(Ht, { placement: "right", title: b.label, children: E }, b.mode) : E;
2024
- }) }),
2025
- !h && /* @__PURE__ */ e("p", { className: oe.footHint, children: "⌘ / Ctrl + B 切换导航" })
2026
- ] })
2027
- ]
2028
- }
2029
- );
2030
- }
2031
- const Ki = "_topbar_ms4b7_1", Wi = "_topbarLeft_ms4b7_14", Ui = "_collapseBtn_ms4b7_22", Vi = "_crumbs_ms4b7_49", Gi = "_crumbsRoot_ms4b7_57", zi = "_crumbsSep_ms4b7_62", Zi = "_crumbsCurrent_ms4b7_68", Qi = "_topbarRight_ms4b7_76", Xe = {
2032
- topbar: Ki,
2033
- topbarLeft: Wi,
2034
- collapseBtn: Ui,
2035
- crumbs: Vi,
2036
- crumbsRoot: Gi,
2037
- crumbsSep: zi,
2038
- crumbsCurrent: Zi,
2039
- topbarRight: Qi
2040
- };
2041
- function Xi({
2042
- label: s,
2043
- collapsed: r,
2044
- onToggleCollapse: h
2045
- }) {
2046
- return /* @__PURE__ */ l("header", { className: Xe.topbar, children: [
2047
- /* @__PURE__ */ l("div", { className: Xe.topbarLeft, children: [
2048
- /* @__PURE__ */ e(
2049
- Ht,
2050
- {
2051
- title: r ? "展开个人菜单" : "收起个人菜单",
2052
- placement: "bottom",
2053
- children: /* @__PURE__ */ e(
2054
- "button",
2055
- {
2056
- type: "button",
2057
- className: Xe.collapseBtn,
2058
- onClick: h,
2059
- "aria-label": "展开或收起个人菜单",
2060
- "aria-expanded": !r,
2061
- children: r ? /* @__PURE__ */ e(Hn, {}) : /* @__PURE__ */ e(Fn, {})
2062
- }
2063
- )
2064
- }
2065
- ),
2066
- /* @__PURE__ */ l("div", { className: Xe.crumbs, "aria-label": "当前位置", children: [
2067
- /* @__PURE__ */ e("span", { className: Xe.crumbsRoot, children: "个人" }),
2068
- /* @__PURE__ */ e(cn, { className: Xe.crumbsSep }),
2069
- /* @__PURE__ */ e("span", { className: Xe.crumbsCurrent, children: s })
2070
- ] })
2071
- ] }),
2072
- /* @__PURE__ */ e("div", { className: Xe.topbarRight })
2073
- ] });
2074
- }
2075
- const In = [
2076
- { key: "workbench", label: "场景工作台", icon: /* @__PURE__ */ e(hn, {}) },
2077
- { key: "projects", label: "工作单管理", icon: /* @__PURE__ */ e(Ot, {}) },
2078
- { key: "personal", label: "个人统计", icon: /* @__PURE__ */ e(Kn, {}) },
2079
- { key: "business-stats", label: "业务指标", icon: /* @__PURE__ */ e(Wn, {}) },
2080
- { key: "tools", label: "常用工具", icon: /* @__PURE__ */ e(Un, {}) },
2081
- { key: "websites", label: "常用网站", icon: /* @__PURE__ */ e(Vn, {}) },
2082
- { key: "smart-partner", label: "智能伙伴", icon: /* @__PURE__ */ e(pn, {}) },
2083
- { key: "todo", label: "工作待办", icon: /* @__PURE__ */ e(gn, {}) },
2084
- { key: "notes", label: "个人笔记", icon: /* @__PURE__ */ e(jt, {}) },
2085
- {
2086
- key: "training",
2087
- label: "培训中心",
2088
- icon: /* @__PURE__ */ e(Gn, {}),
2089
- // 学员侧学习入口与培训管理(TRAINING)解耦:按需单独分配,不随培训入口发放
2090
- permission: "TRAINING_CENTER"
2091
- },
2092
- { key: "webide", label: "WebIDE", icon: /* @__PURE__ */ e(zn, {}) }
2093
- ], Sn = "ft_pw_sidebar_collapsed";
2094
- function Yi() {
2095
- try {
2096
- return localStorage.getItem(Sn) === "1";
2097
- } catch {
2098
- return !1;
2099
- }
2100
- }
2101
- function Ji(s) {
2102
- const r = s;
2103
- return r ? r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.isContentEditable === !0 : !1;
2104
- }
2105
- function er() {
2106
- try {
2107
- const s = new URLSearchParams(window.location.search).get("tab");
2108
- return s && In.some((r) => r.key === s) ? s : null;
2109
- } catch {
2110
- return null;
2111
- }
2112
- }
2113
- function tr({
2114
- onOpenProject: s,
2115
- openTodoId: r,
2116
- selectedPersonalAgent: h,
2117
- personalView: _,
2118
- newSessionTrigger: I,
2119
- onSelectPersonalAgent: M,
2120
- onShowPersonalAgentDetail: b,
2121
- onChatWithPersonalAgent: E,
2122
- onSwitchMode: Y
2123
- }) {
2124
- var F;
2125
- const [x, H] = m(
2126
- // 惰性初始化:命中深链时直接以目标 Tab 首屏渲染,不先渲染场景工作台再切
2127
- () => er() ?? "workbench"
2128
- );
2129
- P(() => {
2130
- try {
2131
- const $ = new URL(window.location.href);
2132
- if (!$.searchParams.has("tab")) return;
2133
- $.searchParams.delete("tab"), window.history.replaceState(window.history.state, "", $.toString());
2134
- } catch {
2135
- }
2136
- }, []);
2137
- const [X, K] = m(Yi);
2138
- P(() => {
2139
- try {
2140
- localStorage.setItem(Sn, X ? "1" : "0");
2141
- } catch {
2142
- }
2143
- }, [X]);
2144
- const w = Q(() => {
2145
- K(($) => !$), window.setTimeout(() => window.dispatchEvent(new Event("resize")), 300);
2146
- }, []);
2147
- P(() => {
2148
- function $(q) {
2149
- !(q.metaKey || q.ctrlKey) || q.altKey || q.key.toLowerCase() === "b" && (Ji(q.target) || (q.preventDefault(), w()));
2150
- }
2151
- return window.addEventListener("keydown", $), () => window.removeEventListener("keydown", $);
2152
- }, [w]);
2153
- const C = $e(($) => $.currentUser), J = In.filter(
2154
- ($) => !$.permission || vn(C, $.permission)
2155
- ), S = fe(() => Y ? [
2156
- { mode: "admin", label: "运营工作台", icon: /* @__PURE__ */ e(mn, {}) },
2157
- { mode: "collaboration", label: "协作工作台", icon: /* @__PURE__ */ e(jn, {}) }
2158
- ].filter(
2159
- (q) => yn(C, q.mode)
2160
- ) : [], [C, Y]), G = ((F = J.find(($) => $.key === x)) == null ? void 0 : F.label) ?? "个人工作台", [te, N] = m(null), [U, W] = m(null), A = Q(($) => {
2161
- H($);
2162
- }, []), ne = Q(($) => {
2163
- H("notes"), N({ id: $, ts: Date.now() });
2164
- }, []), ee = Q(($) => {
2165
- H("todo"), W({ id: $, ts: Date.now() });
2166
- }, []);
2167
- return P(() => {
2168
- r != null && r.id && (H("todo"), W({ id: r.id, ts: r.ts }));
2169
- }, [r == null ? void 0 : r.id, r == null ? void 0 : r.ts]), /* @__PURE__ */ l("div", { className: Qe.shell, children: [
2170
- /* @__PURE__ */ e("a", { className: Qe.skipLink, href: "#pw-content", children: "跳到个人工作台内容" }),
2171
- /* @__PURE__ */ e(
2172
- ji,
2173
- {
2174
- items: J,
2175
- activeTab: x,
2176
- collapsed: X,
2177
- footerItems: S,
2178
- onSelect: H,
2179
- onSwitchMode: Y
2180
- }
2181
- ),
2182
- /* @__PURE__ */ l("div", { className: Qe.inset, children: [
2183
- /* @__PURE__ */ e(
2184
- Xi,
2185
- {
2186
- label: G,
2187
- collapsed: X,
2188
- onToggleCollapse: w
2189
- }
2190
- ),
2191
- /* @__PURE__ */ e(
2192
- "main",
2193
- {
2194
- id: "pw-content",
2195
- tabIndex: -1,
2196
- "aria-label": `${G}内容`,
2197
- className: Qe.main,
2198
- children: /* @__PURE__ */ l("div", { className: Qe.pane, children: [
2199
- (x === "workbench" || x === "projects" || x === "personal") && /* @__PURE__ */ e(
2200
- qt,
2201
- {
2202
- activeTab: x,
2203
- onActiveTabChange: A,
2204
- onOpenProject: s,
2205
- hideTabs: !0
2206
- }
2207
- ),
2208
- x === "business-stats" && /* @__PURE__ */ e(ln, { source: "scenario" }),
2209
- x === "tools" && /* @__PURE__ */ e(wt, { showTools: !0, showWebsites: !1 }),
2210
- x === "websites" && /* @__PURE__ */ e(wt, { showTools: !1, showWebsites: !0 }),
2211
- x === "todo" && /* @__PURE__ */ e(
2212
- rn,
2213
- {
2214
- onOpenProject: s,
2215
- onOpenNote: ne,
2216
- openTodoId: U
2217
- }
2218
- ),
2219
- x === "notes" && /* @__PURE__ */ e(
2220
- on,
2221
- {
2222
- onOpenProject: s,
2223
- onOpenTodo: ee,
2224
- openNoteId: te
2225
- }
2226
- ),
2227
- x === "training" && /* @__PURE__ */ e(Nn, {}),
2228
- x === "webide" && /* @__PURE__ */ e(kn, {}),
2229
- x === "smart-partner" && /* @__PURE__ */ l("div", { className: Qe.personalMainArea, children: [
2230
- /* @__PURE__ */ e("div", { className: Qe.personalSidebar, children: /* @__PURE__ */ e(
2231
- bi,
2232
- {
2233
- selectedAgentId: (h == null ? void 0 : h.id) ?? null,
2234
- selectedLocalAgentId: (h == null ? void 0 : h.localAgentId) ?? null,
2235
- onSelectAgent: M,
2236
- onShowDetail: b,
2237
- onChatWithAgent: E
2238
- }
2239
- ) }),
2240
- /* @__PURE__ */ e("div", { className: Qe.personalChatArea, children: _ === "detail" && h && !h.isLocal ? /* @__PURE__ */ e(
2241
- Cn,
2242
- {
2243
- agent: h,
2244
- onBack: () => M(h)
2245
- }
2246
- ) : h != null && h.isLocal ? /* @__PURE__ */ e(
2247
- Tn,
2248
- {
2249
- agent: h,
2250
- newSessionTrigger: I
2251
- }
2252
- ) : /* @__PURE__ */ e(
2253
- wn,
2254
- {
2255
- agent: h,
2256
- newSessionTrigger: I
2257
- }
2258
- ) })
2259
- ] })
2260
- ] })
2261
- }
2262
- )
2263
- ] })
2264
- ] });
2265
- }
2266
- const nr = [
2267
- "帮我排查一个线上问题",
2268
- "总结一下今天的群聊进展",
2269
- "把这周的变更整理成周报"
2270
- ], sr = [
2271
- {
2272
- key: "video",
2273
- label: "视频生成",
2274
- icon: /* @__PURE__ */ e(Zn, {}),
2275
- action: "chat",
2276
- prompt: "帮我写一条 15 秒短视频脚本,主题是:"
2277
- },
2278
- {
2279
- key: "docs",
2280
- label: "文档办公",
2281
- icon: /* @__PURE__ */ e(jt, {}),
2282
- action: "tools"
2283
- },
2284
- {
2285
- key: "vibe",
2286
- label: "Vibe Coding",
2287
- icon: /* @__PURE__ */ e(Ns, {}),
2288
- action: "webide"
2289
- },
2290
- {
2291
- key: "design",
2292
- label: "设计视觉",
2293
- icon: /* @__PURE__ */ e(ks, {}),
2294
- action: "chat",
2295
- prompt: "帮我出一版视觉设计稿,风格偏:"
2296
- },
2297
- {
2298
- key: "ask",
2299
- label: "问问 Z-OPC",
2300
- icon: /* @__PURE__ */ e(Rt, {}),
2301
- action: "ask"
2302
- }
2303
- ];
2304
- function ar() {
2305
- const s = (/* @__PURE__ */ new Date()).getHours();
2306
- return s < 5 ? "夜深了" : s < 12 ? "早上好" : s < 14 ? "中午好" : s < 18 ? "下午好" : "晚上好";
2307
- }
2308
- function lr(s) {
2309
- if (!s) return "";
2310
- const r = new Date(s), h = /* @__PURE__ */ new Date(), _ = h.getTime() - s;
2311
- if (_ < 6e4) return "刚刚";
2312
- if (_ < 36e5) return `${Math.floor(_ / 6e4)} 分钟前`;
2313
- if (r.toDateString() === h.toDateString()) {
2314
- const M = (b) => String(b).padStart(2, "0");
2315
- return `${M(r.getHours())}:${M(r.getMinutes())}`;
2316
- }
2317
- const I = new Date(h);
2318
- return I.setDate(h.getDate() - 1), r.toDateString() === I.toDateString() ? "昨天" : `${r.getMonth() + 1}月${r.getDate()}日`;
2319
- }
2320
- function ir({
2321
- agents: s,
2322
- activeAgent: r,
2323
- onSwitchAgent: h,
2324
- localAgentName: _,
2325
- onLocalSend: I,
2326
- localOffline: M = !1,
2327
- initialSpace: b,
2328
- onSend: E,
2329
- onOpenTab: Y,
2330
- onQuickAsk: x,
2331
- recentTasks: H = [],
2332
- onOpenHistory: X
2333
- }) {
2334
- const K = $e((y) => y.token), w = $e((y) => y.currentUser), C = Kt(), [J, S] = m(""), G = V(null), [te, N] = m(!1), [U, W] = m(!1), [A, ne] = m(b ?? null), [ee, F] = m(!1), $ = Q(async () => {
2335
- const y = J.trim();
2336
- if (!(!y || te) && !M) {
2337
- if (_ && I) {
2338
- I(y), S("");
2339
- return;
2340
- }
2341
- if (r) {
2342
- N(!0);
2343
- try {
2344
- await E(y, A), S(""), ne(null);
2345
- } finally {
2346
- N(!1);
2347
- }
2348
- }
2349
- }
2350
- }, [J, te, M, _, I, r, E, A]), q = C.nickname || (w == null ? void 0 : w.display_name) || (w == null ? void 0 : w.username) || "";
2351
- return /* @__PURE__ */ e("div", { className: `${u.landing} ${u.xwScope}`, children: /* @__PURE__ */ l("div", { className: u.landingInner, children: [
2352
- /* @__PURE__ */ e("div", { className: u.mascot, "aria-hidden": "true", children: /* @__PURE__ */ e("img", { src: gs, alt: "" }) }),
2353
- /* @__PURE__ */ e("h1", { className: u.landingTitle, children: C.greetingEnabled ? `${ar()}${q ? `,${q}` : ""}` : "开始新的对话" }),
2354
- /* @__PURE__ */ e("p", { className: u.landingSub, children: _ ? M ? "本机 Agent 未运行 —— 启动 Z-OPC 桌面端(伴生服务起来后自动连上)" : "本地模式:任务在你的电脑上执行,文件与上下文都不上云" : C.bio || "我是你的智能伙伴,有什么可以帮你?" }),
2355
- /* @__PURE__ */ l("div", { className: u.landingBox, children: [
2356
- /* @__PURE__ */ e(
2357
- "textarea",
2358
- {
2359
- ref: G,
2360
- className: u.landingInput,
2361
- placeholder: _ ? M ? "本机 Agent 未运行,启动桌面端后即可在本地执行" : `给本机 Agent 发送消息,${Qt(C.sendKey)}` : `给智能伙伴发送消息,${Qt(C.sendKey)}`,
2362
- rows: 3,
2363
- value: J,
2364
- autoFocus: !0,
2365
- onChange: (y) => S(y.target.value),
2366
- onKeyDown: (y) => {
2367
- bn(y, C.sendKey) && !y.nativeEvent.isComposing && (y.preventDefault(), $());
2368
- }
2369
- }
2370
- ),
2371
- /* @__PURE__ */ l("div", { className: u.landingBoxBar, children: [
2372
- _ ? /* @__PURE__ */ l("span", { className: u.agentChip, children: [
2373
- /* @__PURE__ */ e(Rt, {}),
2374
- /* @__PURE__ */ l("span", { children: [
2375
- _,
2376
- "(本机)"
2377
- ] })
2378
- ] }) : r ? /* @__PURE__ */ l("div", { className: u.agentChipWrap, children: [
2379
- /* @__PURE__ */ l(
2380
- "button",
2381
- {
2382
- type: "button",
2383
- className: u.agentChip,
2384
- onClick: () => W((y) => !y),
2385
- children: [
2386
- /* @__PURE__ */ e(Rt, {}),
2387
- /* @__PURE__ */ e("span", { children: r.displayName }),
2388
- s.length > 1 && /* @__PURE__ */ e(Ct, { className: u.chipCaret })
2389
- ]
2390
- }
2391
- ),
2392
- U && s.length > 1 && /* @__PURE__ */ l(et, { children: [
2393
- /* @__PURE__ */ e(
2394
- "div",
2395
- {
2396
- className: u.agentMenuMask,
2397
- onClick: () => W(!1)
2398
- }
2399
- ),
2400
- /* @__PURE__ */ e("div", { className: u.agentMenu, role: "menu", children: s.map((y) => /* @__PURE__ */ l(
2401
- "button",
2402
- {
2403
- type: "button",
2404
- role: "menuitem",
2405
- className: `${u.agentMenuItem} ${y.id === r.id ? u.agentMenuItemActive : ""}`,
2406
- onClick: () => {
2407
- h(y), W(!1);
2408
- },
2409
- children: [
2410
- /* @__PURE__ */ e(
2411
- "span",
2412
- {
2413
- className: u.agentDot,
2414
- style: { background: fs(y.displayName) },
2415
- children: _s(y.displayName)
2416
- }
2417
- ),
2418
- y.displayName
2419
- ]
2420
- },
2421
- y.id
2422
- )) })
2423
- ] })
2424
- ] }) : /* @__PURE__ */ e("span", { className: u.agentChipEmpty, children: "还没有云端伙伴,可到个人工作台创建" }),
2425
- !_ && r && /* @__PURE__ */ l("div", { className: u.agentChipWrap, children: [
2426
- /* @__PURE__ */ l(
2427
- "button",
2428
- {
2429
- type: "button",
2430
- className: u.agentChip,
2431
- title: "本次新建任务归入的项目空间(可选)",
2432
- onClick: () => F((y) => !y),
2433
- children: [
2434
- /* @__PURE__ */ e(Pt, {}),
2435
- /* @__PURE__ */ e("span", { children: A ? A.title : "不归组" }),
2436
- /* @__PURE__ */ e(Ct, { className: u.chipCaret })
2437
- ]
2438
- }
2439
- ),
2440
- ee && /* @__PURE__ */ l(et, { children: [
2441
- /* @__PURE__ */ e(
2442
- "div",
2443
- {
2444
- className: u.agentMenuMask,
2445
- onClick: () => F(!1)
2446
- }
2447
- ),
2448
- /* @__PURE__ */ e(
2449
- ys,
2450
- {
2451
- token: K,
2452
- currentId: (A == null ? void 0 : A.id) ?? null,
2453
- onPick: (y) => {
2454
- ne(y), F(!1);
2455
- }
2456
- }
2457
- )
2458
- ] })
2459
- ] }),
2460
- /* @__PURE__ */ e(
2461
- "button",
2462
- {
2463
- type: "button",
2464
- className: u.landingSend,
2465
- disabled: !J.trim() || te || M || !r && !_,
2466
- onClick: () => void $(),
2467
- "aria-label": "发送",
2468
- children: te ? /* @__PURE__ */ e(bs, {}) : /* @__PURE__ */ e(vs, {})
2469
- }
2470
- )
2471
- ] })
2472
- ] }),
2473
- H.length > 0 && /* @__PURE__ */ l("section", { className: u.recentBlock, "aria-label": "继续最近任务", children: [
2474
- /* @__PURE__ */ l("div", { className: u.recentHead, children: [
2475
- /* @__PURE__ */ e("span", { children: "继续最近任务" }),
2476
- X && /* @__PURE__ */ e(
2477
- "button",
2478
- {
2479
- type: "button",
2480
- className: u.recentAll,
2481
- onClick: X,
2482
- children: "全部 →"
2483
- }
2484
- )
2485
- ] }),
2486
- /* @__PURE__ */ e("div", { className: u.recentList, children: H.map((y) => /* @__PURE__ */ l(
2487
- "button",
2488
- {
2489
- type: "button",
2490
- className: u.recentRow,
2491
- title: y.title,
2492
- onClick: y.open,
2493
- children: [
2494
- /* @__PURE__ */ e(
2495
- "span",
2496
- {
2497
- className: `${u.recentLane} ${y.lane === "local" ? u.recentLaneLocal : ""}`,
2498
- children: y.lane === "local" ? "本地" : "云端"
2499
- }
2500
- ),
2501
- /* @__PURE__ */ e("span", { className: u.recentTitle, children: y.title }),
2502
- /* @__PURE__ */ e("span", { className: u.recentTime, children: lr(y.updatedAt) })
2503
- ]
2504
- },
2505
- y.key
2506
- )) })
2507
- ] }),
2508
- /* @__PURE__ */ e("div", { className: u.chipRow, children: sr.map((y) => /* @__PURE__ */ l(
2509
- "button",
2510
- {
2511
- type: "button",
2512
- className: u.capChip,
2513
- onClick: () => {
2514
- var se;
2515
- if (y.action === "tools") {
2516
- Y("tools");
2517
- return;
2518
- }
2519
- if (y.action === "webide") {
2520
- Y("webide");
2521
- return;
2522
- }
2523
- if (y.action === "ask") {
2524
- x();
2525
- return;
2526
- }
2527
- S(y.prompt ?? ""), (se = G.current) == null || se.focus();
2528
- },
2529
- children: [
2530
- /* @__PURE__ */ e("span", { className: u.capChipIcon, children: y.icon }),
2531
- /* @__PURE__ */ e("span", { children: y.label })
2532
- ]
2533
- },
2534
- y.key
2535
- )) }),
2536
- /* @__PURE__ */ e("div", { className: u.chipRow, children: nr.map((y) => /* @__PURE__ */ e(
2537
- "button",
2538
- {
2539
- type: "button",
2540
- className: u.suggestChip,
2541
- onClick: () => {
2542
- var se;
2543
- S(y), (se = G.current) == null || se.focus();
2544
- },
2545
- children: y
2546
- },
2547
- y
2548
- )) }),
2549
- /* @__PURE__ */ l("p", { className: u.shortcutHint, children: [
2550
- /* @__PURE__ */ e("kbd", { className: u.shortcutKbd, children: "⌘K" }),
2551
- /* @__PURE__ */ e("span", { children: "搜索与命令" }),
2552
- /* @__PURE__ */ e("span", { className: u.shortcutDot, children: "·" }),
2553
- /* @__PURE__ */ e("kbd", { className: u.shortcutKbd, children: "⌘N" }),
2554
- /* @__PURE__ */ e("span", { children: "新建任务" })
2555
- ] })
2556
- ] }) });
2557
- }
2558
- const pt = Ms() || typeof localStorage < "u" && localStorage.getItem("ft_exclusive_force_desktop") === "1";
2559
- function rr(s) {
2560
- return s.type === "jar" ? {
2561
- id: "-1",
2562
- userId: "local",
2563
- agentHubAgentId: null,
2564
- agentCode: "local-default",
2565
- displayName: s.name || "本地 Agent",
2566
- avatar: null,
2567
- isLocal: !0
2568
- } : {
2569
- id: "-1",
2570
- userId: "local",
2571
- agentHubAgentId: null,
2572
- agentCode: s.name,
2573
- displayName: s.name,
2574
- avatar: null,
2575
- isLocal: !0,
2576
- localAgentId: s.id,
2577
- localAgentType: s.type
2578
- };
2579
- }
2580
- function kr({
2581
- onSwitchMode: s,
2582
- onOpenProject: r,
2583
- openAgentRequest: h
2584
- }) {
2585
- const _ = $e((n) => n.token), I = $e((n) => n.currentUser), M = Kt(), [b, E] = m([]), [Y, x] = m(!0), [H, X] = m(null), [K, w] = m("landing"), [C, J] = m(null), [S, G] = m(
2586
- pt ? "local" : "cloud"
2587
- ), [te, N] = m(
2588
- []
2589
- ), [U, W] = m([]), [A, ne] = m(!0), [ee, F] = m(!1), $ = $e((n) => n.projects), [q, y] = m([]), [se, Ie] = m(null), [ae, he] = m(
2590
- /* @__PURE__ */ new Set()
2591
- ), [ke, Ce] = m(0), [tt, ye] = m(null), [me, Se] = m(!1), [ce, De] = m([]), [we, Re] = m(null), [Pe, Ae] = m(!1), le = pt || Pe, [be, qe] = m(null), Be = Q(
2592
- (n) => {
2593
- const c = Cs(n);
2594
- c && !vn(I, c) || (ot(n), w("personalTab"));
2595
- },
2596
- [I]
2597
- ), [rt, i] = m(!1), [T, ie] = m(
2598
- null
2599
- ), [ge, He] = m(
2600
- null
2601
- ), [Fe, Tt] = m(
2602
- null
2603
- ), We = Q(
2604
- (n, c) => {
2605
- r == null || r(n, c);
2606
- },
2607
- [r]
2608
- ), Ye = Q((n) => {
2609
- ot("todo"), Tt({ id: n, ts: Date.now() });
2610
- }, []), [O, ot] = m("personal"), nt = V(!1), pe = fe(() => ws(b), [b]), Ue = fe(
2611
- () => b.find((n) => n.id === H) ?? pe,
2612
- [b, H, pe]
2613
- );
2614
- le && me && ce.length > 0;
2615
- const re = fe(
2616
- () => ce.find((n) => n.id === we) ?? null,
2617
- [ce, we]
2618
- );
2619
- P(() => {
2620
- let n = !0;
2621
- return x(!0), _n(_).then((c) => {
2622
- n && E(c);
2623
- }).catch(() => {
2624
- }).finally(() => {
2625
- n && x(!1);
2626
- }), () => {
2627
- n = !1;
2628
- };
2629
- }, [_]), P(() => {
2630
- let n = !0;
2631
- const c = async () => {
2632
- if (!pt) {
2633
- let R = !1;
2634
- try {
2635
- R = !!(await Bs(_)).online;
2636
- } catch {
2637
- R = !1;
2638
- }
2639
- if (!n) return;
2640
- if (Ae(R), Es(R ? "tunnel" : "direct", _), Se(R), !R) {
2641
- De([]);
2642
- return;
2643
- }
2644
- try {
2645
- const L = await xt();
2646
- n && De(L);
2647
- } catch {
2648
- }
2649
- return;
2650
- }
2651
- const v = await $t();
2652
- if (n) {
2653
- if (Se(v), !v) {
2654
- De([]);
2655
- return;
2656
- }
2657
- try {
2658
- const R = await xt();
2659
- n && De(R);
2660
- } catch {
2661
- }
2662
- }
2663
- };
2664
- c();
2665
- const f = window.setInterval(() => void c(), 3e4);
2666
- return () => {
2667
- n = !1, window.clearInterval(f);
2668
- };
2669
- }, [_]), P(() => {
2670
- if (!le || ce.length === 0 || we && ce.some((c) => c.id === we))
2671
- return;
2672
- const n = ce.find((c) => c.type === "jar");
2673
- Re((n ?? ce[0]).id);
2674
- }, [ce, we]);
2675
- const st = fe(() => {
2676
- const n = /* @__PURE__ */ new Map();
2677
- for (const c of b) n.set(c.id, c);
2678
- return n;
2679
- }, [b]), Ve = Q(async () => {
2680
- ne(!0);
2681
- const [n, c] = await Promise.allSettled([
2682
- as(_),
2683
- $s(_)
2684
- ]);
2685
- if (n.status === "fulfilled" && N(n.value || []), c.status === "fulfilled") {
2686
- const f = /* @__PURE__ */ new Set(), v = [];
2687
- for (const R of [...c.value.owned, ...c.value.joined])
2688
- f.has(R.id) || (f.add(R.id), v.push(R));
2689
- W(v);
2690
- }
2691
- ne(!1);
2692
- }, [_]);
2693
- P(() => {
2694
- Ve();
2695
- }, [Ve, C == null ? void 0 : C.ts]);
2696
- const Me = fe(() => {
2697
- const n = /* @__PURE__ */ new Map();
2698
- for (const L of U)
2699
- n.set(`sp:${String(L.id)}`, {
2700
- key: `sp:${String(L.id)}`,
2701
- title: L.title,
2702
- sessions: []
2703
- });
2704
- const c = [], f = [...te].sort(
2705
- (L, z) => (z.updateTime || z.createTime || "").localeCompare(
2706
- L.updateTime || L.createTime || ""
2707
- )
2708
- );
2709
- for (const L of f)
2710
- if (L.projectSpaceId != null) {
2711
- const z = `sp:${String(L.projectSpaceId)}`;
2712
- n.has(z) || n.set(z, {
2713
- key: z,
2714
- title: L.projectSpaceTitle || `空间 ${L.projectSpaceId}`,
2715
- sessions: []
2716
- }), n.get(z).sessions.push(L);
2717
- } else
2718
- c.push(L);
2719
- const v = (L) => {
2720
- var z, ut;
2721
- return ((z = L.sessions[0]) == null ? void 0 : z.updateTime) || ((ut = L.sessions[0]) == null ? void 0 : ut.createTime) || "";
2722
- }, R = [...n.values()];
2723
- return R.sort((L, z) => L.sessions.length > 0 && z.sessions.length > 0 ? v(z).localeCompare(v(L)) : L.sessions.length > 0 ? -1 : z.sessions.length > 0 ? 1 : L.title.localeCompare(z.title)), c.length > 0 && R.push({ key: "sp:none", title: "未归组", sessions: c }), R;
2724
- }, [U, te]), ct = fe(
2725
- () => {
2726
- var n;
2727
- return C != null && C.sessionId ? ((n = Me.find(
2728
- (c) => c.sessions.some((f) => f.id === C.sessionId)
2729
- )) == null ? void 0 : n.key) ?? null : null;
2730
- },
2731
- [Me, C == null ? void 0 : C.sessionId]
2732
- );
2733
- P(() => {
2734
- var c;
2735
- const n = ct ?? (nt.current ? null : ((c = Me.find((f) => f.sessions.length > 0)) == null ? void 0 : c.key) ?? null);
2736
- n && (nt.current = !0, he(
2737
- (f) => f.has(n) ? f : new Set(f).add(n)
2738
- ));
2739
- }, [ct, Me]);
2740
- const ht = V(!1);
2741
- P(() => {
2742
- pt || !Pe || ht.current || (ht.current = !0, G("local"));
2743
- }, [Pe]);
2744
- const dt = re && re.type !== "jar" ? re.id : void 0;
2745
- P(() => {
2746
- if (!le || S !== "local" || !me) return;
2747
- let n = !0;
2748
- return fn(dt).then((c) => {
2749
- n && y([...c].sort((f, v) => v.updatedAt - f.updatedAt));
2750
- }).catch(() => {
2751
- n && y([]);
2752
- }), () => {
2753
- n = !1;
2754
- };
2755
- }, [
2756
- S,
2757
- me,
2758
- dt,
2759
- se,
2760
- ke
2761
- ]);
2762
- const Le = fe(() => {
2763
- const n = /* @__PURE__ */ new Map(), c = [];
2764
- for (const v of q) {
2765
- const R = v.workdir ?? null;
2766
- if (!R) {
2767
- c.push(v);
2768
- continue;
2769
- }
2770
- const L = `wd:${R}`;
2771
- if (!n.has(L)) {
2772
- const z = R.split("/").filter(Boolean);
2773
- n.set(L, {
2774
- key: L,
2775
- title: z.length ? z[z.length - 1] : R,
2776
- path: R,
2777
- sessions: []
2778
- });
2779
- }
2780
- n.get(L).sessions.push(v);
2781
- }
2782
- const f = [...n.values()].sort(
2783
- (v, R) => {
2784
- var L, z;
2785
- return (((L = R.sessions[0]) == null ? void 0 : L.updatedAt) ?? 0) - (((z = v.sessions[0]) == null ? void 0 : z.updatedAt) ?? 0);
2786
- }
2787
- );
2788
- return c.length > 0 && f.push({ key: "wd:none", title: "未绑定目录", path: null, sessions: c }), f;
2789
- }, [q]), de = fe(() => {
2790
- if (!se) return null;
2791
- const n = q.find((c) => c.id === se);
2792
- return n ? n.workdir ? `wd:${n.workdir}` : "wd:none" : null;
2793
- }, [q, se]);
2794
- P(() => {
2795
- de && he(
2796
- (n) => n.has(de) ? n : new Set(n).add(de)
2797
- );
2798
- }, [de]);
2799
- const Ge = V(!1);
2800
- P(() => {
2801
- Ge.current || Le.length === 0 || (Ge.current = !0, he((n) => {
2802
- const c = new Set(n);
2803
- for (const f of Le)
2804
- f.sessions.length > 0 && c.add(f.key);
2805
- return c;
2806
- }));
2807
- }, [Le]);
2808
- const ze = Q(() => Ie(null), []), je = (n) => {
2809
- if (n !== S && (G(n), !(K !== "chat" && K !== "landing"))) {
2810
- if (n === "cloud") {
2811
- w(C ? "chat" : "landing");
2812
- return;
2813
- }
2814
- w(me ? "chat" : "landing");
2815
- }
2816
- }, Ee = (n) => {
2817
- G("local"), Ie(n), w("chat");
2818
- }, Te = (n, c = null, f = null) => {
2819
- G("cloud"), X(n.id), J(
2820
- (v) => v && v.agent.id === n.id && v.sessionId === c && !f ? v : { agent: n, sessionId: c, draft: f, ts: Date.now() }
2821
- ), w("chat");
2822
- };
2823
- P(() => {
2824
- const n = h;
2825
- if (!(n != null && n.agent) || !n.ts) return;
2826
- const c = n.agent;
2827
- if (X(c.id), n.view === "detail") {
2828
- ie(c), w("agentDetail");
2829
- return;
2830
- }
2831
- Te(c, n.sessionId ?? null), n.newSession > 0 && Ce((f) => f + 1);
2832
- }, [h == null ? void 0 : h.ts]);
2833
- const Oe = () => {
2834
- G("cloud"), X((pe == null ? void 0 : pe.id) ?? null), J(null), w("landing");
2835
- }, _e = () => {
2836
- G("local"), Ce((n) => n + 1), w("chat");
2837
- }, at = () => {
2838
- if (S === "local" && le && re) {
2839
- _e();
2840
- return;
2841
- }
2842
- if (pe) {
2843
- Te(pe);
2844
- return;
2845
- }
2846
- Oe();
2847
- }, mt = async (n, c) => {
2848
- if (Ue)
2849
- try {
2850
- const f = n.length > 20 ? `${n.slice(0, 20)}…` : n, v = await ls(
2851
- Ue.id,
2852
- f,
2853
- _,
2854
- c
2855
- );
2856
- qe(null), G("cloud"), J({
2857
- agent: Ue,
2858
- sessionId: v.id,
2859
- draft: n,
2860
- ts: Date.now()
2861
- }), w("chat");
2862
- } catch {
2863
- }
2864
- }, gt = (n) => {
2865
- G("local"), ye(n), w("chat");
2866
- }, Je = Q(() => {
2867
- if (le && S === "local" && re) {
2868
- Ce((n) => n + 1), w("chat");
2869
- return;
2870
- }
2871
- G("cloud"), X((pe == null ? void 0 : pe.id) ?? null), J(null), w("landing");
2872
- }, [le, S, re, pe]), _t = fe(() => {
2873
- const n = [
2874
- {
2875
- key: "new-task",
2876
- label: "新建任务",
2877
- icon: /* @__PURE__ */ e(dn, {}),
2878
- hint: "⌘N",
2879
- run: Je
2880
- },
2881
- {
2882
- key: "schedule",
2883
- label: "定时任务",
2884
- icon: /* @__PURE__ */ e(Qn, {}),
2885
- run: () => w("schedule")
2886
- },
2887
- {
2888
- key: "extensions",
2889
- label: "更多能力",
2890
- icon: /* @__PURE__ */ e(Xn, {}),
2891
- run: () => w("extensions")
2892
- },
2893
- {
2894
- key: "todo",
2895
- label: "工作待办",
2896
- icon: /* @__PURE__ */ e(gn, {}),
2897
- run: () => Be("todo")
2898
- },
2899
- {
2900
- key: "notes",
2901
- label: "个人笔记",
2902
- icon: /* @__PURE__ */ e(jt, {}),
2903
- run: () => Be("notes")
2904
- },
2905
- {
2906
- key: "settings",
2907
- label: "设置",
2908
- icon: /* @__PURE__ */ e(mn, {}),
2909
- run: () => i(!0)
2910
- }
2911
- ];
2912
- return le && n.push({
2913
- key: "switch-lane",
2914
- label: S === "local" ? "切换到云端车道" : "切换到本地车道",
2915
- icon: S === "local" ? /* @__PURE__ */ e(zt, {}) : /* @__PURE__ */ e(Zt, {}),
2916
- run: () => je(S === "local" ? "cloud" : "local")
2917
- }), n;
2918
- }, [Je, Be, le, S]);
2919
- P(() => {
2920
- const n = (c) => {
2921
- if (!(c.metaKey || c.ctrlKey) || c.altKey) return;
2922
- const f = c.key.toLowerCase();
2923
- if (f === "k") {
2924
- c.preventDefault(), F((v) => !v);
2925
- return;
2926
- }
2927
- f === "n" && (c.preventDefault(), Je());
2928
- };
2929
- return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
2930
- }, [Je]);
2931
- const It = fe(() => {
2932
- const n = [];
2933
- if (le)
2934
- for (const c of q)
2935
- n.push({
2936
- key: `l-${c.id}`,
2937
- title: c.title || "未命名会话",
2938
- lane: "local",
2939
- updatedAt: c.updatedAt ?? 0,
2940
- open: () => Ee(c.id)
2941
- });
2942
- for (const c of te) {
2943
- const f = st.get(c.personalAgentId);
2944
- if (!f) continue;
2945
- const v = new Date(
2946
- (c.updateTime || c.createTime || "").replace(" ", "T")
2947
- ).getTime();
2948
- n.push({
2949
- key: `c-${c.id}`,
2950
- title: c.title || "未命名会话",
2951
- lane: "cloud",
2952
- updatedAt: Number.isNaN(v) ? 0 : v,
2953
- open: () => Te(f, c.id)
2954
- });
2955
- }
2956
- return n.sort((c, f) => f.updatedAt - c.updatedAt), n.slice(0, 5);
2957
- }, [le, q, te, st]), St = M.nickname || (I == null ? void 0 : I.display_name) || (I == null ? void 0 : I.username) || "", ft = fe(() => s ? [
2958
- {
2959
- mode: "personal",
2960
- label: "个人工作台",
2961
- icon: /* @__PURE__ */ e(Ls, {})
2962
- },
2963
- {
2964
- mode: "collaboration",
2965
- label: "协作工作台",
2966
- icon: /* @__PURE__ */ e(Ds, {})
2967
- }
2968
- ].filter(
2969
- (c) => yn(I, c.mode)
2970
- ) : [], [I, s]), yt = C ? `${C.agent.id}-${C.sessionId ?? 0}-${C.ts}` : "none";
2971
- let ve;
2972
- return K === "agentDetail" && T ? ve = /* @__PURE__ */ e("div", { className: u.detailHost, children: /* @__PURE__ */ e(
2973
- Cn,
2974
- {
2975
- agent: T,
2976
- onBack: () => w("extensions")
2977
- }
2978
- ) }) : K === "schedule" ? ve = /* @__PURE__ */ e(Hs, { localOnline: me }) : K === "extensions" ? ve = /* @__PURE__ */ e(
2979
- Fs,
2980
- {
2981
- agents: b,
2982
- loading: Y,
2983
- skillsAgent: pe,
2984
- token: _,
2985
- currentUser: I,
2986
- lane: S,
2987
- onChat: (n) => Te(n),
2988
- onConfig: (n) => {
2989
- ie(n), w("agentDetail");
2990
- },
2991
- onCreated: (n) => E((c) => [...c, n]),
2992
- onOpenPersonalTab: Be,
2993
- onOpenWorkbenchShell: () => w("workbenchShell"),
2994
- onOpenHistory: () => w("history")
2995
- }
2996
- ) : K === "history" ? ve = /* @__PURE__ */ e(
2997
- js,
2998
- {
2999
- agents: b,
3000
- token: _,
3001
- onOpenSession: (n, c) => Te(n, c)
3002
- }
3003
- ) : K === "workbenchShell" ? ve = /* @__PURE__ */ e(
3004
- tr,
3005
- {
3006
- onOpenProject: We,
3007
- selectedPersonalAgent: Ue,
3008
- personalView: "chat",
3009
- newSessionTrigger: ke,
3010
- onSelectPersonalAgent: (n) => X((n == null ? void 0 : n.id) ?? null),
3011
- onShowPersonalAgentDetail: (n) => {
3012
- ie(n), w("agentDetail");
3013
- },
3014
- onChatWithPersonalAgent: (n) => Te(n),
3015
- onSwitchMode: s
3016
- }
3017
- ) : K === "personalTab" ? ve = /* @__PURE__ */ l("div", { className: u.personalTabHost, children: [
3018
- O === "projects" && /* @__PURE__ */ e(
3019
- qt,
3020
- {
3021
- activeTab: "projects",
3022
- onActiveTabChange: () => {
3023
- },
3024
- onOpenProject: We,
3025
- hideTabs: !0
3026
- }
3027
- ),
3028
- O === "personal" && /* @__PURE__ */ e(
3029
- qt,
3030
- {
3031
- activeTab: "personal",
3032
- onActiveTabChange: () => {
3033
- },
3034
- onOpenProject: We,
3035
- hideTabs: !0
3036
- }
3037
- ),
3038
- O === "business-stats" && /* @__PURE__ */ e(ln, { source: "scenario" }),
3039
- O === "tools" && /* @__PURE__ */ e(wt, { showTools: !0, showWebsites: !1 }),
3040
- O === "websites" && /* @__PURE__ */ e(wt, { showTools: !1, showWebsites: !0 }),
3041
- O === "todo" && /* @__PURE__ */ e(
3042
- rn,
3043
- {
3044
- onOpenProject: We,
3045
- onOpenNote: (n) => {
3046
- ot("notes"), He({ id: n, ts: Date.now() });
3047
- },
3048
- onOpenAgentSession: (n, c) => {
3049
- const f = b.find((v) => it(v.id, c));
3050
- f && Te(f, n);
3051
- },
3052
- openTodoId: Fe
3053
- }
3054
- ),
3055
- O === "notes" && /* @__PURE__ */ e(
3056
- on,
3057
- {
3058
- onOpenProject: We,
3059
- onOpenTodo: Ye,
3060
- openNoteId: ge
3061
- }
3062
- ),
3063
- O === "training" && /* @__PURE__ */ e(Nn, {}),
3064
- O === "webide" && /* @__PURE__ */ e(kn, {})
3065
- ] }) : S === "cloud" && C ? ve = /* @__PURE__ */ e("div", { className: u.chatHost, children: /* @__PURE__ */ e(
3066
- wn,
3067
- {
3068
- agent: C.agent,
3069
- initialSessionId: C.sessionId,
3070
- autoSendDraft: C.draft,
3071
- chromeless: !0,
3072
- agents: b,
3073
- onSwitchAgent: (n) => Te(n)
3074
- },
3075
- yt
3076
- ) }) : S === "local" && le && re && K !== "landing" ? ve = /* @__PURE__ */ e("div", { className: u.chatHost, children: /* @__PURE__ */ e(
3077
- Tn,
3078
- {
3079
- agent: rr(re),
3080
- newSessionTrigger: ke,
3081
- autoSendDraft: tt,
3082
- onAutoSendConsumed: () => ye(null),
3083
- openSessionId: se,
3084
- onOpenSessionConsumed: ze,
3085
- onSessionsMutated: () => Ce((n) => n + 1)
3086
- },
3087
- re.id
3088
- ) }) : ve = /* @__PURE__ */ e(
3089
- ir,
3090
- {
3091
- agents: b,
3092
- activeAgent: Ue,
3093
- onSwitchAgent: (n) => X(n.id),
3094
- localAgentName: S === "local" ? (re == null ? void 0 : re.name) ?? "本机 Agent" : null,
3095
- onLocalSend: S === "local" ? gt : void 0,
3096
- localOffline: S === "local" && !me,
3097
- initialSpace: be,
3098
- onSend: mt,
3099
- onOpenTab: Be,
3100
- onQuickAsk: at,
3101
- recentTasks: It,
3102
- onOpenHistory: () => w("history")
3103
- }
3104
- ), /* @__PURE__ */ l("div", { className: u.shell, children: [
3105
- /* @__PURE__ */ l("aside", { className: u.sidebar, "aria-label": "个人专享工作台导航", children: [
3106
- /* @__PURE__ */ l("div", { className: u.sideContent, children: [
3107
- le && /* @__PURE__ */ l("div", { className: u.laneTabs, role: "tablist", "aria-label": "任务车道", children: [
3108
- /* @__PURE__ */ l(
3109
- "button",
3110
- {
3111
- type: "button",
3112
- role: "tab",
3113
- "aria-selected": S === "local",
3114
- className: `${u.laneTab} ${S === "local" ? u.laneTabActive : ""}`,
3115
- onClick: () => je("local"),
3116
- title: me ? "本机 Agent 已连接:任务在你的电脑上执行" : "本机 Agent 未运行:启动 Z-OPC 桌面端伴生服务后可用",
3117
- children: [
3118
- /* @__PURE__ */ e(Zt, { className: u.laneIcon }),
3119
- /* @__PURE__ */ e("span", { className: u.laneText, children: "本地" })
3120
- ]
3121
- }
3122
- ),
3123
- /* @__PURE__ */ l(
3124
- "button",
3125
- {
3126
- type: "button",
3127
- role: "tab",
3128
- "aria-selected": S === "cloud",
3129
- className: `${u.laneTab} ${S === "cloud" ? u.laneTabActive : ""}`,
3130
- onClick: () => je("cloud"),
3131
- title: "云端任务:跨设备同步,手机/网页都能继续",
3132
- children: [
3133
- /* @__PURE__ */ e(zt, { className: u.laneIcon }),
3134
- /* @__PURE__ */ e("span", { className: u.laneText, children: "云端" })
3135
- ]
3136
- }
3137
- )
3138
- ] }),
3139
- /* @__PURE__ */ e(
3140
- Ts,
3141
- {
3142
- currentUser: I,
3143
- token: _,
3144
- isDesktop: pt,
3145
- activeNav: K === "schedule" ? "schedule" : K === "history" ? "history" : null,
3146
- extensionsGroupActive: [
3147
- "extensions",
3148
- "agentDetail",
3149
- "personalTab",
3150
- "workbenchShell"
3151
- ].includes(K),
3152
- activePersonalTab: K === "personalTab" ? O : null,
3153
- onDesktopNewTask: S === "local" && re ? _e : void 0,
3154
- onNewTaskLanding: S === "cloud" ? Oe : void 0,
3155
- onPickSpace: (n) => {
3156
- qe(n), Oe();
3157
- },
3158
- currentSpaceId: (be == null ? void 0 : be.id) ?? null,
3159
- onOpenSchedule: () => w("schedule"),
3160
- onOpenExtensions: () => w("extensions"),
3161
- onOpenHistory: () => w("history"),
3162
- onOpenSearch: () => {
3163
- F(!0), $e.getState().loadProjects();
3164
- },
3165
- searchActive: ee,
3166
- onOpenPersonalTab: Be,
3167
- onOpenWorkbenchShell: () => w("workbenchShell")
3168
- }
3169
- ),
3170
- /* @__PURE__ */ e("div", { className: u.sideTasks, children: S === "cloud" ? /* @__PURE__ */ l(et, { children: [
3171
- /* @__PURE__ */ e("div", { className: u.tasksLabel, children: "项目" }),
3172
- Me.length === 0 && !A && /* @__PURE__ */ e("div", { className: u.tasksEmpty, children: "还没有项目空间或云端任务" }),
3173
- Me.map((n) => {
3174
- const c = ae.has(n.key);
3175
- return /* @__PURE__ */ l("div", { children: [
3176
- /* @__PURE__ */ l(
3177
- "button",
3178
- {
3179
- type: "button",
3180
- className: u.projFolder,
3181
- "aria-expanded": c,
3182
- onClick: () => he((f) => {
3183
- const v = new Set(f);
3184
- return v.has(n.key) ? v.delete(n.key) : v.add(n.key), v;
3185
- }),
3186
- children: [
3187
- /* @__PURE__ */ e(
3188
- Ct,
3189
- {
3190
- className: `${u.projCaret} ${c ? u.projCaretOpen : ""}`
3191
- }
3192
- ),
3193
- /* @__PURE__ */ e(Pt, { className: u.projIcon }),
3194
- /* @__PURE__ */ e("span", { className: u.projName, title: n.title, children: n.title }),
3195
- /* @__PURE__ */ e("span", { className: u.projMeta, children: n.sessions.length > 0 ? n.sessions.length : "暂无任务" })
3196
- ]
3197
- }
3198
- ),
3199
- c && n.sessions.length > 0 && /* @__PURE__ */ e("div", { className: u.projRows, children: n.sessions.map((f) => {
3200
- const v = st.get(f.personalAgentId);
3201
- return /* @__PURE__ */ e(
3202
- "button",
3203
- {
3204
- type: "button",
3205
- className: `${u.recentItem} ${(C == null ? void 0 : C.sessionId) === f.id ? u.recentItemActive : ""}`,
3206
- disabled: !v,
3207
- title: v ? f.title || "未命名会话" : "伙伴已不存在,无法打开",
3208
- onClick: () => v && Te(v, f.id),
3209
- children: /* @__PURE__ */ e("span", { className: u.recentItemText, children: f.title || "未命名会话" })
3210
- },
3211
- f.id
3212
- );
3213
- }) })
3214
- ] }, n.key);
3215
- })
3216
- ] }) : /* @__PURE__ */ l(et, { children: [
3217
- /* @__PURE__ */ e("div", { className: u.tasksLabel, children: "目录" }),
3218
- Le.map((n) => {
3219
- const c = ae.has(n.key);
3220
- return /* @__PURE__ */ l("div", { children: [
3221
- /* @__PURE__ */ l(
3222
- "button",
3223
- {
3224
- type: "button",
3225
- className: u.projFolder,
3226
- "aria-expanded": c,
3227
- title: n.path ?? "未绑定目录:任务不带目录上下文",
3228
- onClick: () => he((f) => {
3229
- const v = new Set(f);
3230
- return v.has(n.key) ? v.delete(n.key) : v.add(n.key), v;
3231
- }),
3232
- children: [
3233
- /* @__PURE__ */ e(
3234
- Ct,
3235
- {
3236
- className: `${u.projCaret} ${c ? u.projCaretOpen : ""}`
3237
- }
3238
- ),
3239
- /* @__PURE__ */ e(Pt, { className: u.projIcon }),
3240
- /* @__PURE__ */ e("span", { className: u.projName, children: n.title }),
3241
- /* @__PURE__ */ e("span", { className: u.projMeta, children: n.sessions.length })
3242
- ]
3243
- }
3244
- ),
3245
- c && /* @__PURE__ */ e("div", { className: u.projRows, children: n.sessions.map((f) => /* @__PURE__ */ e(
3246
- "button",
3247
- {
3248
- type: "button",
3249
- className: `${u.recentItem} ${se === f.id ? u.recentItemActive : ""}`,
3250
- title: f.title,
3251
- onClick: () => Ee(f.id),
3252
- children: /* @__PURE__ */ e("span", { className: u.recentItemText, children: f.title || "未命名会话" })
3253
- },
3254
- f.id
3255
- )) })
3256
- ] }, n.key);
3257
- }),
3258
- q.length === 0 && /* @__PURE__ */ e("div", { className: u.tasksEmpty, children: me ? "暂无本地任务,点上方「新建任务」开始" : "本机 Agent 未运行 —— 启动 Z-OPC 桌面端后自动连上" })
3259
- ] }) })
3260
- ] }),
3261
- /* @__PURE__ */ e(
3262
- Is,
3263
- {
3264
- displayName: St,
3265
- subtitle: "Z-OPC · 个人(专享)",
3266
- onOpenSettings: () => i(!0),
3267
- children: ft.map((n) => /* @__PURE__ */ l(
3268
- "button",
3269
- {
3270
- type: "button",
3271
- role: "menuitem",
3272
- className: u.agentMenuItem,
3273
- onClick: () => s == null ? void 0 : s(n.mode),
3274
- children: [
3275
- /* @__PURE__ */ e("span", { className: u.navIcon, children: n.icon }),
3276
- /* @__PURE__ */ e("span", { children: n.label })
3277
- ]
3278
- },
3279
- n.mode
3280
- ))
3281
- }
3282
- )
3283
- ] }),
3284
- /* @__PURE__ */ e("main", { className: u.main, "aria-label": "个人专享工作台内容", children: Y && !C && !re ? /* @__PURE__ */ e("div", { className: u.emptyState, children: /* @__PURE__ */ e("span", { className: u.emptyTitle, children: "正在加载智能伙伴…" }) }) : ve }),
3285
- /* @__PURE__ */ e(
3286
- Ss,
3287
- {
3288
- open: rt,
3289
- onClose: () => i(!1),
3290
- token: _
3291
- }
3292
- ),
3293
- ee && /* @__PURE__ */ e(
3294
- As,
3295
- {
3296
- sessions: te,
3297
- localSessions: le ? q : [],
3298
- agentsById: st,
3299
- projects: $,
3300
- token: _,
3301
- actions: _t,
3302
- onOpenSession: (n, c) => Te(n, c),
3303
- onOpenLocalSession: Ee,
3304
- onOpenProject: (n) => We(n.id),
3305
- onClose: () => F(!1)
3306
- }
3307
- )
3308
- ] });
3309
- }
3310
- export {
3311
- kr as default
3312
- };