@yuku123/z-team-component 0.2.130 → 0.2.131

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 (49) hide show
  1. package/dist/{ChangeLogView-AY7dKChQ.js → ChangeLogView-SwacGpsw.js} +1 -1
  2. package/dist/{ComponentDoc-DTpTBK1V.js → ComponentDoc-Dh5YhLCI.js} +1018 -1048
  3. package/dist/{InvitationManagementPage-YzQVnNWz.js → InvitationManagementPage-CjEcLOGB.js} +1 -1
  4. package/dist/{OnboardingPage-ClH-s7zs.js → OnboardingPage-DvNt71kX.js} +2 -2
  5. package/dist/{ScheduledTasks-DhcmGmhu.js → ScheduledTasks-COgb4MZJ.js} +6 -6
  6. package/dist/SystemShell-CSXcsiNp.js +752 -0
  7. package/dist/{admin-logs-2gdJxEwA.js → admin-logs-CExsxQ5h.js} +5 -5
  8. package/dist/{api-BHYf7Uyx.js → api-C9kTgVc2.js} +1 -1
  9. package/dist/{api---aB1ADx.js → api-DXw93E7c.js} +1 -1
  10. package/dist/{createWorkspaceWsHandler-BC4HmdFu.js → createWorkspaceWsHandler-BwDUTYXH.js} +319 -319
  11. package/dist/{index-CqOsWy6H.js → index-9rfSVSTh.js} +9 -9
  12. package/dist/{index-lucAUJAv.js → index-B2Dfbi8J.js} +2 -2
  13. package/dist/{index-Chzml7fB.js → index-B3uLo8-F.js} +3 -3
  14. package/dist/{index-CnIbuXF9.js → index-BNPq7yBg.js} +2 -2
  15. package/dist/{index--HSE1tzT.js → index-BTJ83JLl.js} +11 -11
  16. package/dist/{index-9coNts0T.js → index-BkzBYfhO.js} +8489 -8453
  17. package/dist/{index-BkbSCWQ7.js → index-BoY7L8C4.js} +42 -37
  18. package/dist/index-Bs9odXxd.js +1214 -0
  19. package/dist/{index-mwKbvNPB.js → index-CF3xDZ7q.js} +4 -4
  20. package/dist/{index-CnRAUDUi.js → index-COobH4Vi.js} +1 -1
  21. package/dist/{index-Opx4qrhX.js → index-CU6jFFl5.js} +3 -3
  22. package/dist/{index-DA0MCrVH.js → index-CXEYA7rt.js} +2 -2
  23. package/dist/{index-Zr09eAzk.js → index-CZCKpsry.js} +2 -2
  24. package/dist/{index-CnyMTIyv.js → index-Ceu-yckM.js} +70 -70
  25. package/dist/{index-baUMWaRm.js → index-Ci6_CBwE.js} +3 -3
  26. package/dist/{index-CTqU8nrB.js → index-CntZHojY.js} +2 -2
  27. package/dist/{index-DqiBrPAv.js → index-D2DFKRUf.js} +1 -1
  28. package/dist/{index-DfpB0BR9.js → index-DLK7DuCr.js} +3 -3
  29. package/dist/{index-Ci31buz9.js → index-DM6XeWFk.js} +4059 -4043
  30. package/dist/{index-fJnhCAB9.js → index-DMfYPIkB.js} +2 -2
  31. package/dist/{index-Ca08VoFz.js → index-DZ0fYNO9.js} +20 -20
  32. package/dist/{index-Cui8SX9p.js → index-D_J1ZCy8.js} +3 -3
  33. package/dist/{index-Ccvhn50s.js → index-DmV6xR7C.js} +9 -9
  34. package/dist/{index-CROBbbCB.js → index-ftuPuj0s.js} +9 -9
  35. package/dist/{index-DHubhPeT.js → index-mEgmHNRO.js} +1 -1
  36. package/dist/{index--L2wU6OV.js → index-t2nMJUPu.js} +1 -1
  37. package/dist/index.js +1 -1
  38. package/dist/{instance-ITIB5e5v.js → instance-DD3kbAUh.js} +1 -1
  39. package/dist/{menuPermission-Dw1EJWIf.js → menuPermission-v0881tid.js} +3 -3
  40. package/dist/pages.js +1 -1
  41. package/dist/{send-default-agent-team-message-DzRmAa6S.js → send-default-agent-team-message-Cug0T_7J.js} +1 -1
  42. package/dist/{sso-user-497FBkoQ.js → sso-user-CnVXqYR7.js} +1 -1
  43. package/dist/{training-B4IByvWW.js → training-BS23m-yy.js} +1 -1
  44. package/dist/useSidebarResize--Avuabb1.js +46 -0
  45. package/dist/{webide-DwQqqS-I.js → webide-BPJ1IpZq.js} +3 -3
  46. package/dist/z-team-component.css +1 -1
  47. package/package.json +1 -1
  48. package/dist/SystemShell-Cz7S4YnT.js +0 -718
  49. package/dist/index-4apTfQuo.js +0 -2213
