@yuku123/z-team-component 0.2.7 → 0.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{InvitationManagementPage-BPxjj0Dg.js → InvitationManagementPage-Bu_T6Qnk.js} +2 -2
  2. package/dist/{OnboardingPage-Vvj77L6H.js → OnboardingPage-CVQsHBNI.js} +2 -2
  3. package/dist/ProjectApp-CZp1-5DE.js +5417 -0
  4. package/dist/admin-logs-CjrLXc1w.js +199 -0
  5. package/dist/api-C3oQuHQN.js +2153 -0
  6. package/dist/api-CGeI8Nl6.js +19 -0
  7. package/dist/{createWorkspaceWsHandler-DrV9AaO7.js → createWorkspaceWsHandler--EYvkQTh.js} +3568 -3269
  8. package/dist/{ctc-sso-C-QWy9F8.js → ctc-sso-B62FfkZg.js} +1 -0
  9. package/dist/index-89atN3Sn.js +3299 -0
  10. package/dist/index-B3WkjkoJ.js +13641 -0
  11. package/dist/{index-Bw02b5qJ.js → index-BAbMvA6l.js} +14819 -13930
  12. package/dist/{index-D-oG0ReT.js → index-BbXwe7Mu.js} +4 -4
  13. package/dist/{index-BK9rSfN3.js → index-BnXt3lMS.js} +10 -10
  14. package/dist/{index-DYXWNyaR.js → index-CC82pWGq.js} +18 -18
  15. package/dist/{index-Bh5PFiY9.js → index-CibhFgCi.js} +33 -32
  16. package/dist/{index-BaBdw0pt.js → index-DH7Mt7zI.js} +58 -63
  17. package/dist/{index-bRlb91E0.js → index-DL3Nsor4.js} +12431 -23734
  18. package/dist/{index-l8P_AuvD.js → index-DnqloQgt.js} +1 -1
  19. package/dist/{index-CuuZlPvb.js → index-EPCmZ1QV.js} +5 -5
  20. package/dist/{index-DM_AMiPz.js → index-psNYztRR.js} +37 -36
  21. package/dist/index.js +1 -1
  22. package/dist/instance-DUBRC_44.js +215 -0
  23. package/dist/pages.js +1 -1
  24. package/dist/{send-default-agent-team-message-DxD_vD7Z.js → send-default-agent-team-message-DHaZl06Z.js} +1 -1
  25. package/dist/{sso-user-D1eNVXkY.js → sso-user-BRC1vEjR.js} +1 -1
  26. package/dist/{useAppStore-C12Ala1u.js → useAppStore-D1Z2M3Za.js} +1 -1
  27. package/dist/z-team-component.css +2 -2
  28. package/package.json +6 -2
  29. package/dist/LowCodePage-CtC4Ca6N.js +0 -17
  30. package/dist/ProjectApp-Dp_yHlHK.js +0 -6724
  31. package/dist/api-DLBRWSFh.js +0 -20
  32. package/dist/api-W2_U7Nxd.js +0 -3866
  33. package/dist/ctc-signout-C_dAvsu5.js +0 -9
