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