@@ -0,0 +1,1214 @@
1
+ import { jsx as n, jsxs as p, Fragment as J } from "react/jsx-runtime";
2
+ import { S as An, P as Dn } from "./webide-BPJ1IpZq.js";
3
+ import { Dropdown as en } from "antd";
4
+ import { PlayCircleOutlined as Pn, FileTextOutlined as cn, PlusOutlined as $n, ClockCircleOutlined as jn, AppstoreOutlined as xn, UnorderedListOutlined as En, SettingOutlined as Rn } from "@ant-design/icons";
5
+ import { useState as d, useRef as Ne, useEffect as I, useCallback as B, useMemo as L } from "react";
6
+ import { u as X, o as Mn, q as Kn, t as Fn, n as z, v as Bn, w as ke, x as Hn, y as Wn } from "./ComponentDoc-Dh5YhLCI.js";
7
+ import { s, T as _n, R as De, D as we, f as Zn, a as Gn, F as Pe, P as Vn, L as Un, A as Qn, C as zn, b as Jn, c as Xn, p as Yn, d as qn, e as nn, g as tn, h as et, W as nt, i as tt, S as st, j as at, k as lt, l as sn, m as ot, r as it, n as ct, U as rt, o as dt, q as ut, t as pt } from "./index-DM6XeWFk.js";
8
+ import { u as rn, i as ht, s as an, c as mt } from "./createWorkspaceWsHandler-BwDUTYXH.js";
9
+ import { h as ft, f as gt } from "./index-ftuPuj0s.js";
10
+ import { S as bt, P as yt, L as kt, a as Nt, E as wt, C as Tt, W as ln, b as on, T as vt, c as Ct } from "./ScheduledTasks-COgb4MZJ.js";
11
+ import { TodoTab as St } from "@yuku123/z-task-component";
12
+ const It = [
13
+ "帮我排查一个线上问题",
14
+ "总结一下今天的群聊进展",
15
+ "把这周的变更整理成周报"
16
+ ], Ot = [
17
+ {
18
+ key: "video",
19
+ label: "视频生成",
20
+ icon: /* @__PURE__ */ n(Pn, {}),
21
+ action: "chat",
22
+ prompt: "帮我写一条 15 秒短视频脚本,主题是:"
23
+ },
24
+ {
25
+ key: "docs",
26
+ label: "文档办公",
27
+ icon: /* @__PURE__ */ n(cn, {}),
28
+ action: "tools"
29
+ },
30
+ {
31
+ key: "vibe",
32
+ label: "Vibe Coding",
33
+ icon: /* @__PURE__ */ n(zn, {}),
34
+ action: "webide"
35
+ },
36
+ {
37
+ key: "design",
38
+ label: "设计视觉",
39
+ icon: /* @__PURE__ */ n(Jn, {}),
40
+ action: "chat",
41
+ prompt: "帮我出一版视觉设计稿,风格偏:"
42
+ },
43
+ {
44
+ key: "ask",
45
+ label: "问问 Z-OPC",
46
+ icon: /* @__PURE__ */ n(De, {}),
47
+ action: "ask"
48
+ }
49
+ ];
50
+ function Lt() {
51
+ const g = (/* @__PURE__ */ new Date()).getHours();
52
+ return g < 5 ? "夜深了" : g < 12 ? "早上好" : g < 14 ? "中午好" : g < 18 ? "下午好" : "晚上好";
53
+ }
54
+ function At(g) {
55
+ if (!g) return "";
56
+ const b = new Date(g), O = /* @__PURE__ */ new Date(), h = O.getTime() - g;
57
+ if (h < 6e4) return "刚刚";
58
+ if (h < 36e5) return `${Math.floor(h / 6e4)} 分钟前`;
59
+ if (b.toDateString() === O.toDateString()) {
60
+ const A = (y) => String(y).padStart(2, "0");
61
+ return `${A(b.getHours())}:${A(b.getMinutes())}`;
62
+ }
63
+ const k = new Date(O);
64
+ return k.setDate(O.getDate() - 1), b.toDateString() === k.toDateString() ? "昨天" : `${b.getMonth() + 1}月${b.getDate()}日`;
65
+ }
66
+ function Dt({
67
+ agents: g,
68
+ activeAgent: b,
69
+ onSwitchAgent: O,
70
+ localAgentName: h,
71
+ onLocalSend: k,
72
+ localOffline: A = !1,
73
+ initialSpace: y,
74
+ onSend: Y,
75
+ onOpenTab: q,
76
+ onQuickAsk: ce,
77
+ recentTasks: ee = [],
78
+ onOpenHistory: M
79
+ }) {
80
+ const w = X((i) => i.token), m = X((i) => i.currentUser), u = rn(), [D, f] = d(""), T = Ne(null), [C, G] = d(!1), [re, ne] = d(!1), [j, V] = d(y ?? null), [de, H] = d(!1);
81
+ I(() => {
82
+ y && V(y);
83
+ }, [y]);
84
+ const ue = B(async () => {
85
+ const i = D.trim();
86
+ if (!(!i || C) && !A) {
87
+ if (h && k) {
88
+ k(i), f("");
89
+ return;
90
+ }
91
+ if (b) {
92
+ G(!0);
93
+ try {
94
+ await Y(i, j), f(""), V(null);
95
+ } finally {
96
+ G(!1);
97
+ }
98
+ }
99
+ }
100
+ }, [D, C, A, h, k, b, Y, j]), pe = u.nickname || (m == null ? void 0 : m.display_name) || (m == null ? void 0 : m.username) || "";
101
+ return /* @__PURE__ */ n("div", { className: `${s.landing} ${s.xwScope}`, children: /* @__PURE__ */ p("div", { className: s.landingInner, children: [
102
+ /* @__PURE__ */ n("div", { className: s.mascot, "aria-hidden": "true", children: /* @__PURE__ */ n("img", { src: _n, alt: "" }) }),
103
+ /* @__PURE__ */ n("h1", { className: s.landingTitle, children: u.greetingEnabled ? `${Lt()}${pe ? `,${pe}` : ""}` : "开始新的对话" }),
104
+ /* @__PURE__ */ n("p", { className: s.landingSub, children: h ? A ? "本机 Agent 未运行 —— 启动 Z-OPC 桌面端(伴生服务起来后自动连上)" : "本地模式:任务在你的电脑上执行,文件与上下文都不上云" : u.bio || "我是你的智能伙伴,有什么可以帮你?" }),
105
+ /* @__PURE__ */ p("div", { className: s.landingBox, children: [
106
+ /* @__PURE__ */ n(
107
+ "textarea",
108
+ {
109
+ ref: T,
110
+ className: s.landingInput,
111
+ placeholder: h ? A ? "本机 Agent 未运行,启动桌面端后即可在本地执行" : `给本机 Agent 发送消息,${an(u.sendKey)}` : `给智能伙伴发送消息,${an(u.sendKey)}`,
112
+ rows: 3,
113
+ value: D,
114
+ autoFocus: !0,
115
+ onChange: (i) => f(i.target.value),
116
+ onKeyDown: (i) => {
117
+ ht(i, u.sendKey) && !i.nativeEvent.isComposing && (i.preventDefault(), ue());
118
+ }
119
+ }
120
+ ),
121
+ /* @__PURE__ */ p("div", { className: s.landingBoxBar, children: [
122
+ h ? /* @__PURE__ */ p("span", { className: s.agentChip, children: [
123
+ /* @__PURE__ */ n(De, {}),
124
+ /* @__PURE__ */ p("span", { children: [
125
+ h,
126
+ "(本机)"
127
+ ] })
128
+ ] }) : b ? /* @__PURE__ */ p("div", { className: s.agentChipWrap, children: [
129
+ /* @__PURE__ */ p(
130
+ "button",
131
+ {
132
+ type: "button",
133
+ className: s.agentChip,
134
+ onClick: () => ne((i) => !i),
135
+ children: [
136
+ /* @__PURE__ */ n(De, {}),
137
+ /* @__PURE__ */ n("span", { children: b.displayName }),
138
+ g.length > 1 && /* @__PURE__ */ n(we, { className: s.chipCaret })
139
+ ]
140
+ }
141
+ ),
142
+ re && g.length > 1 && /* @__PURE__ */ p(J, { children: [
143
+ /* @__PURE__ */ n(
144
+ "div",
145
+ {
146
+ className: s.agentMenuMask,
147
+ onClick: () => ne(!1)
148
+ }
149
+ ),
150
+ /* @__PURE__ */ n("div", { className: s.agentMenu, role: "menu", children: g.map((i) => /* @__PURE__ */ p(
151
+ "button",
152
+ {
153
+ type: "button",
154
+ role: "menuitem",
155
+ className: `${s.agentMenuItem} ${i.id === b.id ? s.agentMenuItemActive : ""}`,
156
+ onClick: () => {
157
+ O(i), ne(!1);
158
+ },
159
+ children: [
160
+ /* @__PURE__ */ n(
161
+ "span",
162
+ {
163
+ className: s.agentDot,
164
+ style: { background: Gn(i.displayName) },
165
+ children: Zn(i.displayName)
166
+ }
167
+ ),
168
+ i.displayName
169
+ ]
170
+ },
171
+ i.id
172
+ )) })
173
+ ] })
174
+ ] }) : /* @__PURE__ */ n("span", { className: s.agentChipEmpty, children: "还没有云端伙伴,可到个人工作台创建" }),
175
+ !h && b && /* @__PURE__ */ p("div", { className: s.agentChipWrap, children: [
176
+ /* @__PURE__ */ p(
177
+ "button",
178
+ {
179
+ type: "button",
180
+ className: s.agentChip,
181
+ title: "本次新建任务归入的项目空间(可选)",
182
+ onClick: () => H((i) => !i),
183
+ children: [
184
+ /* @__PURE__ */ n(Pe, {}),
185
+ /* @__PURE__ */ n("span", { children: j ? j.title : "不归组" }),
186
+ /* @__PURE__ */ n(we, { className: s.chipCaret })
187
+ ]
188
+ }
189
+ ),
190
+ de && /* @__PURE__ */ p(J, { children: [
191
+ /* @__PURE__ */ n(
192
+ "div",
193
+ {
194
+ className: s.agentMenuMask,
195
+ onClick: () => H(!1)
196
+ }
197
+ ),
198
+ /* @__PURE__ */ n(
199
+ Vn,
200
+ {
201
+ token: w,
202
+ currentId: (j == null ? void 0 : j.id) ?? null,
203
+ onPick: (i) => {
204
+ V(i), H(!1);
205
+ }
206
+ }
207
+ )
208
+ ] })
209
+ ] }),
210
+ /* @__PURE__ */ n(
211
+ "button",
212
+ {
213
+ type: "button",
214
+ className: s.landingSend,
215
+ disabled: !D.trim() || C || A || !b && !h,
216
+ onClick: () => void ue(),
217
+ "aria-label": "发送",
218
+ children: C ? /* @__PURE__ */ n(Un, {}) : /* @__PURE__ */ n(Qn, {})
219
+ }
220
+ )
221
+ ] })
222
+ ] }),
223
+ ee.length > 0 && /* @__PURE__ */ p("section", { className: s.recentBlock, "aria-label": "继续最近任务", children: [
224
+ /* @__PURE__ */ p("div", { className: s.recentHead, children: [
225
+ /* @__PURE__ */ n("span", { children: "继续最近任务" }),
226
+ M && /* @__PURE__ */ n(
227
+ "button",
228
+ {
229
+ type: "button",
230
+ className: s.recentAll,
231
+ onClick: M,
232
+ children: "全部 →"
233
+ }
234
+ )
235
+ ] }),
236
+ /* @__PURE__ */ n("div", { className: s.recentList, children: ee.map((i) => /* @__PURE__ */ p(
237
+ "button",
238
+ {
239
+ type: "button",
240
+ className: s.recentRow,
241
+ title: i.title,
242
+ onClick: i.open,
243
+ children: [
244
+ /* @__PURE__ */ n(
245
+ "span",
246
+ {
247
+ className: `${s.recentLane} ${i.lane === "local" ? s.recentLaneLocal : ""}`,
248
+ children: i.lane === "local" ? "本地" : "云端"
249
+ }
250
+ ),
251
+ /* @__PURE__ */ n("span", { className: s.recentTitle, children: i.title }),
252
+ /* @__PURE__ */ n("span", { className: s.recentTime, children: At(i.updatedAt) })
253
+ ]
254
+ },
255
+ i.key
256
+ )) })
257
+ ] }),
258
+ /* @__PURE__ */ n("div", { className: s.chipRow, children: Ot.map((i) => /* @__PURE__ */ p(
259
+ "button",
260
+ {
261
+ type: "button",
262
+ className: s.capChip,
263
+ onClick: () => {
264
+ var W;
265
+ if (i.action === "tools") {
266
+ q("tools");
267
+ return;
268
+ }
269
+ if (i.action === "webide") {
270
+ q("webide");
271
+ return;
272
+ }
273
+ if (i.action === "ask") {
274
+ ce();
275
+ return;
276
+ }
277
+ f(i.prompt ?? ""), (W = T.current) == null || W.focus();
278
+ },
279
+ children: [
280
+ /* @__PURE__ */ n("span", { className: s.capChipIcon, children: i.icon }),
281
+ /* @__PURE__ */ n("span", { children: i.label })
282
+ ]
283
+ },
284
+ i.key
285
+ )) }),
286
+ /* @__PURE__ */ n("div", { className: s.chipRow, children: It.map((i) => /* @__PURE__ */ n(
287
+ "button",
288
+ {
289
+ type: "button",
290
+ className: s.suggestChip,
291
+ onClick: () => {
292
+ var W;
293
+ f(i), (W = T.current) == null || W.focus();
294
+ },
295
+ children: i
296
+ },
297
+ i
298
+ )) }),
299
+ /* @__PURE__ */ p("p", { className: s.shortcutHint, children: [
300
+ /* @__PURE__ */ n("kbd", { className: s.shortcutKbd, children: "⌘K" }),
301
+ /* @__PURE__ */ n("span", { children: "搜索与命令" }),
302
+ /* @__PURE__ */ n("span", { className: s.shortcutDot, children: "·" }),
303
+ /* @__PURE__ */ n("kbd", { className: s.shortcutKbd, children: "⌘N" }),
304
+ /* @__PURE__ */ n("span", { children: "新建任务" })
305
+ ] })
306
+ ] }) });
307
+ }
308
+ const ie = ut() || typeof localStorage < "u" && localStorage.getItem("ft_exclusive_force_desktop") === "1";
309
+ function Pt(g) {
310
+ return g.type === "jar" ? {
311
+ id: "-1",
312
+ userId: "local",
313
+ agentHubAgentId: null,
314
+ agentCode: "local-default",
315
+ displayName: g.name || "本地 Agent",
316
+ avatar: null,
317
+ isLocal: !0
318
+ } : {
319
+ id: "-1",
320
+ userId: "local",
321
+ agentHubAgentId: null,
322
+ agentCode: g.name,
323
+ displayName: g.name,
324
+ avatar: null,
325
+ isLocal: !0,
326
+ localAgentId: g.id,
327
+ localAgentType: g.type
328
+ };
329
+ }
330
+ function _t({
331
+ onSwitchMode: g,
332
+ onOpenProject: b,
333
+ openAgentRequest: O
334
+ }) {
335
+ const h = X((e) => e.token), k = X((e) => e.currentUser), A = rn(), [y, Y] = d([]), [q, ce] = d(!0), [ee, M] = d(null), [w, m] = d("landing"), [u, D] = d(null), [f, T] = d(
336
+ ie ? "local" : "cloud"
337
+ ), [C, G] = d(
338
+ []
339
+ ), [re, ne] = d([]), [j, V] = d(!0), [de, H] = d(!1), [ue, pe] = d(null), i = B(
340
+ (e) => {
341
+ pe({ tab: e ?? "agents", ts: Date.now() }), m("extensions");
342
+ },
343
+ []
344
+ ), W = X((e) => e.projects), [K, $e] = d([]), [_, Te] = d(null), [je, te] = d(
345
+ /* @__PURE__ */ new Set()
346
+ ), [xe, U] = d(0), [dn, Ee] = d(null), [P, ve] = d(null), [Ce, se] = d(""), [un, Re] = d(!1), [F, Me] = d(!1), [x, he] = d([]), [ae, pn] = d(null), [Se, hn] = d(!1), v = ie || Se, [me, Ke] = d(null), le = B(
347
+ (e) => {
348
+ const t = Xn(e);
349
+ t && !ft(k, t) || (Oe(e), m("personalTab"));
350
+ },
351
+ [k]
352
+ ), [mn, Ie] = d(!1), [Fe, Be] = d(
353
+ null
354
+ ), [fn, gn] = d(
355
+ null
356
+ ), [bn, yn] = d(
357
+ null
358
+ ), oe = B(
359
+ (e, t) => {
360
+ b == null || b(e, t);
361
+ },
362
+ [b]
363
+ ), kn = B((e) => {
364
+ Oe("todo"), yn({ id: e, ts: Date.now() });
365
+ }, []), [$, Oe] = d("personal"), He = Ne(!1), S = L(() => Yn(y), [y]), Z = L(
366
+ () => y.find((e) => e.id === ee) ?? S,
367
+ [y, ee, S]
368
+ );
369
+ v && F && x.length > 0;
370
+ const N = L(
371
+ () => x.find((e) => e.id === ae) ?? null,
372
+ [x, ae]
373
+ );
374
+ I(() => {
375
+ let e = !0;
376
+ return ce(!0), Mn(h).then((t) => {
377
+ e && Y(t);
378
+ }).catch(() => {
379
+ }).finally(() => {
380
+ e && ce(!1);
381
+ }), () => {
382
+ e = !1;
383
+ };
384
+ }, [h]), I(() => {
385
+ let e = !0;
386
+ const t = async () => {
387
+ if (!ie) {
388
+ let o = !1;
389
+ try {
390
+ o = !!(await lt(h)).online;
391
+ } catch {
392
+ o = !1;
393
+ }
394
+ if (!e) return;
395
+ if (hn(o), pt(o ? "tunnel" : "direct", h), Me(o), !o) {
396
+ he([]);
397
+ return;
398
+ }
399
+ try {
400
+ const c = await sn();
401
+ e && he(c);
402
+ } catch {
403
+ }
404
+ return;
405
+ }
406
+ const l = await ot();
407
+ if (e) {
408
+ if (Me(l), !l) {
409
+ he([]);
410
+ return;
411
+ }
412
+ try {
413
+ const o = await sn();
414
+ e && he(o);
415
+ } catch {
416
+ }
417
+ }
418
+ };
419
+ t();
420
+ const a = window.setInterval(() => void t(), 3e4);
421
+ return () => {
422
+ e = !1, window.clearInterval(a);
423
+ };
424
+ }, [h]), I(() => {
425
+ if (!v || x.length === 0 || ae && x.some((t) => t.id === ae))
426
+ return;
427
+ const e = x.find((t) => t.type === "jar");
428
+ pn((e ?? x[0]).id);
429
+ }, [x, ae]);
430
+ const fe = L(() => {
431
+ const e = /* @__PURE__ */ new Map();
432
+ for (const t of y) e.set(t.id, t);
433
+ return e;
434
+ }, [y]), We = B(async () => {
435
+ V(!0);
436
+ const [e, t] = await Promise.allSettled([
437
+ Kn(h),
438
+ gt(h)
439
+ ]);
440
+ if (e.status === "fulfilled" && G(e.value || []), t.status === "fulfilled") {
441
+ const a = /* @__PURE__ */ new Set(), l = [];
442
+ for (const o of [...t.value.owned, ...t.value.joined])
443
+ a.has(o.id) || (a.add(o.id), l.push(o));
444
+ ne(l);
445
+ }
446
+ V(!1);
447
+ }, [h]);
448
+ I(() => {
449
+ We();
450
+ }, [We, u == null ? void 0 : u.ts]);
451
+ const Q = L(() => {
452
+ const e = /* @__PURE__ */ new Map();
453
+ for (const c of re)
454
+ e.set(`sp:${String(c.id)}`, {
455
+ key: `sp:${String(c.id)}`,
456
+ title: c.title,
457
+ sessions: []
458
+ });
459
+ const t = [], a = [...C].sort(
460
+ (c, r) => (r.updateTime || r.createTime || "").localeCompare(
461
+ c.updateTime || c.createTime || ""
462
+ )
463
+ );
464
+ for (const c of a)
465
+ if (c.projectSpaceId != null) {
466
+ const r = `sp:${String(c.projectSpaceId)}`;
467
+ e.has(r) || e.set(r, {
468
+ key: r,
469
+ title: c.projectSpaceTitle || `空间 ${c.projectSpaceId}`,
470
+ sessions: []
471
+ }), e.get(r).sessions.push(c);
472
+ } else
473
+ t.push(c);
474
+ const l = (c) => {
475
+ var r, qe;
476
+ return ((r = c.sessions[0]) == null ? void 0 : r.updateTime) || ((qe = c.sessions[0]) == null ? void 0 : qe.createTime) || "";
477
+ }, o = [...e.values()];
478
+ return o.sort((c, r) => c.sessions.length > 0 && r.sessions.length > 0 ? l(r).localeCompare(l(c)) : c.sessions.length > 0 ? -1 : r.sessions.length > 0 ? 1 : c.title.localeCompare(r.title)), t.length > 0 && o.push({ key: "sp:none", title: "未归组", sessions: t }), o;
479
+ }, [re, C]), _e = L(
480
+ () => {
481
+ var e;
482
+ return u != null && u.sessionId ? ((e = Q.find(
483
+ (t) => t.sessions.some((a) => a.id === u.sessionId)
484
+ )) == null ? void 0 : e.key) ?? null : null;
485
+ },
486
+ [Q, u == null ? void 0 : u.sessionId]
487
+ );
488
+ I(() => {
489
+ var t;
490
+ const e = _e ?? (He.current ? null : ((t = Q.find((a) => a.sessions.length > 0)) == null ? void 0 : t.key) ?? null);
491
+ e && (He.current = !0, te(
492
+ (a) => a.has(e) ? a : new Set(a).add(e)
493
+ ));
494
+ }, [_e, Q]);
495
+ const Ze = Ne(!1);
496
+ I(() => {
497
+ ie || !Se || Ze.current || (Ze.current = !0, T("local"));
498
+ }, [Se]);
499
+ const Ge = N && N.type !== "jar" ? N.id : void 0;
500
+ I(() => {
501
+ if (!v || f !== "local" || !F) return;
502
+ let e = !0;
503
+ return qn(Ge).then((t) => {
504
+ e && $e([...t].sort((a, l) => l.updatedAt - a.updatedAt));
505
+ }).catch(() => {
506
+ e && $e([]);
507
+ }), () => {
508
+ e = !1;
509
+ };
510
+ }, [
511
+ f,
512
+ F,
513
+ Ge,
514
+ _,
515
+ xe
516
+ ]);
517
+ const ge = L(() => {
518
+ const e = /* @__PURE__ */ new Map(), t = [];
519
+ for (const l of K) {
520
+ const o = l.workdir ?? null;
521
+ if (!o) {
522
+ t.push(l);
523
+ continue;
524
+ }
525
+ const c = `wd:${o}`;
526
+ if (!e.has(c)) {
527
+ const r = o.split("/").filter(Boolean);
528
+ e.set(c, {
529
+ key: c,
530
+ title: r.length ? r[r.length - 1] : o,
531
+ path: o,
532
+ sessions: []
533
+ });
534
+ }
535
+ e.get(c).sessions.push(l);
536
+ }
537
+ const a = [...e.values()].sort(
538
+ (l, o) => {
539
+ var c, r;
540
+ return (((c = o.sessions[0]) == null ? void 0 : c.updatedAt) ?? 0) - (((r = l.sessions[0]) == null ? void 0 : r.updatedAt) ?? 0);
541
+ }
542
+ );
543
+ return t.length > 0 && a.push({ key: "wd:none", title: "未绑定目录", path: null, sessions: t }), a;
544
+ }, [K]), be = L(() => {
545
+ if (!_) return null;
546
+ const e = K.find((t) => t.id === _);
547
+ return e ? e.workdir ? `wd:${e.workdir}` : "wd:none" : null;
548
+ }, [K, _]);
549
+ I(() => {
550
+ be && te(
551
+ (e) => e.has(be) ? e : new Set(e).add(be)
552
+ );
553
+ }, [be]);
554
+ const Ve = Ne(!1);
555
+ I(() => {
556
+ Ve.current || ge.length === 0 || (Ve.current = !0, te((e) => {
557
+ const t = new Set(e);
558
+ for (const a of ge)
559
+ a.sessions.length > 0 && t.add(a.key);
560
+ return t;
561
+ }));
562
+ }, [ge]);
563
+ const Nn = B(() => Te(null), []), Le = (e) => {
564
+ if (e !== f && (T(e), !(w !== "chat" && w !== "landing"))) {
565
+ if (e === "cloud") {
566
+ m(u ? "chat" : "landing");
567
+ return;
568
+ }
569
+ m(F ? "chat" : "landing");
570
+ }
571
+ }, Ae = (e) => {
572
+ T("local"), Te(e), m("chat");
573
+ }, Ue = (e, t, a) => {
574
+ ve({ lane: e, id: t }), se(a || "");
575
+ }, Qe = () => {
576
+ ve(null), se("");
577
+ }, ze = async () => {
578
+ if (!P || un) return;
579
+ const e = P, t = Ce.trim();
580
+ if (ve(null), se(""), !!t) {
581
+ Re(!0);
582
+ try {
583
+ if (e.lane === "cloud") {
584
+ const a = C.find((l) => z(l.id, e.id));
585
+ if (!a) return;
586
+ await Bn(
587
+ a.personalAgentId,
588
+ a.id,
589
+ t,
590
+ h
591
+ ), G(
592
+ (l) => l.map((o) => z(o.id, e.id) ? { ...o, title: t } : o)
593
+ );
594
+ } else
595
+ await it(e.id, t), U((a) => a + 1);
596
+ ke("已重命名会话", "success");
597
+ } catch (a) {
598
+ ke(a instanceof Error ? a.message : "重命名失败", "error");
599
+ } finally {
600
+ Re(!1);
601
+ }
602
+ }
603
+ }, Je = async (e, t, a) => {
604
+ if (await mt({
605
+ content: `确定删除会话「${a || "未命名会话"}」吗?删除后不可恢复。`
606
+ }))
607
+ try {
608
+ if (e === "cloud") {
609
+ const o = C.find((c) => z(c.id, t));
610
+ if (!o) return;
611
+ await Hn(o.personalAgentId, o.id, h), G((c) => c.filter((r) => !z(r.id, t))), z(u == null ? void 0 : u.sessionId, t) && (D(null), m("landing"));
612
+ } else
613
+ await ct(t), U((o) => o + 1), _ === t && (Te(null), m("landing"));
614
+ ke("已删除会话", "success");
615
+ } catch (o) {
616
+ ke(o instanceof Error ? o.message : "删除失败", "error");
617
+ }
618
+ }, E = (e, t = null, a = null) => {
619
+ T("cloud"), M(e.id), D(
620
+ (l) => l && l.agent.id === e.id && l.sessionId === t && !a ? l : { agent: e, sessionId: t, draft: a, ts: Date.now() }
621
+ ), m("chat");
622
+ };
623
+ I(() => {
624
+ const e = O;
625
+ if (!(e != null && e.agent) || !e.ts) return;
626
+ const t = e.agent;
627
+ if (M(t.id), e.view === "detail") {
628
+ Be(t), m("agentDetail");
629
+ return;
630
+ }
631
+ E(t, e.sessionId ?? null), e.newSession > 0 && U((a) => a + 1);
632
+ }, [O == null ? void 0 : O.ts]);
633
+ const Xe = () => {
634
+ T("cloud"), M((S == null ? void 0 : S.id) ?? null), D(null), m("landing");
635
+ }, Ye = () => {
636
+ T("local"), U((e) => e + 1), m("chat");
637
+ }, wn = () => {
638
+ if (f === "local" && v && N) {
639
+ Ye();
640
+ return;
641
+ }
642
+ if (S) {
643
+ E(S);
644
+ return;
645
+ }
646
+ Xe();
647
+ }, Tn = async (e, t) => {
648
+ if (Z)
649
+ try {
650
+ const a = e.length > 20 ? `${e.slice(0, 20)}…` : e, l = await Wn(
651
+ Z.id,
652
+ a,
653
+ h,
654
+ t
655
+ );
656
+ Ke(null), T("cloud"), D({
657
+ agent: Z,
658
+ sessionId: l.id,
659
+ draft: e,
660
+ ts: Date.now()
661
+ }), m("chat");
662
+ } catch {
663
+ }
664
+ }, vn = (e) => {
665
+ T("local"), Ee(e), m("chat");
666
+ }, ye = B(() => {
667
+ if (v && f === "local" && N) {
668
+ U((e) => e + 1), m("chat");
669
+ return;
670
+ }
671
+ T("cloud"), M((S == null ? void 0 : S.id) ?? null), D(null), m("landing");
672
+ }, [v, f, N, S]), Cn = L(() => {
673
+ const e = [
674
+ {
675
+ key: "new-task",
676
+ label: "新建任务",
677
+ icon: /* @__PURE__ */ n($n, {}),
678
+ hint: "⌘N",
679
+ run: ye
680
+ },
681
+ {
682
+ key: "schedule",
683
+ label: "定时任务",
684
+ icon: /* @__PURE__ */ n(jn, {}),
685
+ run: () => m("schedule")
686
+ },
687
+ {
688
+ key: "extensions",
689
+ label: "更多能力",
690
+ icon: /* @__PURE__ */ n(xn, {}),
691
+ run: () => m("extensions")
692
+ },
693
+ {
694
+ key: "todo",
695
+ label: "工作待办",
696
+ icon: /* @__PURE__ */ n(En, {}),
697
+ run: () => le("todo")
698
+ },
699
+ {
700
+ key: "notes",
701
+ label: "个人笔记",
702
+ icon: /* @__PURE__ */ n(cn, {}),
703
+ run: () => le("notes")
704
+ },
705
+ {
706
+ key: "settings",
707
+ label: "设置",
708
+ icon: /* @__PURE__ */ n(Rn, {}),
709
+ run: () => Ie(!0)
710
+ }
711
+ ];
712
+ return v && e.push({
713
+ key: "switch-lane",
714
+ label: f === "local" ? "切换到云端车道" : "切换到本地车道",
715
+ icon: f === "local" ? /* @__PURE__ */ n(nn, {}) : /* @__PURE__ */ n(tn, {}),
716
+ run: () => Le(f === "local" ? "cloud" : "local")
717
+ }), e;
718
+ }, [ye, le, v, f]);
719
+ I(() => {
720
+ const e = (t) => {
721
+ if (!(t.metaKey || t.ctrlKey) || t.altKey) return;
722
+ const a = t.key.toLowerCase();
723
+ if (a === "k") {
724
+ t.preventDefault(), H((l) => !l);
725
+ return;
726
+ }
727
+ a === "n" && (t.preventDefault(), ye());
728
+ };
729
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
730
+ }, [ye]);
731
+ const Sn = L(() => {
732
+ const e = [];
733
+ if (v)
734
+ for (const t of K)
735
+ e.push({
736
+ key: `l-${t.id}`,
737
+ title: t.title || "未命名会话",
738
+ lane: "local",
739
+ updatedAt: t.updatedAt ?? 0,
740
+ open: () => Ae(t.id)
741
+ });
742
+ for (const t of C) {
743
+ const a = fe.get(t.personalAgentId);
744
+ if (!a) continue;
745
+ const l = new Date(
746
+ (t.updateTime || t.createTime || "").replace(" ", "T")
747
+ ).getTime();
748
+ e.push({
749
+ key: `c-${t.id}`,
750
+ title: t.title || "未命名会话",
751
+ lane: "cloud",
752
+ updatedAt: Number.isNaN(l) ? 0 : l,
753
+ open: () => E(a, t.id)
754
+ });
755
+ }
756
+ return e.sort((t, a) => a.updatedAt - t.updatedAt), e.slice(0, 5);
757
+ }, [v, K, C, fe]), In = A.nickname || (k == null ? void 0 : k.display_name) || (k == null ? void 0 : k.username) || "", On = L(() => g ? [
758
+ {
759
+ mode: "personal",
760
+ label: "个人工作台",
761
+ icon: /* @__PURE__ */ n(rt, {})
762
+ },
763
+ {
764
+ mode: "collaboration",
765
+ label: "协作工作台",
766
+ icon: /* @__PURE__ */ n(dt, {})
767
+ }
768
+ ].filter(
769
+ (t) => et(k, t.mode)
770
+ ) : [], [k, g]), Ln = u ? `${u.agent.id}-${u.sessionId ?? 0}-${u.ts}` : "none";
771
+ let R;
772
+ return w === "agentDetail" && Fe ? R = /* @__PURE__ */ n("div", { className: s.detailHost, children: /* @__PURE__ */ n(
773
+ Nt,
774
+ {
775
+ agent: Fe,
776
+ onBack: () => m("extensions")
777
+ }
778
+ ) }) : w === "schedule" ? R = /* @__PURE__ */ n(
779
+ bt,
780
+ {
781
+ localOnline: F,
782
+ agents: y,
783
+ token: h,
784
+ localAgents: x,
785
+ defaultLane: f,
786
+ defaultAgentId: (Z == null ? void 0 : Z.id) ?? null
787
+ }
788
+ ) : w === "extensions" ? R = /* @__PURE__ */ n(
789
+ wt,
790
+ {
791
+ agents: y,
792
+ loading: q,
793
+ skillsAgent: S,
794
+ token: h,
795
+ lane: f,
796
+ onChat: (e) => E(e),
797
+ onConfig: (e) => {
798
+ Be(e), m("agentDetail");
799
+ },
800
+ onCreated: (e) => Y((t) => [...t, e]),
801
+ capTabRequest: ue
802
+ }
803
+ ) : w === "history" ? R = /* @__PURE__ */ n(
804
+ Tt,
805
+ {
806
+ agents: y,
807
+ token: h,
808
+ onOpenSession: (e, t) => E(e, t),
809
+ onBack: () => m("extensions")
810
+ }
811
+ ) : w === "personalTab" ? R = /* @__PURE__ */ p("div", { className: s.personalTabHost, children: [
812
+ $ === "projects" && /* @__PURE__ */ n(
813
+ ln,
814
+ {
815
+ activeTab: "projects",
816
+ onActiveTabChange: () => {
817
+ },
818
+ onOpenProject: oe,
819
+ hideTabs: !0
820
+ }
821
+ ),
822
+ $ === "personal" && /* @__PURE__ */ n(
823
+ ln,
824
+ {
825
+ activeTab: "personal",
826
+ onActiveTabChange: () => {
827
+ },
828
+ onOpenProject: oe,
829
+ hideTabs: !0
830
+ }
831
+ ),
832
+ $ === "business-stats" && /* @__PURE__ */ n(An, { source: "scenario" }),
833
+ $ === "tools" && /* @__PURE__ */ n(on, { showTools: !0, showWebsites: !1 }),
834
+ $ === "websites" && /* @__PURE__ */ n(on, { showTools: !1, showWebsites: !0 }),
835
+ $ === "todo" && /* @__PURE__ */ n(
836
+ St,
837
+ {
838
+ onOpenProject: oe,
839
+ onOpenNote: (e) => {
840
+ Oe("notes"), gn({ id: e, ts: Date.now() });
841
+ },
842
+ onOpenAgentSession: (e, t) => {
843
+ const a = y.find((l) => z(l.id, t));
844
+ a && E(a, e);
845
+ },
846
+ openTodoId: bn
847
+ }
848
+ ),
849
+ $ === "notes" && /* @__PURE__ */ n(
850
+ Dn,
851
+ {
852
+ onOpenProject: oe,
853
+ onOpenTodo: kn,
854
+ openNoteId: fn
855
+ }
856
+ ),
857
+ $ === "training" && /* @__PURE__ */ n(vt, {}),
858
+ $ === "webide" && /* @__PURE__ */ n(Ct, {})
859
+ ] }) : f === "cloud" && u ? R = /* @__PURE__ */ n("div", { className: s.chatHost, children: /* @__PURE__ */ n(
860
+ yt,
861
+ {
862
+ agent: u.agent,
863
+ initialSessionId: u.sessionId,
864
+ autoSendDraft: u.draft,
865
+ chromeless: !0,
866
+ agents: y,
867
+ onSwitchAgent: (e) => E(e)
868
+ },
869
+ Ln
870
+ ) }) : f === "local" && v && N && w !== "landing" ? R = /* @__PURE__ */ n("div", { className: s.chatHost, children: /* @__PURE__ */ n(
871
+ kt,
872
+ {
873
+ agent: Pt(N),
874
+ newSessionTrigger: xe,
875
+ autoSendDraft: dn,
876
+ onAutoSendConsumed: () => Ee(null),
877
+ openSessionId: _,
878
+ onOpenSessionConsumed: Nn,
879
+ onSessionsMutated: () => U((e) => e + 1)
880
+ },
881
+ N.id
882
+ ) }) : R = /* @__PURE__ */ n(
883
+ Dt,
884
+ {
885
+ agents: y,
886
+ activeAgent: Z,
887
+ onSwitchAgent: (e) => M(e.id),
888
+ localAgentName: f === "local" ? (N == null ? void 0 : N.name) ?? "本机 Agent" : null,
889
+ onLocalSend: f === "local" ? vn : void 0,
890
+ localOffline: f === "local" && !F,
891
+ initialSpace: me,
892
+ onSend: Tn,
893
+ onOpenTab: le,
894
+ onQuickAsk: wn,
895
+ recentTasks: Sn,
896
+ onOpenHistory: () => m("history")
897
+ }
898
+ ), /* @__PURE__ */ p("div", { className: s.shell, children: [
899
+ /* @__PURE__ */ p("aside", { className: s.sidebar, "aria-label": "个人专享工作台导航", children: [
900
+ /* @__PURE__ */ p("div", { className: s.sideContent, children: [
901
+ v && /* @__PURE__ */ p("div", { className: s.laneTabs, role: "tablist", "aria-label": "任务车道", children: [
902
+ /* @__PURE__ */ p(
903
+ "button",
904
+ {
905
+ type: "button",
906
+ role: "tab",
907
+ "aria-selected": f === "local",
908
+ className: `${s.laneTab} ${f === "local" ? s.laneTabActive : ""}`,
909
+ onClick: () => Le("local"),
910
+ title: F ? "本机 Agent 已连接:任务在你的电脑上执行" : "本机 Agent 未运行:启动 Z-OPC 桌面端伴生服务后可用",
911
+ children: [
912
+ /* @__PURE__ */ n(tn, { className: s.laneIcon }),
913
+ /* @__PURE__ */ n("span", { className: s.laneText, children: "本地" })
914
+ ]
915
+ }
916
+ ),
917
+ /* @__PURE__ */ p(
918
+ "button",
919
+ {
920
+ type: "button",
921
+ role: "tab",
922
+ "aria-selected": f === "cloud",
923
+ className: `${s.laneTab} ${f === "cloud" ? s.laneTabActive : ""}`,
924
+ onClick: () => Le("cloud"),
925
+ title: "云端任务:跨设备同步,手机/网页都能继续",
926
+ children: [
927
+ /* @__PURE__ */ n(nn, { className: s.laneIcon }),
928
+ /* @__PURE__ */ n("span", { className: s.laneText, children: "云端" })
929
+ ]
930
+ }
931
+ )
932
+ ] }),
933
+ /* @__PURE__ */ n(
934
+ nt,
935
+ {
936
+ currentUser: k,
937
+ token: h,
938
+ isDesktop: ie,
939
+ activeNav: w === "schedule" ? "schedule" : null,
940
+ extensionsGroupActive: [
941
+ "extensions",
942
+ "agentDetail",
943
+ // 聊天记录已收进「更多能力」浮层(2026-10-30):进入后组行应点亮,
944
+ // 否则整页没有当前位置指示
945
+ "history",
946
+ "personalTab"
947
+ ].includes(w),
948
+ activePersonalTab: w === "personalTab" ? $ : null,
949
+ onDesktopNewTask: f === "local" && N ? Ye : void 0,
950
+ onPickSpace: (e) => {
951
+ Ke(e), Xe();
952
+ },
953
+ currentSpaceId: (me == null ? void 0 : me.id) ?? null,
954
+ onOpenSchedule: () => m("schedule"),
955
+ onOpenExtensions: i,
956
+ onOpenHistory: () => m("history"),
957
+ onOpenSearch: () => {
958
+ H(!0), X.getState().loadProjects();
959
+ },
960
+ searchActive: de,
961
+ onOpenPersonalTab: le
962
+ }
963
+ ),
964
+ /* @__PURE__ */ n("div", { className: s.sideTasks, children: f === "cloud" ? /* @__PURE__ */ p(J, { children: [
965
+ /* @__PURE__ */ n("div", { className: s.tasksLabel, children: "项目" }),
966
+ Q.length === 0 && !j && /* @__PURE__ */ n("div", { className: s.tasksEmpty, children: "还没有项目空间或云端任务" }),
967
+ Q.map((e) => {
968
+ const t = je.has(e.key);
969
+ return /* @__PURE__ */ p("div", { children: [
970
+ /* @__PURE__ */ p(
971
+ "button",
972
+ {
973
+ type: "button",
974
+ className: s.projFolder,
975
+ "aria-expanded": t,
976
+ onClick: () => te((a) => {
977
+ const l = new Set(a);
978
+ return l.has(e.key) ? l.delete(e.key) : l.add(e.key), l;
979
+ }),
980
+ children: [
981
+ /* @__PURE__ */ n(
982
+ we,
983
+ {
984
+ className: `${s.projCaret} ${t ? s.projCaretOpen : ""}`
985
+ }
986
+ ),
987
+ /* @__PURE__ */ n(Pe, { className: s.projIcon }),
988
+ /* @__PURE__ */ n("span", { className: s.projName, title: e.title, children: e.title }),
989
+ /* @__PURE__ */ n("span", { className: s.projMeta, children: e.sessions.length > 0 ? e.sessions.length : "暂无任务" })
990
+ ]
991
+ }
992
+ ),
993
+ t && e.sessions.length > 0 && /* @__PURE__ */ n("div", { className: s.projRows, children: e.sessions.map((a) => {
994
+ const l = fe.get(a.personalAgentId), o = Fn(a.id), c = (P == null ? void 0 : P.lane) === "cloud" && P.id === o;
995
+ return /* @__PURE__ */ n("div", { className: s.sessionRow, children: c ? /* @__PURE__ */ n(
996
+ "input",
997
+ {
998
+ className: s.rowRenameInput,
999
+ value: Ce,
1000
+ autoFocus: !0,
1001
+ "aria-label": "重命名会话",
1002
+ onChange: (r) => se(r.target.value),
1003
+ onBlur: () => void ze(),
1004
+ onKeyDown: (r) => {
1005
+ r.key === "Enter" ? (r.preventDefault(), r.currentTarget.blur()) : r.key === "Escape" && (r.preventDefault(), Qe());
1006
+ }
1007
+ }
1008
+ ) : /* @__PURE__ */ p(J, { children: [
1009
+ /* @__PURE__ */ n(
1010
+ "button",
1011
+ {
1012
+ type: "button",
1013
+ className: `${s.recentItem} ${(u == null ? void 0 : u.sessionId) === a.id ? s.recentItemActive : ""}`,
1014
+ disabled: !l,
1015
+ title: l ? a.title || "未命名会话" : "伙伴已不存在,无法打开",
1016
+ onClick: () => l && E(l, a.id),
1017
+ children: /* @__PURE__ */ n("span", { className: s.recentItemText, children: a.title || "未命名会话" })
1018
+ }
1019
+ ),
1020
+ /* @__PURE__ */ n(
1021
+ en,
1022
+ {
1023
+ trigger: ["click"],
1024
+ menu: {
1025
+ items: [
1026
+ { key: "rename", label: "重命名" },
1027
+ {
1028
+ key: "delete",
1029
+ label: "删除",
1030
+ danger: !0
1031
+ }
1032
+ ],
1033
+ onClick: ({ key: r }) => {
1034
+ l && (r === "rename" ? Ue(
1035
+ "cloud",
1036
+ o,
1037
+ a.title || ""
1038
+ ) : r === "delete" && Je(
1039
+ "cloud",
1040
+ o,
1041
+ a.title || ""
1042
+ ));
1043
+ }
1044
+ },
1045
+ children: /* @__PURE__ */ n(
1046
+ "button",
1047
+ {
1048
+ type: "button",
1049
+ className: s.rowMore,
1050
+ title: "会话操作",
1051
+ "aria-label": "会话操作",
1052
+ "aria-haspopup": "menu",
1053
+ disabled: !l,
1054
+ children: "⋯"
1055
+ }
1056
+ )
1057
+ }
1058
+ )
1059
+ ] }) }, a.id);
1060
+ }) })
1061
+ ] }, e.key);
1062
+ })
1063
+ ] }) : /* @__PURE__ */ p(J, { children: [
1064
+ /* @__PURE__ */ n("div", { className: s.tasksLabel, children: "目录" }),
1065
+ ge.map((e) => {
1066
+ const t = je.has(e.key);
1067
+ return /* @__PURE__ */ p("div", { children: [
1068
+ /* @__PURE__ */ p(
1069
+ "button",
1070
+ {
1071
+ type: "button",
1072
+ className: s.projFolder,
1073
+ "aria-expanded": t,
1074
+ title: e.path ?? "未绑定目录:任务不带目录上下文",
1075
+ onClick: () => te((a) => {
1076
+ const l = new Set(a);
1077
+ return l.has(e.key) ? l.delete(e.key) : l.add(e.key), l;
1078
+ }),
1079
+ children: [
1080
+ /* @__PURE__ */ n(
1081
+ we,
1082
+ {
1083
+ className: `${s.projCaret} ${t ? s.projCaretOpen : ""}`
1084
+ }
1085
+ ),
1086
+ /* @__PURE__ */ n(Pe, { className: s.projIcon }),
1087
+ /* @__PURE__ */ n("span", { className: s.projName, children: e.title }),
1088
+ /* @__PURE__ */ n("span", { className: s.projMeta, children: e.sessions.length })
1089
+ ]
1090
+ }
1091
+ ),
1092
+ t && /* @__PURE__ */ n("div", { className: s.projRows, children: e.sessions.map((a) => {
1093
+ const l = (P == null ? void 0 : P.lane) === "local" && P.id === a.id;
1094
+ return /* @__PURE__ */ n("div", { className: s.sessionRow, children: l ? /* @__PURE__ */ n(
1095
+ "input",
1096
+ {
1097
+ className: s.rowRenameInput,
1098
+ value: Ce,
1099
+ autoFocus: !0,
1100
+ "aria-label": "重命名会话",
1101
+ onChange: (o) => se(o.target.value),
1102
+ onBlur: () => void ze(),
1103
+ onKeyDown: (o) => {
1104
+ o.key === "Enter" ? (o.preventDefault(), o.currentTarget.blur()) : o.key === "Escape" && (o.preventDefault(), Qe());
1105
+ }
1106
+ }
1107
+ ) : /* @__PURE__ */ p(J, { children: [
1108
+ /* @__PURE__ */ n(
1109
+ "button",
1110
+ {
1111
+ type: "button",
1112
+ className: `${s.recentItem} ${_ === a.id ? s.recentItemActive : ""}`,
1113
+ title: a.title,
1114
+ onClick: () => Ae(a.id),
1115
+ children: /* @__PURE__ */ n("span", { className: s.recentItemText, children: a.title || "未命名会话" })
1116
+ }
1117
+ ),
1118
+ /* @__PURE__ */ n(
1119
+ en,
1120
+ {
1121
+ trigger: ["click"],
1122
+ menu: {
1123
+ items: [
1124
+ { key: "rename", label: "重命名" },
1125
+ {
1126
+ key: "delete",
1127
+ label: "删除",
1128
+ danger: !0
1129
+ }
1130
+ ],
1131
+ onClick: ({ key: o }) => {
1132
+ o === "rename" ? Ue(
1133
+ "local",
1134
+ a.id,
1135
+ a.title || ""
1136
+ ) : o === "delete" && Je(
1137
+ "local",
1138
+ a.id,
1139
+ a.title || ""
1140
+ );
1141
+ }
1142
+ },
1143
+ children: /* @__PURE__ */ n(
1144
+ "button",
1145
+ {
1146
+ type: "button",
1147
+ className: s.rowMore,
1148
+ title: "会话操作",
1149
+ "aria-label": "会话操作",
1150
+ "aria-haspopup": "menu",
1151
+ children: "⋯"
1152
+ }
1153
+ )
1154
+ }
1155
+ )
1156
+ ] }) }, a.id);
1157
+ }) })
1158
+ ] }, e.key);
1159
+ }),
1160
+ K.length === 0 && /* @__PURE__ */ n("div", { className: s.tasksEmpty, children: F ? "暂无本地任务,点上方「新建任务」开始" : "本机 Agent 未运行 —— 启动 Z-OPC 桌面端后自动连上" })
1161
+ ] }) })
1162
+ ] }),
1163
+ /* @__PURE__ */ n(
1164
+ tt,
1165
+ {
1166
+ displayName: In,
1167
+ subtitle: "Z-OPC · 个人(专享)",
1168
+ onOpenSettings: () => Ie(!0),
1169
+ children: On.map((e) => /* @__PURE__ */ p(
1170
+ "button",
1171
+ {
1172
+ type: "button",
1173
+ role: "menuitem",
1174
+ className: s.agentMenuItem,
1175
+ onClick: () => g == null ? void 0 : g(e.mode),
1176
+ children: [
1177
+ /* @__PURE__ */ n("span", { className: s.navIcon, children: e.icon }),
1178
+ /* @__PURE__ */ n("span", { children: e.label })
1179
+ ]
1180
+ },
1181
+ e.mode
1182
+ ))
1183
+ }
1184
+ )
1185
+ ] }),
1186
+ /* @__PURE__ */ n("main", { className: s.main, "aria-label": "个人专享工作台内容", children: q && !u && !N ? /* @__PURE__ */ n("div", { className: s.emptyState, children: /* @__PURE__ */ n("span", { className: s.emptyTitle, children: "正在加载智能伙伴…" }) }) : R }),
1187
+ /* @__PURE__ */ n(
1188
+ st,
1189
+ {
1190
+ open: mn,
1191
+ onClose: () => Ie(!1),
1192
+ token: h
1193
+ }
1194
+ ),
1195
+ de && /* @__PURE__ */ n(
1196
+ at,
1197
+ {
1198
+ sessions: C,
1199
+ localSessions: v ? K : [],
1200
+ agentsById: fe,
1201
+ projects: W,
1202
+ token: h,
1203
+ actions: Cn,
1204
+ onOpenSession: (e, t) => E(e, t),
1205
+ onOpenLocalSession: Ae,
1206
+ onOpenProject: (e) => oe(e.id),
1207
+ onClose: () => H(!1)
1208
+ }
1209
+ )
1210
+ ] });
1211
+ }
1212
+ export {
1213
+ _t as default
1214
+ };