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