@@ -0,0 +1,2153 @@
1
+ import { message as F } from "antd";
2
+ function p(e) {
3
+ return e == null || e === "" ? "" : typeof e == "string" ? e : String(e);
4
+ }
5
+ function Xe(e) {
6
+ const n = p(e);
7
+ return n === "" ? null : n;
8
+ }
9
+ function Ye(e, n) {
10
+ return p(e) === p(n);
11
+ }
12
+ function en(e) {
13
+ const n = p(e);
14
+ return n !== "" && n.startsWith("-");
15
+ }
16
+ function ye(e) {
17
+ const n = p(e);
18
+ return n !== "" && $e(n, "0") > 0;
19
+ }
20
+ function $e(e, n) {
21
+ const t = p(e), s = p(n);
22
+ if (t === s)
23
+ return 0;
24
+ if (t === "")
25
+ return 1;
26
+ if (s === "")
27
+ return -1;
28
+ try {
29
+ const o = BigInt(t), d = BigInt(s);
30
+ return o < d ? -1 : 1;
31
+ } catch {
32
+ return t < s ? -1 : 1;
33
+ }
34
+ }
35
+ const he = 101012001;
36
+ function ge() {
37
+ const e = typeof window < "u" && window.ZTEAM_SSO_BASE || "";
38
+ return e ? e.replace(/\/+$/, "") : typeof window > "u" ? "http://localhost" : window.location.origin;
39
+ }
40
+ function Se() {
41
+ const e = new URL(window.location.href);
42
+ e.searchParams.has("_from_login") || e.searchParams.set("_from_login", "1");
43
+ const n = `${ge()}/login?redirect=${encodeURIComponent(
44
+ e.toString()
45
+ )}`;
46
+ window.location.href = n;
47
+ }
48
+ async function we() {
49
+ try {
50
+ const e = await w(`${S}/sso/attach-ctc-token`, {
51
+ ...$,
52
+ method: "POST"
53
+ });
54
+ if (!e.ok)
55
+ return !1;
56
+ const n = await e.json().catch(() => null);
57
+ return !!(n && n.success);
58
+ } catch {
59
+ return !1;
60
+ }
61
+ }
62
+ async function nn(e, n) {
63
+ const t = n != null && n.trim() !== "" ? { result: n } : void 0, s = await w(`${S}/tasks/${e}/complete`, {
64
+ ...$,
65
+ method: "POST",
66
+ headers: { "Content-Type": "application/json" },
67
+ body: t ? JSON.stringify(t) : void 0
68
+ });
69
+ return T(s, "完成任务失败");
70
+ }
71
+ async function tn(e, n) {
72
+ const t = await w(`${S}/tasks/${e}/suspend`, {
73
+ ...$,
74
+ method: "POST",
75
+ headers: { "Content-Type": "application/json" },
76
+ body: void 0
77
+ });
78
+ return T(t, "挂起任务失败");
79
+ }
80
+ async function sn(e, n) {
81
+ const t = await w(`${S}/tasks/${e}/cancel`, {
82
+ ...$,
83
+ method: "POST",
84
+ headers: { "Content-Type": "application/json" },
85
+ body: void 0
86
+ });
87
+ return T(t, "取消任务失败");
88
+ }
89
+ async function on(e) {
90
+ const n = await w(`${S}/tasks/${e}/continue`, {
91
+ ...$,
92
+ method: "POST",
93
+ headers: { "Content-Type": "application/json" }
94
+ });
95
+ return T(n, "继续执行失败");
96
+ }
97
+ async function an(e) {
98
+ const n = await w(`${S}/tasks/${e}/reset`, {
99
+ ...$,
100
+ method: "POST",
101
+ headers: { "Content-Type": "application/json" }
102
+ });
103
+ return T(n, "重置执行失败");
104
+ }
105
+ async function rn(e) {
106
+ const n = await w(`${S}/tasks/${e}`, $);
107
+ return T(n, "加载任务失败");
108
+ }
109
+ const cn = "http://127.0.0.1/kapi/z-webide/inspect";
110
+ let l = null, U = [], E = [], C = 0, x = "", N = null, A = 0, h = null, X = "disconnected";
111
+ function j(e) {
112
+ X = e, E.forEach((n) => n(e));
113
+ }
114
+ function W() {
115
+ return C !== 0 && C !== "";
116
+ }
117
+ function Te(e, n = "") {
118
+ const t = window.location.protocol === "https:" ? "wss:" : "ws:", s = window.location.host, o = n ? `?token=${encodeURIComponent(n)}` : "";
119
+ return `${t}//${s}${Ue}/${e}/ws${o}`;
120
+ }
121
+ function dn(e) {
122
+ return E.push(e), e(X), () => {
123
+ E = E.filter((n) => n !== e);
124
+ };
125
+ }
126
+ function Ie(e, n = "", t) {
127
+ if (l && (l.readyState === WebSocket.CONNECTING || l.readyState === WebSocket.OPEN) && C === e)
128
+ return;
129
+ l && (l.onclose = null, l.close(), l = null), h != null && (clearTimeout(h), h = null);
130
+ const s = Te(e, n);
131
+ C = e, x = n, t && (N = t), j("connecting"), l = new WebSocket(s), l.onopen = () => {
132
+ A = 0, j("connected"), console.log("[WS] connected");
133
+ }, l.onmessage = (o) => {
134
+ try {
135
+ const d = JSON.parse(o.data);
136
+ console.log("[WS recv]", d.type, d), U.forEach((u) => u(d));
137
+ } catch {
138
+ }
139
+ }, l.onerror = () => {
140
+ console.warn("[WS] connection error:", s);
141
+ }, l.onclose = (o) => {
142
+ const d = o.wasClean;
143
+ if (l = null, j("disconnected"), !W()) return;
144
+ A += 1;
145
+ const u = Math.min(3e3 * A, 3e4);
146
+ console.warn(
147
+ `[WS] closed (clean=${d}), reconnect #${A} in ${u}ms`
148
+ ), h = setTimeout(() => {
149
+ h = null, W() && (Ie(C, x), N == null || N());
150
+ }, u);
151
+ };
152
+ }
153
+ function un(e) {
154
+ return U.push(e), () => {
155
+ U = U.filter((n) => n !== e);
156
+ };
157
+ }
158
+ async function ln(e) {
159
+ await we().catch(() => {
160
+ }), l && l.readyState === WebSocket.OPEN && l.send(JSON.stringify(e));
161
+ }
162
+ function Ce() {
163
+ C = 0, h != null && (clearTimeout(h), h = null), l && (l.onclose = null, l.close(), l = null), A = 0, j("disconnected"), U = [], E = [];
164
+ }
165
+ const $ = { credentials: "include" };
166
+ function O(e, n = "error") {
167
+ n === "warning" ? F.warning(e) : F.error(e);
168
+ }
169
+ typeof window < "u" && window.addEventListener(
170
+ "unhandledrejection",
171
+ (e) => {
172
+ const n = e.reason;
173
+ n && typeof n == "object" && n._apiUserError && e.preventDefault();
174
+ }
175
+ );
176
+ let H = !1;
177
+ const G = "登录已失效,请重新登录";
178
+ function _e(e) {
179
+ if (!e) return !1;
180
+ if (Number(e.code) === he) return !0;
181
+ const n = typeof e.message == "string" ? e.message : "";
182
+ return /登录(?:已)?(?:失效|过期)|重新登录|未登录/.test(n);
183
+ }
184
+ function Z() {
185
+ if (!H) {
186
+ H = !0;
187
+ try {
188
+ Ce();
189
+ } catch {
190
+ }
191
+ try {
192
+ localStorage.removeItem("ft_token"), localStorage.removeItem("USER_INFO"), delete window.USER_INFO;
193
+ } catch {
194
+ }
195
+ Se();
196
+ }
197
+ throw {
198
+ _apiUserError: !0,
199
+ userMessage: G,
200
+ message: G
201
+ };
202
+ }
203
+ function V(e, n) {
204
+ return e.status === 401 ? "登录已失效,请重新登录" : e.status === 403 ? "没有权限访问该资源" : e.status === 404 ? "接口不存在,请确认后端已启动且路径为 /z-team" : e.status >= 500 ? "服务暂时不可用,请稍后重试" : (e.status >= 400, n);
205
+ }
206
+ const Y = "/z-team", be = typeof window < "u" && /(zteam[-.]ft\.(zteam\.local|zteam\.local)|team\.zteam\.local)/i.test(
207
+ window.location.hostname
208
+ ), D = be, Ae = `${D ? "/kapi" : ""}${Y}/api`, Ue = `${D ? "/kapi" : ""}${Y}/v1/scenario-instances`, Ee = window.ENV_TYPE || window.envType || "", S = Ae, pn = `${D ? "/kapi" : ""}/z-team-evolution/api`, mn = `${D ? "/kapi" : ""}/z-team-bench/api`, Q = "https://zteam-agent.zteam.local", Oe = "/kapi/zteam-agent/api/dev-brain/agent";
209
+ function ee(e, n) {
210
+ const t = e.startsWith("/") ? e : `/${e}`, s = n ? `?${new URLSearchParams(n).toString()}` : "", o = `${Oe}${t}${s}`;
211
+ if (typeof window > "u")
212
+ return `${Q}${o}`;
213
+ const d = window.location.hostname;
214
+ return /\.zteam\.local$/i.test(d) || /zteam[-.]ft\.zteam\.local$/i.test(d) || d === "localhost" || d === "127.0.0.1" || d === "127.0.0.1" ? `${window.location.origin}${o}` : `${Q}${o}`;
215
+ }
216
+ function fn(e) {
217
+ return ee("/ticket", { ticketId: e });
218
+ }
219
+ ee("/ticket");
220
+ const ne = Ee || "local";
221
+ async function yn(e, n) {
222
+ try {
223
+ const t = {
224
+ "project-env": ne,
225
+ ...n == null ? void 0 : n.headers
226
+ };
227
+ return await fetch(e, {
228
+ ...$,
229
+ ...n,
230
+ credentials: "include",
231
+ mode: "cors",
232
+ headers: t
233
+ });
234
+ } catch {
235
+ const t = "无法连接 ZTeam-Agent 服务,请确认可访问 zteam-agent.zteam.local";
236
+ throw O(t), { _apiUserError: !0, userMessage: t, message: t };
237
+ }
238
+ }
239
+ async function w(e, n) {
240
+ try {
241
+ const t = {
242
+ "project-env": ne,
243
+ ...n == null ? void 0 : n.headers
244
+ };
245
+ return await fetch(e, { ...$, ...n, headers: t });
246
+ } catch {
247
+ const t = "无法连接服务器,请确认 Java 服务已启动(如 127.0.0.1:8080)且前端代理 /z-team 已配置";
248
+ throw O(t), { _apiUserError: !0, userMessage: t, message: t };
249
+ }
250
+ }
251
+ async function T(e, n) {
252
+ e.status === 401 && Z();
253
+ const t = await e.text().catch(() => "");
254
+ let s = {};
255
+ if (t)
256
+ try {
257
+ s = JSON.parse(t);
258
+ } catch {
259
+ if (!e.ok) {
260
+ const o = V(e, n);
261
+ throw O(
262
+ e.status >= 500 ? o : `${o}(HTTP ${e.status},响应非 JSON)`
263
+ ), {
264
+ _apiUserError: !0,
265
+ userMessage: o,
266
+ message: o
267
+ };
268
+ }
269
+ return t;
270
+ }
271
+ if (_e(s) && Z(), typeof s.success == "boolean") {
272
+ if (s.success)
273
+ return s.data !== void 0 ? s.data : !0;
274
+ const o = s.message || // z-team 另有 7 个 admin controller 挂 bench Result({code,msg,data,success})
275
+ s.msg || s.detail || n;
276
+ throw O(o), {
277
+ _apiUserError: !0,
278
+ userMessage: o,
279
+ message: o
280
+ };
281
+ }
282
+ if (!e.ok) {
283
+ const o = s.detail || s.message || V(e, n);
284
+ throw O(o), {
285
+ _apiUserError: !0,
286
+ userMessage: o,
287
+ message: o
288
+ };
289
+ }
290
+ return s;
291
+ }
292
+ const Pe = /_+([a-z0-9])/gi;
293
+ function ke(e) {
294
+ return e.replace(Pe, (n, t) => t.toUpperCase());
295
+ }
296
+ function L(e) {
297
+ if (Array.isArray(e)) return e.map((n) => L(n));
298
+ if (e && typeof e == "object" && !(e instanceof Date)) {
299
+ const n = {};
300
+ for (const [t, s] of Object.entries(e))
301
+ n[ke(t)] = L(s);
302
+ return n;
303
+ }
304
+ return e;
305
+ }
306
+ async function $n(e, n) {
307
+ return L(await T(e, n));
308
+ }
309
+ const a = {
310
+ credentials: "include",
311
+ // 强制标识为 XHR/fetch API 请求,使后端 SsoInterceptor 走 JSON 401 分支
312
+ // 而不是返回 302 跳到 SSO 登录页(避免 fetch follow redirect 后拿到 SPA HTML 导致解析失败)
313
+ headers: { Accept: "application/json" }
314
+ };
315
+ class Re extends Error {
316
+ constructor(n) {
317
+ super(n), this._apiUserError = !0, this.name = "ApiUserError", this.userMessage = n;
318
+ }
319
+ }
320
+ function hn(e) {
321
+ return e instanceof Re ? !0 : !!(e && typeof e == "object" && e._apiUserError);
322
+ }
323
+ function g(e, n = "error") {
324
+ console[n === "warning" ? "warn" : "error"]("[api]", e);
325
+ }
326
+ typeof window < "u" && window.addEventListener(
327
+ "unhandledrejection",
328
+ (e) => {
329
+ const n = e.reason;
330
+ n && typeof n == "object" && n._apiUserError && e.preventDefault();
331
+ }
332
+ );
333
+ function K(e, n) {
334
+ return e.status === 401 ? "登录已失效,请重新登录" : e.status === 403 ? "没有权限访问该资源" : e.status === 404 ? "接口不存在,请确认后端已启动且路径为 /z-team" : e.status >= 500 ? "服务暂时不可用,请稍后重试" : (e.status >= 400, n);
335
+ }
336
+ const Ne = "/z-team", ve = typeof window < "u" && window.ZTEAM_USE_KAPI === !0, te = ve, se = `${te ? "/kapi" : ""}${Ne}/api`, je = window.ENV_TYPE || window.envType || "", i = se, qe = `${te ? "/kapi" : ""}/z-team-evolution/api`, q = typeof window < "u" && window.ZTEAM_AGENTHUB_AI_ORIGIN || "", De = "/kapi/agenthub-ai/api/dev-brain/agent", Je = String(
337
+ typeof window < "u" && window.ZTEAM_AGENTHUB_SAME_ORIGIN_SUFFIXES || ""
338
+ ).split(",").map((e) => e.trim().toLowerCase()).filter(Boolean);
339
+ function oe(e) {
340
+ const n = (e || "").toLowerCase();
341
+ return n === "localhost" || n === "127.0.0.1" ? !0 : Je.some(
342
+ (t) => n === t || n.endsWith(`.${t}`)
343
+ );
344
+ }
345
+ function ae(e, n) {
346
+ const t = e.startsWith("/") ? e : `/${e}`, o = `${De}${t}`;
347
+ if (typeof window > "u")
348
+ return `${q}${o}`;
349
+ const d = window.location.hostname;
350
+ return oe(d) ? `${window.location.origin}${o}` : `${q}${o}`;
351
+ }
352
+ function ze(e) {
353
+ const t = `/kapi/agenthub-ai${e.startsWith("/") ? e : `/${e}`}`;
354
+ if (typeof window > "u")
355
+ return `${q}${t}`;
356
+ const s = window.location.hostname;
357
+ return oe(s) ? `${window.location.origin}${t}` : `${q}${t}`;
358
+ }
359
+ async function Le(e) {
360
+ const n = new FormData();
361
+ n.append("file", e);
362
+ const t = await ie(ze("/common/uploadImage"), {
363
+ method: "POST",
364
+ body: n
365
+ });
366
+ return r(t, "上传图片失败");
367
+ }
368
+ async function gn(e) {
369
+ return Promise.all(e.map((n) => Le(n)));
370
+ }
371
+ ae("/ticket");
372
+ const re = je || "local";
373
+ async function ie(e, n) {
374
+ try {
375
+ const t = {
376
+ ...a.headers,
377
+ "project-env": re,
378
+ ...n == null ? void 0 : n.headers
379
+ };
380
+ return await fetch(e, {
381
+ ...a,
382
+ ...n,
383
+ credentials: "include",
384
+ mode: "cors",
385
+ headers: t
386
+ });
387
+ } catch {
388
+ const t = "无法连接 AgentHub-AI 服务,请确认服务地址配置正确";
389
+ throw g(t), { _apiUserError: !0, userMessage: t, message: t };
390
+ }
391
+ }
392
+ async function c(e, n) {
393
+ try {
394
+ const t = {
395
+ ...a.headers,
396
+ "project-env": re,
397
+ ...n == null ? void 0 : n.headers
398
+ };
399
+ return await fetch(e, { ...a, ...n, headers: t });
400
+ } catch {
401
+ const t = "无法连接服务器,请确认 Java 服务已启动(如 127.0.0.1:8080)且前端代理 /z-team 已配置";
402
+ throw g(t), { _apiUserError: !0, userMessage: t, message: t };
403
+ }
404
+ }
405
+ function ce(e) {
406
+ const n = e.id ?? e.staff_id ?? e.staffId ?? e.user_id ?? e.userId;
407
+ return {
408
+ // FE-PRECISION-FIX: 雪花 ID 保持字符串,禁止走 Number()
409
+ id: p(n),
410
+ username: String(e.username ?? ""),
411
+ display_name: String(e.display_name ?? e.displayName ?? ""),
412
+ avatar: String(e.avatar ?? "👤"),
413
+ created_at: String(e.created_at ?? e.createdAt ?? ""),
414
+ is_global_admin: !!(e.is_global_admin ?? e.globalAdmin ?? e.global_admin ?? !1)
415
+ };
416
+ }
417
+ async function r(e, n) {
418
+ const t = await e.text().catch(() => "");
419
+ let s = {};
420
+ if (t)
421
+ try {
422
+ s = JSON.parse(t);
423
+ } catch {
424
+ if (!e.ok) {
425
+ const u = K(e, n);
426
+ throw g(
427
+ e.status >= 500 ? u : `${u}(HTTP ${e.status},响应非 JSON)`
428
+ ), {
429
+ _apiUserError: !0,
430
+ userMessage: u,
431
+ message: u
432
+ };
433
+ }
434
+ return t;
435
+ }
436
+ const o = s.status_code ?? s.statusCode, d = s.success === !0 || typeof o == "number" && o >= 200 && o < 300;
437
+ if (typeof s.success == "boolean" || typeof o == "number") {
438
+ if (d)
439
+ return s.data !== void 0 ? s.data : !0;
440
+ const u = s.message || s.msg || s.detail || n;
441
+ throw g(u), {
442
+ _apiUserError: !0,
443
+ userMessage: u,
444
+ message: u
445
+ };
446
+ }
447
+ if (!e.ok) {
448
+ const u = s.detail || s.message || K(e, n);
449
+ throw g(u), {
450
+ _apiUserError: !0,
451
+ userMessage: u,
452
+ message: u
453
+ };
454
+ }
455
+ return s;
456
+ }
457
+ async function Sn(e, n) {
458
+ const t = await fetch("/kapi/z-ctc/api/ctc/authn/login", {
459
+ ...a,
460
+ method: "POST",
461
+ headers: { "Content-Type": "application/json" },
462
+ credentials: "include",
463
+ body: JSON.stringify({ identifier: e, password: n })
464
+ }), s = await r(t, "登录失败"), o = (s == null ? void 0 : s.userInfo) ?? (s == null ? void 0 : s.user_info) ?? (s == null ? void 0 : s.user) ?? s, d = ce(o);
465
+ return { token: (s == null ? void 0 : s.token) ?? "", user: d };
466
+ }
467
+ async function wn(e) {
468
+ const n = await fetch("/kapi/z-ctc/api/ctc/authn/whoami", {
469
+ ...a,
470
+ credentials: "include"
471
+ }), t = await r(
472
+ n,
473
+ "获取用户信息失败"
474
+ );
475
+ return ce(t);
476
+ }
477
+ async function Tn(e) {
478
+ await r(
479
+ await fetch("/kapi/z-ctc/api/ctc/authn/logout", {
480
+ ...a,
481
+ method: "POST",
482
+ credentials: "include"
483
+ }),
484
+ "退出失败"
485
+ );
486
+ try {
487
+ localStorage.removeItem("token"), localStorage.removeItem("z_team_token"), localStorage.removeItem("userInfo"), localStorage.removeItem("USER_INFO");
488
+ } catch {
489
+ }
490
+ }
491
+ async function In(e, n) {
492
+ try {
493
+ const t = await fetch(
494
+ `/kapi/z-ctc/api/ctc/authz/users/permissions?userId=${e}`,
495
+ {
496
+ headers: {
497
+ Authorization: `Bearer ${n}`
498
+ }
499
+ }
500
+ );
501
+ if (!t.ok) return [];
502
+ const s = await t.json(), o = (s == null ? void 0 : s.data) ?? s;
503
+ return Array.isArray(o) ? o.map((d) => (d == null ? void 0 : d.resource_code) ?? (d == null ? void 0 : d.resourceCode)).filter((d) => typeof d == "string" && d) : [];
504
+ } catch {
505
+ return [];
506
+ }
507
+ }
508
+ async function Cn(e = "", n) {
509
+ const t = new URLSearchParams();
510
+ e && t.set("token", e), n && t.set("create_time_start", n);
511
+ const s = t.toString(), o = await c(
512
+ `${i}/scenario-instances/${s ? `?${s}` : ""}`,
513
+ a
514
+ );
515
+ return r(o, "获取项目列表失败");
516
+ }
517
+ async function _n(e = "") {
518
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/scenarios${n}`, a);
519
+ return r(t, "获取场景列表失败");
520
+ }
521
+ async function Me(e, n = "") {
522
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = {
523
+ ...e,
524
+ extend_params: { ...e.extend_params, skip_init_task: "true" }
525
+ }, o = await c(`${i}/scenario-instances/${t}`, {
526
+ ...a,
527
+ method: "POST",
528
+ headers: { "Content-Type": "application/json" },
529
+ body: JSON.stringify(s)
530
+ }), d = await r(o, "创建项目失败");
531
+ return _(d);
532
+ }
533
+ const bn = Me;
534
+ function _(e) {
535
+ return {
536
+ // FE-PRECISION-FIX: 雪花 ID 是 19 位 bigint, Number() 会丢末位精度
537
+ // (后端 Jackson Long→String 已序列化为字符串, 这里保持字符串避免回退到 Number)
538
+ id: e.id == null ? "" : String(e.id),
539
+ name: String(e.name ?? ""),
540
+ description: String(e.description ?? ""),
541
+ workspace_path: String(e.workspace_path ?? e.workspacePath ?? ""),
542
+ status: String(e.status ?? "ACTIVE"),
543
+ created_at: String(e.created_at ?? e.createdAt ?? ""),
544
+ mode: e.mode != null ? String(e.mode) : void 0,
545
+ // FEATURE-ID-AS-STRING: 雪花 ID 一律 string, 严禁 Number() (JS Number 精度会丢末位)
546
+ scenario_id: e.scenario_id != null ? String(e.scenario_id) : e.scenarioId != null ? String(e.scenarioId) : void 0,
547
+ scenario_code: e.scenario_code != null ? String(e.scenario_code) : e.scenarioCode != null ? String(e.scenarioCode) : void 0,
548
+ scenario_name: e.scenario_name != null ? String(e.scenario_name) : e.scenarioName != null ? String(e.scenarioName) : void 0,
549
+ role: e.role != null ? String(e.role) : void 0,
550
+ llm_code: e.llm_code != null ? String(e.llm_code) : e.llmCode != null ? String(e.llmCode) : void 0,
551
+ close_feedback: v(e, "close_feedback"),
552
+ close_tags: v(e, "close_tags"),
553
+ close_time: v(e, "close_time"),
554
+ close_user: v(e, "close_user"),
555
+ members: Array.isArray(e.members) ? e.members.map((n) => String(n)) : void 0,
556
+ parent_id: Be(e)
557
+ };
558
+ }
559
+ function v(e, n) {
560
+ const t = n.replace(/_([a-z])/g, (u, f) => f.toUpperCase());
561
+ if (e[n] != null) return e[n];
562
+ if (e[t] != null) return e[t];
563
+ const s = e.close_info ?? e.closeInfo;
564
+ if (s) {
565
+ if (s[n] != null) return s[n];
566
+ if (s[t] != null) return s[t];
567
+ }
568
+ const o = e.ext;
569
+ if (!o) return;
570
+ const d = o.params;
571
+ if (d)
572
+ return d[n] ?? void 0;
573
+ }
574
+ function Be(e) {
575
+ const n = e.ext;
576
+ if (!n) return;
577
+ const t = n.params;
578
+ if (!t) return;
579
+ const s = t.parent_id;
580
+ if (s == null) return;
581
+ const o = p(s);
582
+ return o === "" ? void 0 : o;
583
+ }
584
+ async function An(e, n) {
585
+ const t = await c(
586
+ `${i}/scenario-instances/${e}/llm-code`,
587
+ {
588
+ ...a,
589
+ method: "PUT",
590
+ headers: { "Content-Type": "application/json" },
591
+ body: JSON.stringify({ llmCode: n || null })
592
+ }
593
+ ), s = await r(t, "设置模型失败");
594
+ return _(s);
595
+ }
596
+ const Un = "qa_support";
597
+ function En(e) {
598
+ const n = e.futureTeamProjectId ?? e.future_team_project_id ?? "", t = p(String(n).trim());
599
+ return ye(t) ? t : null;
600
+ }
601
+ async function On(e, n, t) {
602
+ const s = ae("/update-z-team"), o = new URLSearchParams({
603
+ ticketId: e,
604
+ futureTeamProjectId: String(n),
605
+ stage: t
606
+ }), d = await ie(s, {
607
+ method: "POST",
608
+ headers: {
609
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
610
+ },
611
+ body: o.toString()
612
+ });
613
+ await r(d, "回写工单关联工程失败");
614
+ }
615
+ async function Pn(e) {
616
+ const n = await c(
617
+ `${i}/scenario-instances/${e}/team/`,
618
+ a
619
+ );
620
+ return r(n, "获取团队成员失败");
621
+ }
622
+ async function kn(e, n) {
623
+ const t = await c(`${i}/scenario-instances/${e}/team/`, {
624
+ ...a,
625
+ method: "POST",
626
+ headers: { "Content-Type": "application/json" },
627
+ body: JSON.stringify(n)
628
+ });
629
+ return r(t, "添加成员失败");
630
+ }
631
+ async function Rn(e, n) {
632
+ const t = await c(
633
+ `${i}/scenario-instances/${e}/team/${n}`,
634
+ {
635
+ ...a,
636
+ method: "DELETE"
637
+ }
638
+ );
639
+ return r(t, "移除成员失败");
640
+ }
641
+ async function Nn(e) {
642
+ const n = await c(
643
+ `${i}/scenario-instances/${e}/team/available-agents`,
644
+ a
645
+ );
646
+ return r(n, "获取Agent列表失败");
647
+ }
648
+ async function vn(e) {
649
+ const n = await c(
650
+ `${i}/scenario-instances/${e}/team/available-humans`,
651
+ a
652
+ );
653
+ return r(n, "获取用户列表失败");
654
+ }
655
+ async function jn(e) {
656
+ const n = await c(
657
+ `${i}/scenario-instances/${e}/skills`,
658
+ a
659
+ );
660
+ return r(n, "获取技能列表失败");
661
+ }
662
+ async function qn(e) {
663
+ const n = await c(
664
+ `${i}/scenario-instances/${e}/all-skills`,
665
+ a
666
+ );
667
+ return r(n, "获取全部技能列表失败");
668
+ }
669
+ async function Dn(e, n) {
670
+ const t = await c(`${i}/scenario-instances/${e}/skills`, {
671
+ ...a,
672
+ method: "POST",
673
+ headers: { "Content-Type": "application/json" },
674
+ body: JSON.stringify({ skill_id: n })
675
+ });
676
+ return r(t, "添加技能失败");
677
+ }
678
+ async function Jn(e, n) {
679
+ const t = await c(
680
+ `${i}/scenario-instances/${e}/skills/${n}`,
681
+ {
682
+ ...a,
683
+ method: "DELETE"
684
+ }
685
+ );
686
+ return r(t, "移除技能失败");
687
+ }
688
+ async function zn(e, n) {
689
+ const t = await c(
690
+ `${i}/scenario-instances/${e}/agent-skills/refresh`,
691
+ {
692
+ ...a,
693
+ method: "POST",
694
+ headers: { "Content-Type": "application/json" },
695
+ body: JSON.stringify({ agent_skills_path: n })
696
+ }
697
+ );
698
+ return r(t, "刷新技能失败");
699
+ }
700
+ async function Ln(e) {
701
+ const n = await c(
702
+ `${i}/scenario-instances/${e}/all-agent-skills/refresh`,
703
+ {
704
+ ...a,
705
+ method: "POST"
706
+ }
707
+ );
708
+ return r(n, "刷新所有技能失败");
709
+ }
710
+ async function Mn(e, n = 50, t) {
711
+ let s = `${i}/scenario-instances/${e}/messages?limit=${n}`;
712
+ t && (s += `&before=${t}`);
713
+ const o = await c(s, a);
714
+ return r(o, "加载聊天记录失败,请稍后重试");
715
+ }
716
+ async function Bn(e, n, t = "") {
717
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
718
+ `${i}/scenario-instances/${e}/messages/${n}/read${s}`,
719
+ {
720
+ ...a,
721
+ method: "POST"
722
+ }
723
+ );
724
+ return r(o, "标记已读失败");
725
+ }
726
+ async function Fn(e, n, t = "") {
727
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
728
+ `${i}/scenario-instances/${e}/messages${s}`,
729
+ {
730
+ ...a,
731
+ method: "POST",
732
+ headers: { "Content-Type": "application/json" },
733
+ body: JSON.stringify(n)
734
+ }
735
+ );
736
+ return r(o, "发送消息失败");
737
+ }
738
+ async function xn(e, n) {
739
+ const t = await c(
740
+ `${i}/scenario-instances/${e}/cancel/${n}`,
741
+ { ...a, method: "POST" }
742
+ ), s = await r(t, "取消失败");
743
+ if (s != null && s.warning)
744
+ throw new Error(String(s.warning));
745
+ return s;
746
+ }
747
+ async function Wn(e, n) {
748
+ const t = await c(
749
+ `${i}/scenario-instances/${e}/cancel/${n}/queue`,
750
+ { ...a, method: "POST" }
751
+ );
752
+ return r(t, "停止队列失败");
753
+ }
754
+ async function Hn(e) {
755
+ const n = await c(
756
+ `${i}/scenario-instances/${e}/executions`,
757
+ a
758
+ );
759
+ return r(n, "获取执行列表失败");
760
+ }
761
+ async function Gn(e, n = "") {
762
+ const t = n ? `?subdir=${encodeURIComponent(n)}` : "", s = await c(
763
+ `${i}/scenario-instances/${e}/workspace/tree${t}`,
764
+ a
765
+ );
766
+ return r(s, "获取文件树失败");
767
+ }
768
+ async function Zn() {
769
+ const e = await c(`${i}/workspace/env`, a);
770
+ return r(e, "获取环境信息失败");
771
+ }
772
+ async function Vn(e) {
773
+ const n = await c(
774
+ `${i}/scenario-instances/${e}/workspace/sync-from-prod`,
775
+ {
776
+ ...a,
777
+ method: "POST",
778
+ headers: { "Content-Type": "application/json" }
779
+ }
780
+ );
781
+ return r(n, "同步失败");
782
+ }
783
+ async function Qn(e, n) {
784
+ const t = await c(
785
+ `${i}/scenario-instances/${e}/workspace/file?file_path=${encodeURIComponent(
786
+ n
787
+ )}`,
788
+ a
789
+ );
790
+ return r(t, "获取文件内容失败");
791
+ }
792
+ async function Kn(e, n, t) {
793
+ const s = await c(
794
+ `${i}/scenario-instances/${e}/workspace/file?file_path=${encodeURIComponent(
795
+ n
796
+ )}`,
797
+ {
798
+ ...a,
799
+ method: "POST",
800
+ headers: { "Content-Type": "application/json" },
801
+ body: JSON.stringify({ content: t })
802
+ }
803
+ );
804
+ return r(s, "保存文件失败");
805
+ }
806
+ async function Xn(e, n, t) {
807
+ const s = await c(
808
+ `${i}/scenario-instances/${e}/workspace/rename`,
809
+ {
810
+ ...a,
811
+ method: "PUT",
812
+ headers: { "Content-Type": "application/json" },
813
+ body: JSON.stringify({ old_path: n, new_name: t })
814
+ }
815
+ );
816
+ return r(s, "重命名失败");
817
+ }
818
+ async function Yn(e, n, t) {
819
+ const s = await c(
820
+ `${i}/scenario-instances/${e}/workspace/new-file`,
821
+ {
822
+ ...a,
823
+ method: "POST",
824
+ headers: { "Content-Type": "application/json" },
825
+ body: JSON.stringify({ parent_path: n, name: t })
826
+ }
827
+ );
828
+ return r(s, "新建文件失败");
829
+ }
830
+ async function et(e, n, t) {
831
+ const s = await c(
832
+ `${i}/scenario-instances/${e}/workspace/new-folder`,
833
+ {
834
+ ...a,
835
+ method: "POST",
836
+ headers: { "Content-Type": "application/json" },
837
+ body: JSON.stringify({ parent_path: n, name: t })
838
+ }
839
+ );
840
+ return r(s, "新建文件夹失败");
841
+ }
842
+ async function nt(e, n) {
843
+ const t = await c(
844
+ `${i}/scenario-instances/${e}/workspace/delete`,
845
+ {
846
+ ...a,
847
+ method: "POST",
848
+ headers: { "Content-Type": "application/json" },
849
+ body: JSON.stringify({ path: n })
850
+ }
851
+ );
852
+ return r(t, "删除失败");
853
+ }
854
+ async function tt(e, n, t) {
855
+ const s = new FormData();
856
+ s.append("file", t), s.append("parent_path", n);
857
+ const o = await c(
858
+ `${i}/scenario-instances/${e}/workspace/upload-file`,
859
+ {
860
+ ...a,
861
+ method: "POST",
862
+ body: s
863
+ }
864
+ );
865
+ return r(o, "上传文件失败");
866
+ }
867
+ async function st(e, n, t) {
868
+ const s = new FormData();
869
+ t.forEach((d) => s.append("files", d)), s.append("parent_path", n);
870
+ const o = await c(
871
+ `${i}/scenario-instances/${e}/workspace/upload-folder`,
872
+ {
873
+ ...a,
874
+ method: "POST",
875
+ body: s
876
+ }
877
+ );
878
+ return r(o, "上传文件夹失败");
879
+ }
880
+ async function ot(e, n) {
881
+ const t = await c(
882
+ `${i}/scenario-instances/${e}/workspace/download?file_path=${encodeURIComponent(
883
+ n
884
+ )}`,
885
+ a
886
+ );
887
+ if (!t.ok) throw new Error("下载失败");
888
+ return t.blob();
889
+ }
890
+ async function Fe(e, n = "") {
891
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
892
+ `${i}/scenario-instances/${e}${t}`,
893
+ a
894
+ ), o = await r(s, "获取项目失败"), d = o.status === "FOUND" ? "FOUND" : "NOT_FOUND", u = o.scenario_instance ?? o.scenarioInstance ?? null;
895
+ return {
896
+ status: d,
897
+ scenarioInstance: u ? _(u) : null
898
+ };
899
+ }
900
+ async function xe(e, n = "") {
901
+ const t = await Fe(e, n);
902
+ if (t.status === "NOT_FOUND" || !t.scenarioInstance)
903
+ throw {
904
+ _apiUserError: !0,
905
+ userMessage: "项目不存在",
906
+ message: "项目不存在"
907
+ };
908
+ return t.scenarioInstance;
909
+ }
910
+ async function We(e, n = "") {
911
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
912
+ `${i}/scenario-instances/${e}/join-self${t}`,
913
+ {
914
+ ...a,
915
+ method: "POST"
916
+ }
917
+ ), o = await r(s, "加入工程失败");
918
+ return _(o);
919
+ }
920
+ async function at(e, n = "") {
921
+ return await xe(e, n), We(e, n);
922
+ }
923
+ async function rt(e) {
924
+ const n = await c(`${i}/scenario-instances/${e}`, {
925
+ ...a,
926
+ method: "DELETE"
927
+ });
928
+ return r(n, "删除项目失败");
929
+ }
930
+ async function it(e, n, t = "") {
931
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
932
+ `${i}/scenario-instances/${e}/fork${s}`,
933
+ {
934
+ ...a,
935
+ method: "POST",
936
+ headers: { "Content-Type": "application/json" },
937
+ body: JSON.stringify({ mode: n })
938
+ }
939
+ ), d = await r(o, "Fork 项目失败");
940
+ return _(d);
941
+ }
942
+ async function ct(e, n) {
943
+ const t = await c(`${i}/scenario-instances/${e}`, {
944
+ ...a,
945
+ method: "PATCH",
946
+ headers: { "Content-Type": "application/json" },
947
+ body: JSON.stringify(n)
948
+ }), s = await r(t, "更新项目失败");
949
+ return _(s);
950
+ }
951
+ async function dt(e) {
952
+ const n = await c(
953
+ `${i}/scenario-instances/${e}/retry-image-parse`,
954
+ {
955
+ ...a,
956
+ method: "POST",
957
+ headers: { "Content-Type": "application/json" }
958
+ }
959
+ ), s = await r(n, "图片重新解析失败");
960
+ return {
961
+ success: !!s.success,
962
+ message: s.message
963
+ };
964
+ }
965
+ async function ut(e, n, t = "") {
966
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
967
+ `${i}/scenario-instances/${e}/task-sessions/${n}${s}`,
968
+ {
969
+ ...a,
970
+ method: "POST",
971
+ headers: { "Content-Type": "application/json" }
972
+ }
973
+ );
974
+ return r(o, "创建任务会话失败");
975
+ }
976
+ async function lt(e, n, t = 50, s, o = "") {
977
+ let d = `${i}/scenario-instances/${e}/task-sessions/${n}/messages?limit=${t}`;
978
+ s && (d += `&before=${s}`), o && (d += `&token=${encodeURIComponent(o)}`);
979
+ const u = await c(d, a);
980
+ return r(u, "获取任务消息失败");
981
+ }
982
+ async function pt(e, n, t, s = "", o) {
983
+ const d = s ? `?token=${encodeURIComponent(s)}` : "", u = { content: t };
984
+ o && o.length > 0 && (u.image_urls = o);
985
+ const f = await c(
986
+ `${i}/scenario-instances/${e}/task-sessions/${n}/messages${d}`,
987
+ {
988
+ ...a,
989
+ method: "POST",
990
+ headers: { "Content-Type": "application/json" },
991
+ body: JSON.stringify(u)
992
+ }
993
+ );
994
+ return r(f, "发送任务消息失败");
995
+ }
996
+ async function mt(e = "") {
997
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/admin/scenarios${n}`, a);
998
+ return r(t, "获取场景列表失败");
999
+ }
1000
+ async function ft(e, n, t = "") {
1001
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
1002
+ `${i}/admin/agents/${encodeURIComponent(
1003
+ e
1004
+ )}/identity/test-login${s}`,
1005
+ {
1006
+ ...a,
1007
+ method: "POST",
1008
+ headers: { "Content-Type": "application/json" },
1009
+ body: JSON.stringify(n)
1010
+ }
1011
+ );
1012
+ return r(o, "测试登录失败");
1013
+ }
1014
+ async function yt(e = "") {
1015
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1016
+ `${i}/admin/agents/identity-envs${n}`,
1017
+ a
1018
+ );
1019
+ return r(t, "获取身份绑定环境列表失败");
1020
+ }
1021
+ async function $t(e, n = "") {
1022
+ const t = new URLSearchParams();
1023
+ e && t.set("envCode", e), n && t.set("token", n);
1024
+ const s = t.toString() ? `?${t.toString()}` : "", o = await c(
1025
+ `${i}/admin/agents/ctc-members${s}`,
1026
+ a
1027
+ );
1028
+ return r(o, "获取成员列表失败") ?? [];
1029
+ }
1030
+ async function ht(e, n, t = "") {
1031
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/admin/agents/${e}/move${s}`, {
1032
+ ...a,
1033
+ method: "POST",
1034
+ headers: { "Content-Type": "application/json" },
1035
+ body: JSON.stringify(n)
1036
+ });
1037
+ return r(o, "移动 Agent 分类失败");
1038
+ }
1039
+ async function gt(e = "") {
1040
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/admin/agents/models${n}`, a);
1041
+ return r(t, "获取模型列表失败");
1042
+ }
1043
+ function M(e) {
1044
+ const n = Object.entries(e).filter(([, t]) => t !== void 0 && t !== "").map(([t, s]) => `${t}=${encodeURIComponent(s)}`);
1045
+ return n.length ? `?${n.join("&")}` : "";
1046
+ }
1047
+ async function St(e, n = "") {
1048
+ const t = await c(
1049
+ `${i}/admin/agents/${encodeURIComponent(
1050
+ e
1051
+ )}/ontology${M({ token: n })}`,
1052
+ a
1053
+ );
1054
+ return (await r(
1055
+ t,
1056
+ "获取前置处理配置失败"
1057
+ ) ?? []).map((o) => ({
1058
+ ...o,
1059
+ nodeInfo: { ...o.nodeInfo, dataPrepareEnabled: !1 }
1060
+ }));
1061
+ }
1062
+ async function wt(e, n = "") {
1063
+ const t = await c(
1064
+ `${i}/admin/agents/ontology/ontologies${M({
1065
+ ontologyType: e,
1066
+ token: n
1067
+ })}`,
1068
+ a
1069
+ );
1070
+ return r(t, "获取本体列表失败") ?? [];
1071
+ }
1072
+ async function Tt(e, n = "") {
1073
+ const t = await c(
1074
+ `${i}/admin/agents/ontology/knowledges${M({
1075
+ ontologyCode: e,
1076
+ token: n
1077
+ })}`,
1078
+ a
1079
+ );
1080
+ return r(t, "获取知识列表失败") ?? [];
1081
+ }
1082
+ async function It(e, n, t = "") {
1083
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/admin/skills/${e}/move${s}`, {
1084
+ ...a,
1085
+ method: "POST",
1086
+ headers: { "Content-Type": "application/json" },
1087
+ body: JSON.stringify(n)
1088
+ });
1089
+ return r(o, "移动 Skill 分类失败");
1090
+ }
1091
+ async function Ct(e = "", n = "") {
1092
+ const t = new URLSearchParams();
1093
+ e && t.append("keyword", e), n && t.append("token", n);
1094
+ const s = t.toString() ? `?${t.toString()}` : "", o = await c(
1095
+ `${i}/admin/profiles/ctc-staff${s}`,
1096
+ a
1097
+ );
1098
+ return r(o, "获取员工列表失败");
1099
+ }
1100
+ async function _t(e, n, t = "", s = "") {
1101
+ const o = new URLSearchParams();
1102
+ o.append("profileScope", e), o.append("memberType", n), t && o.append("scenarioCode", t), s && o.append("token", s);
1103
+ const d = o.toString() ? `?${o.toString()}` : "", u = await c(`${i}/admin/profiles${d}`, a);
1104
+ return r(u, "获取画像列表失败");
1105
+ }
1106
+ async function bt(e, n = "") {
1107
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/admin/profiles${t}`, {
1108
+ ...a,
1109
+ method: "POST",
1110
+ headers: { "Content-Type": "application/json" },
1111
+ body: JSON.stringify(e)
1112
+ });
1113
+ return r(s, "保存画像失败");
1114
+ }
1115
+ async function At(e, n, t, s = "", o = "") {
1116
+ const d = new URLSearchParams();
1117
+ s && d.append("scenarioCode", s), o && d.append("token", o);
1118
+ const u = d.toString() ? `?${d.toString()}` : "", f = await c(
1119
+ `${i}/admin/profiles/${encodeURIComponent(
1120
+ e
1121
+ )}/${encodeURIComponent(n)}/${encodeURIComponent(t)}${u}`,
1122
+ {
1123
+ ...a,
1124
+ method: "DELETE"
1125
+ }
1126
+ );
1127
+ return r(f, "删除画像失败");
1128
+ }
1129
+ async function Ut(e = "", n = "") {
1130
+ const t = new URLSearchParams();
1131
+ e && t.append("scenarioCode", e), n && t.append("token", n);
1132
+ const s = t.toString() ? `?${t.toString()}` : "", o = await c(`${i}/admin/human-on-calls${s}`, a);
1133
+ return r(o, "获取值班信息失败");
1134
+ }
1135
+ async function Et(e, n, t, s = "") {
1136
+ const o = s ? `?token=${encodeURIComponent(s)}` : "", d = await c(`${i}/admin/human-on-calls/batch${o}`, {
1137
+ ...a,
1138
+ method: "POST",
1139
+ headers: { "Content-Type": "application/json" },
1140
+ body: JSON.stringify({ scenarioCode: e, dayOfWeek: n, onCalls: t })
1141
+ });
1142
+ return r(d, "保存值班信息失败");
1143
+ }
1144
+ async function Ot(e, n, t, s = "") {
1145
+ const o = s ? `?token=${encodeURIComponent(s)}` : "", d = await c(
1146
+ `${i}/admin/human-on-calls/${encodeURIComponent(
1147
+ e
1148
+ )}/${t}/${encodeURIComponent(n)}${o}`,
1149
+ { ...a, method: "DELETE" }
1150
+ );
1151
+ return r(d, "删除值班信息失败");
1152
+ }
1153
+ async function Pt(e = {}, n = "") {
1154
+ const t = [];
1155
+ e.scenarioCode && t.push(`scenario_code=${encodeURIComponent(e.scenarioCode)}`), e.status && t.push(`status=${encodeURIComponent(e.status)}`), n && t.push(`token=${encodeURIComponent(n)}`);
1156
+ const s = t.length > 0 ? `?${t.join("&")}` : "", o = await c(
1157
+ `${i}/admin/scenario-instances/refresh-all-skills${s}`,
1158
+ {
1159
+ ...a,
1160
+ method: "POST"
1161
+ }
1162
+ );
1163
+ return r(o, "全量刷新技能失败");
1164
+ }
1165
+ async function kt(e, n = "") {
1166
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1167
+ `${i}/admin/scenario-instances/${e}/refresh-skills${t}`,
1168
+ {
1169
+ ...a,
1170
+ method: "POST"
1171
+ }
1172
+ );
1173
+ return r(s, "刷新技能失败");
1174
+ }
1175
+ function b(e) {
1176
+ const n = (...s) => {
1177
+ for (const o of s) {
1178
+ const d = e[o];
1179
+ if (d != null && d !== "") return String(d);
1180
+ }
1181
+ return "";
1182
+ }, t = e.shared;
1183
+ return {
1184
+ id: e.id,
1185
+ userId: n("user_id", "userId"),
1186
+ // FE-PRECISION-FIX: agentHubAgentId 声明为 Id,禁止 Number()(会按 float64 抹掉末位)
1187
+ agentHubAgentId: e.agent_hub_agent_id != null ? p(e.agent_hub_agent_id) : e.agenthub_agent_id != null ? p(e.agenthub_agent_id) : e.agentHubAgentId != null ? p(e.agentHubAgentId) : null,
1188
+ agentCode: n("agent_code", "agentCode"),
1189
+ displayName: n("display_name", "displayName"),
1190
+ avatar: e.avatar == null ? null : String(e.avatar),
1191
+ shared: t == null ? void 0 : Number(t),
1192
+ isLocal: e.isLocal,
1193
+ localAgentId: e.localAgentId,
1194
+ localAgentType: e.localAgentType,
1195
+ createTime: e.create_time == null ? e.createTime : String(e.create_time),
1196
+ updateTime: e.update_time == null ? e.updateTime : String(e.update_time)
1197
+ };
1198
+ }
1199
+ async function Rt(e = "") {
1200
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/personal-agents${n}`, a), s = await r(t, "获取个人 Agent 列表失败");
1201
+ return (Array.isArray(s) ? s : []).map((o) => b(o));
1202
+ }
1203
+ async function Nt(e, n = "") {
1204
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/personal-agents${t}`, {
1205
+ ...a,
1206
+ method: "POST",
1207
+ headers: { "Content-Type": "application/json" },
1208
+ body: JSON.stringify({ display_name: e })
1209
+ });
1210
+ return b(
1211
+ await r(s, "创建个人 Agent 失败")
1212
+ );
1213
+ }
1214
+ async function vt(e, n, t, s, o = "") {
1215
+ const d = o ? `?token=${encodeURIComponent(o)}` : "", u = await c(`${i}/personal-agents/ensure${d}`, {
1216
+ ...a,
1217
+ method: "POST",
1218
+ headers: { "Content-Type": "application/json" },
1219
+ body: JSON.stringify({
1220
+ agenthub_agent_id: e,
1221
+ agent_code: n,
1222
+ display_name: t,
1223
+ avatar: s ?? ""
1224
+ })
1225
+ });
1226
+ return b(
1227
+ await r(u, "创建个人 Agent 失败")
1228
+ );
1229
+ }
1230
+ async function jt(e, n = "") {
1231
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/personal-agents/${e}${t}`, {
1232
+ ...a,
1233
+ method: "DELETE"
1234
+ });
1235
+ return r(s, "删除个人 Agent 失败");
1236
+ }
1237
+ async function qt(e, n, t = "") {
1238
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/personal-agents/${e}${s}`, {
1239
+ ...a,
1240
+ method: "PUT",
1241
+ headers: { "Content-Type": "application/json" },
1242
+ body: JSON.stringify({ display_name: n })
1243
+ });
1244
+ return b(
1245
+ await r(o, "重命名个人 Agent 失败")
1246
+ );
1247
+ }
1248
+ async function Dt(e = "") {
1249
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1250
+ `${i}/personal-agents/shared${n}`,
1251
+ a
1252
+ ), s = await r(
1253
+ t,
1254
+ "获取共享 Agent 列表失败"
1255
+ );
1256
+ return (Array.isArray(s) ? s : []).map(
1257
+ (o) => b(o)
1258
+ );
1259
+ }
1260
+ async function Jt(e, n, t = "") {
1261
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/personal-agents/${e}/share${s}`, {
1262
+ ...a,
1263
+ method: "PUT",
1264
+ headers: { "Content-Type": "application/json" },
1265
+ body: JSON.stringify({ shared: n })
1266
+ });
1267
+ return b(
1268
+ await r(o, "切换共享状态失败")
1269
+ );
1270
+ }
1271
+ async function zt(e, n = "") {
1272
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1273
+ `${i}/personal-agents/${e}/sessions${t}`,
1274
+ a
1275
+ );
1276
+ return r(s, "获取会话列表失败");
1277
+ }
1278
+ async function Lt(e, n = "新会话", t = "", s) {
1279
+ const o = t ? `?token=${encodeURIComponent(t)}` : "", d = await c(
1280
+ `${i}/personal-agents/${e}/sessions${o}`,
1281
+ {
1282
+ ...a,
1283
+ method: "POST",
1284
+ headers: { "Content-Type": "application/json" },
1285
+ body: JSON.stringify({
1286
+ title: n,
1287
+ ...s ? {
1288
+ projectSpaceId: String(s.id),
1289
+ projectSpaceTitle: s.title
1290
+ } : {}
1291
+ })
1292
+ }
1293
+ );
1294
+ return r(d, "创建会话失败");
1295
+ }
1296
+ async function Mt(e = "") {
1297
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1298
+ `${i}/personal-agents/sessions/all${n}`,
1299
+ a
1300
+ );
1301
+ return r(t, "获取聊天记录失败");
1302
+ }
1303
+ async function Bt(e, n, t = "", s) {
1304
+ const o = t ? `?token=${encodeURIComponent(t)}` : "", d = await c(
1305
+ `${i}/personal-agents/${e}/sessions/${n}${o}`,
1306
+ {
1307
+ ...a,
1308
+ method: "PUT",
1309
+ headers: { "Content-Type": "application/json" },
1310
+ body: JSON.stringify(
1311
+ s ? { projectSpaceId: String(s.id), projectSpaceTitle: s.title } : { clearProjectSpace: !0 }
1312
+ )
1313
+ }
1314
+ );
1315
+ return r(d, "会话归组失败");
1316
+ }
1317
+ async function Ft(e) {
1318
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/personal-agents/models${n}`, a);
1319
+ return r(t, "获取模型列表失败");
1320
+ }
1321
+ async function xt(e) {
1322
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1323
+ `${i}/personal-agents/custom-models${n}`,
1324
+ a
1325
+ );
1326
+ return r(t, "获取自定义模型失败");
1327
+ }
1328
+ async function Wt(e, n, t = "") {
1329
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
1330
+ `${i}/personal-agents/${e}/sessions/${n}${s}`,
1331
+ { ...a, method: "DELETE" }
1332
+ );
1333
+ return r(o, "删除会话失败");
1334
+ }
1335
+ async function Ht(e, n, t, s = "") {
1336
+ const o = s ? `?token=${encodeURIComponent(s)}` : "", d = await c(
1337
+ `${i}/personal-agents/${e}/sessions/${n}${o}`,
1338
+ {
1339
+ ...a,
1340
+ method: "PUT",
1341
+ headers: { "Content-Type": "application/json" },
1342
+ body: JSON.stringify({ title: t })
1343
+ }
1344
+ );
1345
+ return r(d, "重命名会话失败");
1346
+ }
1347
+ async function Gt(e, n, t = "") {
1348
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
1349
+ `${i}/personal-agents/${e}/sessions/${n}/messages${s}`,
1350
+ a
1351
+ );
1352
+ return r(o, "获取消息历史失败");
1353
+ }
1354
+ async function Zt(e, n, t, s, o, d, u, f, P) {
1355
+ const de = s ? `?token=${encodeURIComponent(s)}` : "", ue = `${i}/personal-agents/${e}/sessions/${n}/chat/stream${de}`;
1356
+ try {
1357
+ const y = await fetch(ue, {
1358
+ ...a,
1359
+ method: "POST",
1360
+ headers: { "Content-Type": "application/json" },
1361
+ body: JSON.stringify(P ? { message: t, llmCode: P } : { message: t })
1362
+ });
1363
+ if (!y.ok || !y.body) {
1364
+ const z = await y.text().catch(() => "");
1365
+ d(new Error(z || `HTTP ${y.status}`));
1366
+ return;
1367
+ }
1368
+ const le = y.body.getReader(), pe = new TextDecoder();
1369
+ let J = "", k = "";
1370
+ for (; ; ) {
1371
+ const { done: z, value: me } = await le.read();
1372
+ if (z) break;
1373
+ J += pe.decode(me, { stream: !0 });
1374
+ const B = J.split(`
1375
+ `);
1376
+ J = B.pop() || "";
1377
+ for (const fe of B) {
1378
+ const I = fe.trim();
1379
+ if (!I) {
1380
+ k = "";
1381
+ continue;
1382
+ }
1383
+ if (!I.startsWith(":")) {
1384
+ if (I.startsWith("event:")) {
1385
+ k = I.slice(6).trim();
1386
+ continue;
1387
+ }
1388
+ if (I.startsWith("data:")) {
1389
+ const R = I.slice(5).trim();
1390
+ if (k === "replace") {
1391
+ f && f(R), k = "";
1392
+ continue;
1393
+ }
1394
+ if (R.startsWith("[error]")) {
1395
+ d(new Error(R.slice(7).trim()));
1396
+ return;
1397
+ }
1398
+ o(R);
1399
+ }
1400
+ }
1401
+ }
1402
+ }
1403
+ u();
1404
+ } catch (y) {
1405
+ d(y instanceof Error ? y : new Error(String(y)));
1406
+ }
1407
+ }
1408
+ const He = "http://127.0.0.1:28080";
1409
+ async function Vt(e) {
1410
+ await fetch(`${He}/v1/sessions/${e}`, {
1411
+ method: "DELETE"
1412
+ });
1413
+ }
1414
+ async function Qt(e = {}) {
1415
+ const n = new URLSearchParams(), { name: t, scenarioInstanceId: s, page: o = 1, size: d = 50, token: u = "" } = e;
1416
+ t && n.set("name", t), s != null && s !== "" && n.set("scenarioInstanceId", String(s)), n.set("page", String(o)), n.set("size", String(d)), u && n.set("token", u);
1417
+ const f = n.toString(), P = await c(
1418
+ `${i}/admin/tasks${f ? `?${f}` : ""}`,
1419
+ a
1420
+ );
1421
+ return r(P, "获取任务列表失败");
1422
+ }
1423
+ function Ge(e) {
1424
+ const n = new URLSearchParams();
1425
+ Object.entries(e).forEach(([s, o]) => {
1426
+ o != null && o !== "" && n.append(s, String(o));
1427
+ });
1428
+ const t = n.toString();
1429
+ return t ? `?${t}` : "";
1430
+ }
1431
+ async function Kt(e) {
1432
+ const n = await c(
1433
+ `${i}/admin/tool-call-logs/timeline${Ge(e)}`,
1434
+ a
1435
+ );
1436
+ return r(n, "查询工具调用时间轴统计失败");
1437
+ }
1438
+ async function Xt(e) {
1439
+ const n = [];
1440
+ e.date && n.push(`date=${encodeURIComponent(e.date)}`), e.scenarioCode && n.push(`scenarioCode=${encodeURIComponent(e.scenarioCode)}`), e.token && n.push(`token=${encodeURIComponent(e.token)}`);
1441
+ const t = n.length > 0 ? `?${n.join("&")}` : "", s = await c(
1442
+ `${i}/admin/statistics/token-daily${t}`,
1443
+ a
1444
+ );
1445
+ return r(s, "获取 Token 单日统计失败");
1446
+ }
1447
+ async function Yt(e = "z-team") {
1448
+ const n = await c(
1449
+ `${i}/change-log/versions?repo=${encodeURIComponent(e)}`,
1450
+ a
1451
+ );
1452
+ return r(n, "获取变更日志版本列表失败");
1453
+ }
1454
+ async function es(e, n, t = "z-team") {
1455
+ const s = new URLSearchParams();
1456
+ e != null && s.set("versionId", String(e)), s.set("repo", t);
1457
+ const o = await c(
1458
+ `${i}/change-log/detail?${s.toString()}`,
1459
+ a
1460
+ );
1461
+ return r(o, "获取变更日志详情失败");
1462
+ }
1463
+ async function ns(e) {
1464
+ const n = await c(
1465
+ `${qe}/evolution/records/${e}/reset`,
1466
+ { ...a, method: "POST" }
1467
+ );
1468
+ return r(n, "操作失败");
1469
+ }
1470
+ function m(e) {
1471
+ const n = new URLSearchParams();
1472
+ Object.entries(e).forEach(([s, o]) => {
1473
+ o != null && o !== "" && n.append(s, String(o));
1474
+ });
1475
+ const t = n.toString();
1476
+ return t ? `?${t}` : "";
1477
+ }
1478
+ async function ts(e) {
1479
+ const n = await c(
1480
+ `${i}/admin/qa-eval/closed-instances${m({
1481
+ close_date: e.closeDate,
1482
+ close_date_start: e.closeDateStart,
1483
+ close_date_end: e.closeDateEnd,
1484
+ scenario_code: e.scenarioCode,
1485
+ token: e.token
1486
+ })}`,
1487
+ a
1488
+ ), t = await r(
1489
+ n,
1490
+ "获取已关单实例列表失败"
1491
+ );
1492
+ return Array.isArray(t == null ? void 0 : t.list) ? t.list : [];
1493
+ }
1494
+ async function ss(e) {
1495
+ const n = await c(
1496
+ `${i}/admin/qa-eval/overview${m({
1497
+ close_date: e.closeDate,
1498
+ close_date_start: e.closeDateStart,
1499
+ close_date_end: e.closeDateEnd,
1500
+ scenario_code: e.scenarioCode,
1501
+ token: e.token
1502
+ })}`,
1503
+ a
1504
+ );
1505
+ return r(n, "获取 QA 评测总览失败");
1506
+ }
1507
+ async function os(e, n = "") {
1508
+ const t = await c(
1509
+ `${i}/admin/qa-eval/report/${e}/cancel${m({
1510
+ token: n
1511
+ })}`,
1512
+ { ...a, method: "POST" }
1513
+ );
1514
+ return r(t, "取消评测失败");
1515
+ }
1516
+ async function as(e, n, t = "") {
1517
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
1518
+ `${i}/admin/scenario-templates/preview${s}`,
1519
+ {
1520
+ ...a,
1521
+ method: "POST",
1522
+ headers: { "Content-Type": "application/json" },
1523
+ body: JSON.stringify({ html: e, data: n })
1524
+ }
1525
+ );
1526
+ if (!o.ok) throw new Error(`HTTP ${o.status}`);
1527
+ return o.text();
1528
+ }
1529
+ async function rs(e, n = "") {
1530
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1531
+ `${i}/tasks/${e}/human-assist${t}`,
1532
+ { ...a, method: "GET" }
1533
+ );
1534
+ return r(s, "查询人机协助卡片失败");
1535
+ }
1536
+ async function is(e, n, t, s = "") {
1537
+ const o = s ? `?token=${encodeURIComponent(s)}` : "", d = await c(
1538
+ `${i}/scenario-instances/${e}/card-forms/${n}/submit${o}`,
1539
+ {
1540
+ ...a,
1541
+ method: "POST",
1542
+ headers: { "Content-Type": "application/json" },
1543
+ body: JSON.stringify({ value: t })
1544
+ }
1545
+ );
1546
+ return r(d, "提交卡片表单失败");
1547
+ }
1548
+ async function cs(e, n, t = "") {
1549
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
1550
+ `${i}/tasks/${e}/submit-assist${s}`,
1551
+ {
1552
+ ...a,
1553
+ method: "POST",
1554
+ headers: { "Content-Type": "application/json" },
1555
+ body: JSON.stringify({ value: n })
1556
+ }
1557
+ );
1558
+ return r(o, "提交人机协助任务失败");
1559
+ }
1560
+ function ds(e) {
1561
+ return webIdeFetch(`/instances/${e}`, { method: "DELETE" });
1562
+ }
1563
+ async function us(e = "") {
1564
+ const n = await c(
1565
+ `${i}/admin/runtime-monitor/schedule${m({ token: e })}`,
1566
+ a
1567
+ );
1568
+ return r(n, "查询定时任务概览失败");
1569
+ }
1570
+ async function ls(e) {
1571
+ const n = new URLSearchParams();
1572
+ n.set("scenarioCode", e.scenarioCode), e.startDate && n.set("startDate", e.startDate), e.endDate && n.set("endDate", e.endDate), e.creatorId && n.set("creatorId", e.creatorId), e.tagFilters && Object.keys(e.tagFilters).length > 0 && n.set("tagFilters", JSON.stringify(e.tagFilters)), e.groupBy && n.set("groupBy", e.groupBy), e.token && n.set("token", e.token);
1573
+ const t = await c(
1574
+ `${i}/admin/statistics/business?${n.toString()}`,
1575
+ a
1576
+ ), s = await r(t, "业务指标查询失败");
1577
+ return {
1578
+ total: Number((s == null ? void 0 : s.total) ?? 0),
1579
+ trend: Array.isArray(s == null ? void 0 : s.trend) ? s.trend : [],
1580
+ ranking: Array.isArray(s == null ? void 0 : s.ranking) ? s.ranking : [],
1581
+ tagCoverage: (s == null ? void 0 : s.tagCoverage) ?? void 0,
1582
+ creatorDistribution: Array.isArray(s == null ? void 0 : s.creatorDistribution) ? s.creatorDistribution : void 0,
1583
+ dailyAvg: (s == null ? void 0 : s.dailyAvg) ?? void 0,
1584
+ activeCreators: (s == null ? void 0 : s.activeCreators) ?? void 0
1585
+ };
1586
+ }
1587
+ async function ps(e, n = "") {
1588
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1589
+ `${i}/admin/scenario-tags/values/${e}${t}`,
1590
+ {
1591
+ ...a,
1592
+ method: "DELETE"
1593
+ }
1594
+ );
1595
+ return r(s, "删除标签值失败");
1596
+ }
1597
+ async function ms(e, n, t) {
1598
+ const s = await c(
1599
+ `${i}/scenario-instances/${e}/workspace/git-clone`,
1600
+ {
1601
+ ...a,
1602
+ method: "POST",
1603
+ headers: { "Content-Type": "application/json" },
1604
+ body: JSON.stringify({
1605
+ parent_path: n,
1606
+ url: t.url,
1607
+ branch: t.branch ?? "",
1608
+ folder_name: t.folderName ?? ""
1609
+ })
1610
+ }
1611
+ );
1612
+ return r(s, "Git Clone 失败");
1613
+ }
1614
+ async function fs() {
1615
+ const e = await c(
1616
+ `${i}/scenarios/biz-consult-domains`,
1617
+ a
1618
+ );
1619
+ return r(e, "获取业务域选项失败");
1620
+ }
1621
+ async function ys(e, n, t = "") {
1622
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/todo/projects/${e}${s}`, {
1623
+ ...a,
1624
+ method: "PUT",
1625
+ headers: { "Content-Type": "application/json" },
1626
+ body: JSON.stringify(n)
1627
+ });
1628
+ return r(o, "更新项目失败");
1629
+ }
1630
+ async function $s(e, n = "") {
1631
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/todo/items/reorder-batch${t}`, {
1632
+ ...a,
1633
+ method: "POST",
1634
+ headers: { "Content-Type": "application/json" },
1635
+ body: JSON.stringify({ updates: e })
1636
+ });
1637
+ return r(s, "调整排序失败");
1638
+ }
1639
+ async function hs(e, n = "") {
1640
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/todo/projects/reorder-batch${t}`, {
1641
+ ...a,
1642
+ method: "POST",
1643
+ headers: { "Content-Type": "application/json" },
1644
+ body: JSON.stringify({ updates: e })
1645
+ });
1646
+ return r(s, "调整项目排序失败");
1647
+ }
1648
+ async function gs(e = "") {
1649
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1650
+ `${i}/admin/statistics/current-dept${n}`,
1651
+ a
1652
+ );
1653
+ return r(t, "获取当前用户部门信息失败");
1654
+ }
1655
+ function Ze(e) {
1656
+ const n = new URLSearchParams();
1657
+ Object.entries(e).forEach(([s, o]) => {
1658
+ o != null && o !== "" && n.append(s, String(o));
1659
+ });
1660
+ const t = n.toString();
1661
+ return t ? `?${t}` : "";
1662
+ }
1663
+ async function Ss(e) {
1664
+ const n = await c(
1665
+ `${i}/admin/evaluation/instances/${e.id}/snapshot-preview${Ze({
1666
+ section: e.section,
1667
+ page: e.page,
1668
+ size: e.size,
1669
+ task_id: e.taskId,
1670
+ token: e.token
1671
+ })}`,
1672
+ a
1673
+ );
1674
+ return r(n, "获取快照预览失败");
1675
+ }
1676
+ const Ve = typeof window < "u" && window.ZTEAM_WEBIDE_ADMIN_BASE || "http://localhost/kapi/webide/admin";
1677
+ async function Qe(e, n) {
1678
+ try {
1679
+ const t = await fetch(`${Ve}${e}`, {
1680
+ credentials: "include",
1681
+ headers: {
1682
+ Accept: "application/json",
1683
+ "Content-Type": "application/json"
1684
+ },
1685
+ ...n
1686
+ });
1687
+ return t.ok ? t.json() : {};
1688
+ } catch {
1689
+ return {};
1690
+ }
1691
+ }
1692
+ function ws(e) {
1693
+ return Qe(`/presets/${e}`, { method: "DELETE" });
1694
+ }
1695
+ const Ts = se;
1696
+ async function Is(e) {
1697
+ const n = new FormData();
1698
+ n.append("file", e);
1699
+ const t = await c(`${i}/common/upload-video`, {
1700
+ method: "POST",
1701
+ body: n
1702
+ }), s = await r(t, "上传视频失败"), o = typeof (s == null ? void 0 : s.url) == "string" ? s.url : "";
1703
+ if (!o) {
1704
+ const d = "上传视频失败:响应缺少视频地址";
1705
+ throw g(d), { _apiUserError: !0, userMessage: d, message: d };
1706
+ }
1707
+ return o;
1708
+ }
1709
+ function Cs() {
1710
+ const e = "登录已失效,请重新登录";
1711
+ throw g(e), { _apiUserError: !0, userMessage: e, message: e };
1712
+ }
1713
+ async function _s(e) {
1714
+ const n = await c(
1715
+ `${i}/scenario-instances/${e}/interaction-mode`,
1716
+ { ...a }
1717
+ ), t = await r(
1718
+ n,
1719
+ "查询交互模式失败"
1720
+ );
1721
+ return (t == null ? void 0 : t.mode) ?? "dispatch";
1722
+ }
1723
+ async function bs(e, n) {
1724
+ const t = await c(
1725
+ `${i}/scenario-instances/${e}/interaction-mode`,
1726
+ {
1727
+ ...a,
1728
+ method: "PUT",
1729
+ headers: { "Content-Type": "application/json" },
1730
+ body: JSON.stringify({ mode: n })
1731
+ }
1732
+ ), s = await r(
1733
+ t,
1734
+ "切换交互模式失败"
1735
+ );
1736
+ return (s == null ? void 0 : s.mode) ?? n;
1737
+ }
1738
+ async function As(e = "") {
1739
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1740
+ `${i}/admin/indexer/overview${n}`,
1741
+ a
1742
+ );
1743
+ return r(t, "获取索引概览失败");
1744
+ }
1745
+ async function Us(e = "") {
1746
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/admin/indexer/repos${n}`, a), s = await r(
1747
+ t,
1748
+ "获取索引仓库列表失败"
1749
+ );
1750
+ return Array.isArray(s == null ? void 0 : s.repos) ? s.repos : [];
1751
+ }
1752
+ async function Es(e, n = "") {
1753
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/admin/indexer/repos${t}`, {
1754
+ ...a,
1755
+ method: "POST",
1756
+ headers: { "Content-Type": "application/json" },
1757
+ body: JSON.stringify(e)
1758
+ });
1759
+ return r(s, "保存索引仓库失败");
1760
+ }
1761
+ async function Os(e, n = "") {
1762
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1763
+ `${i}/admin/indexer/repos/${encodeURIComponent(e)}${t}`,
1764
+ { ...a, method: "DELETE" }
1765
+ );
1766
+ return r(s, "删除索引仓库失败");
1767
+ }
1768
+ async function Ps(e, n, t = "") {
1769
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(
1770
+ `${i}/admin/indexer/repos/${encodeURIComponent(
1771
+ e
1772
+ )}/enabled${s}`,
1773
+ {
1774
+ ...a,
1775
+ method: "PUT",
1776
+ headers: { "Content-Type": "application/json" },
1777
+ body: JSON.stringify({ enabled: n })
1778
+ }
1779
+ );
1780
+ return r(o, "切换仓库启停失败");
1781
+ }
1782
+ async function ks(e, n = "") {
1783
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1784
+ `${i}/admin/indexer/repos/${encodeURIComponent(
1785
+ e
1786
+ )}/rebuild${t}`,
1787
+ { ...a, method: "POST" }
1788
+ );
1789
+ return r(s, "触发重建失败");
1790
+ }
1791
+ async function Rs(e = "") {
1792
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/admin/indexer/poll${n}`, {
1793
+ ...a,
1794
+ method: "POST"
1795
+ });
1796
+ return r(t, "触发轮询失败");
1797
+ }
1798
+ async function Ns(e = "") {
1799
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(
1800
+ `${i}/admin/notify-channel/list${n}`,
1801
+ a
1802
+ ), s = await r(
1803
+ t,
1804
+ "获取消息渠道状态失败"
1805
+ );
1806
+ return Array.isArray(s == null ? void 0 : s.channels) ? s.channels : [];
1807
+ }
1808
+ async function vs(e, n = "") {
1809
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/admin/notify-channel/test${t}`, {
1810
+ ...a,
1811
+ method: "POST",
1812
+ headers: { "Content-Type": "application/json" },
1813
+ body: JSON.stringify(e)
1814
+ });
1815
+ return r(s, "测试发送失败");
1816
+ }
1817
+ async function js(e, n = "") {
1818
+ const t = await c(
1819
+ `${i}/admin/schedule-task${m({
1820
+ token: n,
1821
+ task_type: e.taskType,
1822
+ page: e.page,
1823
+ size: e.size
1824
+ })}`,
1825
+ a
1826
+ );
1827
+ return r(t, "查询定时任务模版失败");
1828
+ }
1829
+ async function qs(e, n = "") {
1830
+ const t = await c(
1831
+ `${i}/admin/schedule-task${m({ token: n })}`,
1832
+ {
1833
+ ...a,
1834
+ method: "POST",
1835
+ headers: { "Content-Type": "application/json" },
1836
+ body: JSON.stringify(e)
1837
+ }
1838
+ );
1839
+ return r(t, "新建定时任务模版失败");
1840
+ }
1841
+ async function Ds(e, n, t = "") {
1842
+ const s = await c(
1843
+ `${i}/admin/schedule-task/${encodeURIComponent(
1844
+ e
1845
+ )}${m({ token: t })}`,
1846
+ {
1847
+ ...a,
1848
+ method: "PUT",
1849
+ headers: { "Content-Type": "application/json" },
1850
+ body: JSON.stringify(n)
1851
+ }
1852
+ );
1853
+ return r(s, "更新定时任务模版失败");
1854
+ }
1855
+ async function Js(e, n, t = "") {
1856
+ const s = await c(
1857
+ `${i}/admin/schedule-task/${encodeURIComponent(
1858
+ e
1859
+ )}/toggle${m({ token: t })}`,
1860
+ {
1861
+ ...a,
1862
+ method: "POST",
1863
+ headers: { "Content-Type": "application/json" },
1864
+ body: JSON.stringify({ enabled: n })
1865
+ }
1866
+ );
1867
+ return r(s, "切换模版状态失败");
1868
+ }
1869
+ async function zs(e, n = "") {
1870
+ const t = await c(
1871
+ `${i}/admin/schedule-task/${encodeURIComponent(
1872
+ e
1873
+ )}/activate${m({ token: n })}`,
1874
+ { ...a, method: "POST" }
1875
+ );
1876
+ return r(t, "激活模版失败");
1877
+ }
1878
+ async function Ls(e, n = "") {
1879
+ const t = await c(
1880
+ `${i}/admin/schedule-task/${encodeURIComponent(
1881
+ e
1882
+ )}${m({ token: n })}`,
1883
+ { ...a, method: "DELETE" }
1884
+ );
1885
+ return r(t, "删除模版失败");
1886
+ }
1887
+ async function Ms(e, n = "") {
1888
+ const t = await c(
1889
+ `${i}/admin/schedule-task/${encodeURIComponent(
1890
+ e
1891
+ )}/run${m({ token: n })}`,
1892
+ { ...a, method: "POST" }
1893
+ );
1894
+ return r(t, "手动执行失败");
1895
+ }
1896
+ async function Bs(e, n = "") {
1897
+ const t = await c(
1898
+ `${i}/admin/schedule-task/history-all${m({
1899
+ token: n,
1900
+ task_type: e.taskType,
1901
+ page: e.page,
1902
+ size: e.size
1903
+ })}`,
1904
+ a
1905
+ );
1906
+ return r(t, "查询运行记录失败");
1907
+ }
1908
+ async function Fs(e, n, t, s, o = "") {
1909
+ const d = o ? `?token=${encodeURIComponent(o)}` : "", u = await c(
1910
+ `${i}/admin/permissions/users/${e}/roles${d}`,
1911
+ {
1912
+ ...a,
1913
+ method: "PUT",
1914
+ headers: { "Content-Type": "application/json" },
1915
+ body: JSON.stringify({ staffName: n, accountNo: t, roleIds: s })
1916
+ }
1917
+ );
1918
+ return r(u, "更新用户角色失败");
1919
+ }
1920
+ async function xs(e, n = "") {
1921
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1922
+ `${i}/admin/permissions/users/${e}/detail${t}`,
1923
+ a
1924
+ );
1925
+ return r(s, "获取用户授权详情失败");
1926
+ }
1927
+ async function Ws(e = "") {
1928
+ const n = e ? `?token=${encodeURIComponent(e)}` : "", t = await c(`${i}/admin/roles${n}`, a);
1929
+ return r(t, "获取角色列表失败") ?? [];
1930
+ }
1931
+ async function Hs(e, n = "") {
1932
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(
1933
+ `${i}/admin/roles/${e}${t}`,
1934
+ a
1935
+ );
1936
+ return r(s, "获取角色详情失败");
1937
+ }
1938
+ async function Gs(e, n = "") {
1939
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/admin/roles${t}`, {
1940
+ ...a,
1941
+ method: "POST",
1942
+ headers: { "Content-Type": "application/json" },
1943
+ body: JSON.stringify(e)
1944
+ });
1945
+ return r(s, "创建角色失败");
1946
+ }
1947
+ async function Zs(e, n, t = "") {
1948
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/admin/roles/${e}${s}`, {
1949
+ ...a,
1950
+ method: "PUT",
1951
+ headers: { "Content-Type": "application/json" },
1952
+ body: JSON.stringify(n)
1953
+ });
1954
+ return r(o, "更新角色失败");
1955
+ }
1956
+ async function Vs(e, n = "") {
1957
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", s = await c(`${i}/admin/roles/${e}${t}`, {
1958
+ ...a,
1959
+ method: "DELETE"
1960
+ });
1961
+ return r(s, "删除角色失败");
1962
+ }
1963
+ async function Qs(e, n, t = "") {
1964
+ const s = t ? `?token=${encodeURIComponent(t)}` : "", o = await c(`${i}/admin/roles/${e}/users${s}`, {
1965
+ ...a,
1966
+ method: "PUT",
1967
+ headers: { "Content-Type": "application/json" },
1968
+ body: JSON.stringify({ users: n })
1969
+ });
1970
+ return r(o, "更新角色成员失败");
1971
+ }
1972
+ export {
1973
+ Dn as $,
1974
+ Hn as A,
1975
+ S as B,
1976
+ pt as C,
1977
+ lt as D,
1978
+ at as E,
1979
+ ut as F,
1980
+ Vn as G,
1981
+ Gn as H,
1982
+ Zn as I,
1983
+ Wn as J,
1984
+ hn as K,
1985
+ xn as L,
1986
+ ln as M,
1987
+ ot as N,
1988
+ st as O,
1989
+ tt as P,
1990
+ Un as Q,
1991
+ nt as R,
1992
+ et as S,
1993
+ se as T,
1994
+ Yn as U,
1995
+ Xn as V,
1996
+ Kn as W,
1997
+ Qn as X,
1998
+ Ln as Y,
1999
+ zn as Z,
2000
+ Jn as _,
2001
+ yn as a,
2002
+ vt as a$,
2003
+ qn as a0,
2004
+ jn as a1,
2005
+ Bn as a2,
2006
+ Mn as a3,
2007
+ Rn as a4,
2008
+ kn as a5,
2009
+ Nn as a6,
2010
+ vn as a7,
2011
+ Pn as a8,
2012
+ ct as a9,
2013
+ hs as aA,
2014
+ ds as aB,
2015
+ _n as aC,
2016
+ $n as aD,
2017
+ pn as aE,
2018
+ rs as aF,
2019
+ cs as aG,
2020
+ is as aH,
2021
+ rn as aI,
2022
+ on as aJ,
2023
+ an as aK,
2024
+ nn as aL,
2025
+ tn as aM,
2026
+ sn as aN,
2027
+ i as aO,
2028
+ _s as aP,
2029
+ bs as aQ,
2030
+ An as aR,
2031
+ r as aS,
2032
+ Te as aT,
2033
+ Ts as aU,
2034
+ Cs as aV,
2035
+ ns as aW,
2036
+ dt as aX,
2037
+ ms as aY,
2038
+ Is as aZ,
2039
+ qe as a_,
2040
+ it as aa,
2041
+ rt as ab,
2042
+ Cn as ac,
2043
+ _ as ad,
2044
+ Sn as ae,
2045
+ Mt as af,
2046
+ Bt as ag,
2047
+ Nt as ah,
2048
+ Rt as ai,
2049
+ Lt as aj,
2050
+ Vt as ak,
2051
+ Gt as al,
2052
+ gt as am,
2053
+ Ft as an,
2054
+ xt as ao,
2055
+ zt as ap,
2056
+ Ht as aq,
2057
+ Wt as ar,
2058
+ Zt as as,
2059
+ Dt as at,
2060
+ jt as au,
2061
+ qt as av,
2062
+ Jt as aw,
2063
+ Le as ax,
2064
+ ys as ay,
2065
+ $s as az,
2066
+ fn as b,
2067
+ fs as b0,
2068
+ $t as b1,
2069
+ Ct as b2,
2070
+ In as b3,
2071
+ mn as b4,
2072
+ St as b5,
2073
+ wt as b6,
2074
+ Tt as b7,
2075
+ ht as b8,
2076
+ yt as b9,
2077
+ Vs as bA,
2078
+ Qs as bB,
2079
+ xs as bC,
2080
+ Fs as bD,
2081
+ os as bE,
2082
+ ts as bF,
2083
+ ss as bG,
2084
+ kt as bH,
2085
+ Pt as bI,
2086
+ as as bJ,
2087
+ us as bK,
2088
+ Bs as bL,
2089
+ js as bM,
2090
+ Ds as bN,
2091
+ qs as bO,
2092
+ Js as bP,
2093
+ zs as bQ,
2094
+ Ms as bR,
2095
+ Ls as bS,
2096
+ It as bT,
2097
+ ls as bU,
2098
+ gs as bV,
2099
+ Xt as bW,
2100
+ ps as bX,
2101
+ cn as bY,
2102
+ ws as bZ,
2103
+ ft as ba,
2104
+ Z as bb,
2105
+ _e as bc,
2106
+ Qt as bd,
2107
+ Kt as be,
2108
+ mt as bf,
2109
+ Ss as bg,
2110
+ _t as bh,
2111
+ At as bi,
2112
+ bt as bj,
2113
+ Us as bk,
2114
+ As as bl,
2115
+ ks as bm,
2116
+ Ps as bn,
2117
+ Os as bo,
2118
+ Rs as bp,
2119
+ Es as bq,
2120
+ Ns as br,
2121
+ vs as bs,
2122
+ Ut as bt,
2123
+ Et as bu,
2124
+ Ot as bv,
2125
+ Ws as bw,
2126
+ Hs as bx,
2127
+ Gs as by,
2128
+ Zs as bz,
2129
+ Me as c,
2130
+ T as d,
2131
+ w as e,
2132
+ $ as f,
2133
+ bn as g,
2134
+ wn as h,
2135
+ ye as i,
2136
+ L as j,
2137
+ Yt as k,
2138
+ es as l,
2139
+ Ye as m,
2140
+ Ie as n,
2141
+ dn as o,
2142
+ En as p,
2143
+ un as q,
2144
+ Ce as r,
2145
+ Fn as s,
2146
+ p as t,
2147
+ On as u,
2148
+ gn as v,
2149
+ Tn as w,
2150
+ en as x,
2151
+ $e as y,
2152
+ Xe as z
2153
+ };