@yuku123/z-team-component 0.2.80 → 0.2.83

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 (51) hide show
  1. package/dist/ChangeLogView-_bRZ55Yi.js +542 -0
  2. package/dist/ComponentDoc-BFoF51we.js +3998 -0
  3. package/dist/InvitationManagementPage-CTPCZXHu.js +495 -0
  4. package/dist/OnboardingPage-DwtuTL61.js +393 -0
  5. package/dist/ScheduledTasks-yeTm2bOY.js +9407 -0
  6. package/dist/SystemShell-D9OzKxL-.js +689 -0
  7. package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
  8. package/dist/api-CIhVblfa.js +2155 -0
  9. package/dist/api-DXLNhtCX.js +20 -0
  10. package/dist/browser-jb_PFvU3.js +1538 -0
  11. package/dist/createWorkspaceWsHandler-BWP5S5X3.js +12951 -0
  12. package/dist/ctc-sso-DtJHC-2M.js +117 -0
  13. package/dist/echarts-B1OU1xr4.js +16 -0
  14. package/dist/history-BlrA1eaW.js +41 -0
  15. package/dist/index-BCp5EtqR.js +914 -0
  16. package/dist/index-BHrMl3Jq.js +9585 -0
  17. package/dist/index-BP7WTzVH.js +137 -0
  18. package/dist/index-B_LJRFsK.js +339 -0
  19. package/dist/index-BgIheStI.js +133 -0
  20. package/dist/index-BohoJQPr.js +7631 -0
  21. package/dist/index-BydWNuk5.js +1229 -0
  22. package/dist/index-C815hPWS.js +430 -0
  23. package/dist/index-CBQMS6rx.js +178 -0
  24. package/dist/index-CESmMALI.js +242 -0
  25. package/dist/index-CUVdeb8y.js +638 -0
  26. package/dist/index-CijskN6t.js +316 -0
  27. package/dist/index-CoBZZQBy.js +112 -0
  28. package/dist/index-Co_0idJY.js +2936 -0
  29. package/dist/index-Cvx6rrxD.js +956 -0
  30. package/dist/index-Cwr5Slv1.js +480 -0
  31. package/dist/index-CxFAICql.js +42050 -0
  32. package/dist/index-DK70mOTz.js +143 -0
  33. package/dist/index-DT80Pwa_.js +5893 -0
  34. package/dist/index-DWsfQMp8.js +208 -0
  35. package/dist/index-DhDdFRHC.js +279 -0
  36. package/dist/index-Dm3wmB0K.js +435 -0
  37. package/dist/index-DzS6-D3M.js +1640 -0
  38. package/dist/index-PKkV63Sw.js +1143 -0
  39. package/dist/index-SbMjh8t4.js +574 -0
  40. package/dist/index-cdB5K3gx.js +814 -0
  41. package/dist/index-mnWs_wA3.js +93 -0
  42. package/dist/index-nU-V276i.js +170 -0
  43. package/dist/index-nW0ikV2R.js +2700 -0
  44. package/dist/index-uF04Ucsi.js +8 -0
  45. package/dist/index-x_7Rmav9.js +118 -0
  46. package/dist/index.js +10 -0
  47. package/dist/index.module-CAa-2T7m.js +72 -0
  48. package/dist/index.module-UI0iz8K0.js +42 -0
  49. package/dist/{menuPermission-D9NGpBZP.js → menuPermission-DHUqvHfu.js} +1 -1
  50. package/dist/pages.js +1 -1
  51. package/package.json +1 -1
@@ -0,0 +1,435 @@
1
+ import { jsxs as a, jsx as i, Fragment as B } from "react/jsx-runtime";
2
+ import { useState as d, useRef as F, useCallback as D, useEffect as R } from "react";
3
+ import { u as O } from "./useAppStore-BBr_Fwsz.js";
4
+ /* empty css */
5
+ import { T as P, g as U } from "./api-CIhVblfa.js";
6
+ async function y(o, s) {
7
+ const n = await o.text().catch(() => "");
8
+ let t = {};
9
+ if (n)
10
+ try {
11
+ t = JSON.parse(n);
12
+ } catch {
13
+ if (!o.ok) throw new Error(s);
14
+ return n;
15
+ }
16
+ if (typeof t.success == "boolean") {
17
+ if (t.success)
18
+ return U(t.data !== void 0 ? t.data : !0);
19
+ throw new Error(t.message || s);
20
+ }
21
+ if (!o.ok) throw new Error(s);
22
+ return U(t);
23
+ }
24
+ const m = P;
25
+ async function q(o, s) {
26
+ const n = s ? `?token=${encodeURIComponent(s)}` : "", t = { ...o, extend_params: { skip_init_task: "true" } }, r = await fetch(`${m}/scenario-instances${n}`, {
27
+ method: "POST",
28
+ credentials: "include",
29
+ headers: {
30
+ Accept: "application/json",
31
+ "Content-Type": "application/json",
32
+ "project-env": "local"
33
+ },
34
+ body: JSON.stringify(t)
35
+ });
36
+ return y(r, "Failed to create scenario instance");
37
+ }
38
+ async function K(o) {
39
+ const s = o ? `?token=${encodeURIComponent(o)}` : "", n = await fetch(`${m}/scenario-instances${s}`, {
40
+ credentials: "include",
41
+ headers: {
42
+ Accept: "application/json",
43
+ "project-env": "local"
44
+ }
45
+ });
46
+ return y(n, "Failed to list scenario instances");
47
+ }
48
+ async function G(o, s, n) {
49
+ const t = n ? `?token=${encodeURIComponent(n)}` : "", r = await fetch(
50
+ `${m}/scenario-instances/${o}/messages${t}`,
51
+ {
52
+ method: "POST",
53
+ credentials: "include",
54
+ headers: {
55
+ Accept: "application/json",
56
+ "Content-Type": "application/json",
57
+ "project-env": "local"
58
+ },
59
+ body: JSON.stringify(s)
60
+ }
61
+ );
62
+ return y(r, "Failed to send message");
63
+ }
64
+ async function _(o, s = 50, n, t) {
65
+ const r = new URLSearchParams({ limit: String(s) });
66
+ t && r.set("token", t);
67
+ const h = await fetch(
68
+ `${m}/scenario-instances/${o}/messages?${r}`,
69
+ {
70
+ credentials: "include",
71
+ headers: {
72
+ Accept: "application/json",
73
+ "project-env": "local"
74
+ }
75
+ }
76
+ );
77
+ return y(h, "Failed to list messages");
78
+ }
79
+ async function J(o, s) {
80
+ const n = s ? `?token=${encodeURIComponent(s)}` : "", t = await fetch(
81
+ // 后端成员列表在 /team(TeamController),没有 /members
82
+ `${m}/scenario-instances/${o}/team${n}`,
83
+ {
84
+ credentials: "include",
85
+ headers: {
86
+ Accept: "application/json",
87
+ "project-env": "local"
88
+ }
89
+ }
90
+ );
91
+ return y(t, "Failed to list members");
92
+ }
93
+ const L = "dev_brain_scenario";
94
+ function ee() {
95
+ var M;
96
+ const [o, s] = d([]), [n, t] = d(
97
+ null
98
+ ), [r, h] = d([]), [u, z] = d([]), [v, b] = d(""), [W, w] = d(!1), [g, S] = d(!1), [A, T] = d(""), C = F(null), { token: f } = O(), I = D(() => {
99
+ var e;
100
+ (e = C.current) == null || e.scrollIntoView({ behavior: "smooth" });
101
+ }, []);
102
+ R(() => {
103
+ I();
104
+ }, [r, I]), R(() => {
105
+ k();
106
+ }, []);
107
+ const k = async () => {
108
+ try {
109
+ const e = await K(f || void 0);
110
+ s(e || []);
111
+ } catch (e) {
112
+ console.error("Failed to load instances:", e);
113
+ }
114
+ }, N = async () => {
115
+ const e = A.trim();
116
+ if (e) {
117
+ S(!0);
118
+ try {
119
+ const c = await q(
120
+ { scenario_code: L, name: e },
121
+ f || void 0
122
+ );
123
+ T(""), await k(), $(c);
124
+ } catch (c) {
125
+ alert(c instanceof Error ? c.message : "Create failed");
126
+ } finally {
127
+ S(!1);
128
+ }
129
+ }
130
+ }, $ = async (e) => {
131
+ t(e), w(!0);
132
+ try {
133
+ const [c, p] = await Promise.all([
134
+ _(e.id, 50, void 0, f || void 0),
135
+ J(e.id, f || void 0)
136
+ ]);
137
+ h(c || []), z(p || []);
138
+ } catch (c) {
139
+ console.error("Failed to load instance data:", c);
140
+ } finally {
141
+ w(!1);
142
+ }
143
+ }, E = async () => {
144
+ const e = v.trim();
145
+ if (!e || !n) return;
146
+ const c = u.filter((l) => l.memberType === "AGENT");
147
+ let p, j = "TEXT";
148
+ for (const l of c)
149
+ if (e.includes(`@${l.displayName}`)) {
150
+ p = String(l.id), j = "AT_AGENT";
151
+ break;
152
+ }
153
+ b("");
154
+ try {
155
+ await G(
156
+ n.id,
157
+ {
158
+ content: e,
159
+ message_type: j,
160
+ ...p ? { at_agent_ref_id: p } : {}
161
+ },
162
+ f || void 0
163
+ );
164
+ const l = await _(
165
+ n.id,
166
+ 50,
167
+ void 0,
168
+ f || void 0
169
+ );
170
+ h(l || []);
171
+ } catch (l) {
172
+ alert(l instanceof Error ? l.message : "Send failed");
173
+ }
174
+ }, x = u.filter((e) => e.memberType === "AGENT"), H = u.filter((e) => e.memberType === "HUMAN");
175
+ return /* @__PURE__ */ a("div", { style: { display: "flex", height: "100vh", fontFamily: "sans-serif" }, children: [
176
+ /* @__PURE__ */ a(
177
+ "div",
178
+ {
179
+ style: {
180
+ width: 260,
181
+ borderRight: "1px solid #e8e8e8",
182
+ display: "flex",
183
+ flexDirection: "column",
184
+ background: "#fafafa"
185
+ },
186
+ children: [
187
+ /* @__PURE__ */ a("div", { style: { padding: 16, borderBottom: "1px solid #e8e8e8" }, children: [
188
+ /* @__PURE__ */ i("h3", { style: { margin: "0 0 12px" }, children: "Scenario Instances" }),
189
+ /* @__PURE__ */ a("div", { style: { display: "flex", gap: 8 }, children: [
190
+ /* @__PURE__ */ i(
191
+ "input",
192
+ {
193
+ style: {
194
+ flex: 1,
195
+ padding: "6px 8px",
196
+ border: "1px solid #d9d9d9",
197
+ borderRadius: 4
198
+ },
199
+ placeholder: "Instance name",
200
+ value: A,
201
+ onChange: (e) => T(e.target.value),
202
+ onKeyDown: (e) => e.key === "Enter" && N()
203
+ }
204
+ ),
205
+ /* @__PURE__ */ i(
206
+ "button",
207
+ {
208
+ style: {
209
+ padding: "6px 12px",
210
+ background: "#1677ff",
211
+ color: "#fff",
212
+ border: "none",
213
+ borderRadius: 4,
214
+ cursor: g ? "not-allowed" : "pointer"
215
+ },
216
+ disabled: g,
217
+ onClick: N,
218
+ children: g ? "..." : "+"
219
+ }
220
+ )
221
+ ] })
222
+ ] }),
223
+ /* @__PURE__ */ a("div", { style: { flex: 1, overflow: "auto" }, children: [
224
+ o.map((e) => /* @__PURE__ */ a(
225
+ "div",
226
+ {
227
+ onClick: () => $(e),
228
+ style: {
229
+ padding: "10px 16px",
230
+ cursor: "pointer",
231
+ background: (n == null ? void 0 : n.id) === e.id ? "#e6f4ff" : "transparent",
232
+ borderBottom: "1px solid #f0f0f0"
233
+ },
234
+ children: [
235
+ /* @__PURE__ */ i("div", { style: { fontWeight: 500, fontSize: 13 }, children: e.name }),
236
+ /* @__PURE__ */ a("div", { style: { fontSize: 11, color: "#999" }, children: [
237
+ e.scenarioCode,
238
+ " · ",
239
+ e.status
240
+ ] })
241
+ ]
242
+ },
243
+ e.id
244
+ )),
245
+ o.length === 0 ? /* @__PURE__ */ i("div", { style: { padding: 16, color: "#999", fontSize: 12 }, children: "No instances yet. Create one above." }) : null
246
+ ] })
247
+ ]
248
+ }
249
+ ),
250
+ /* @__PURE__ */ i("div", { style: { flex: 1, display: "flex", flexDirection: "column" }, children: n ? /* @__PURE__ */ a(B, { children: [
251
+ /* @__PURE__ */ a(
252
+ "div",
253
+ {
254
+ style: {
255
+ padding: "12px 20px",
256
+ borderBottom: "1px solid #e8e8e8",
257
+ display: "flex",
258
+ justifyContent: "space-between",
259
+ alignItems: "center"
260
+ },
261
+ children: [
262
+ /* @__PURE__ */ a("div", { children: [
263
+ /* @__PURE__ */ i("span", { style: { fontWeight: 600, fontSize: 15 }, children: n.name }),
264
+ /* @__PURE__ */ a("span", { style: { marginLeft: 8, fontSize: 12, color: "#999" }, children: [
265
+ "ID: ",
266
+ n.id
267
+ ] })
268
+ ] }),
269
+ /* @__PURE__ */ a("div", { style: { fontSize: 12, color: "#666" }, children: [
270
+ "Members: ",
271
+ H.length,
272
+ " human · ",
273
+ x.length,
274
+ " ",
275
+ "agent"
276
+ ] })
277
+ ]
278
+ }
279
+ ),
280
+ /* @__PURE__ */ a(
281
+ "div",
282
+ {
283
+ style: {
284
+ flex: 1,
285
+ overflow: "auto",
286
+ padding: "16px 20px",
287
+ background: "#fff"
288
+ },
289
+ children: [
290
+ r.length === 0 ? /* @__PURE__ */ i(
291
+ "div",
292
+ {
293
+ style: { color: "#999", textAlign: "center", marginTop: 80 },
294
+ children: "Send a message to start. Use @agent_name to mention an agent."
295
+ }
296
+ ) : null,
297
+ r.map((e) => /* @__PURE__ */ a(
298
+ "div",
299
+ {
300
+ style: {
301
+ marginBottom: 12,
302
+ display: "flex",
303
+ flexDirection: e.senderType === "HUMAN" ? "row-reverse" : "row",
304
+ gap: 8
305
+ },
306
+ children: [
307
+ /* @__PURE__ */ i(
308
+ "div",
309
+ {
310
+ style: {
311
+ width: 32,
312
+ height: 32,
313
+ borderRadius: "50%",
314
+ background: e.senderType === "HUMAN" ? "#1677ff" : "#52c41a",
315
+ color: "#fff",
316
+ display: "flex",
317
+ alignItems: "center",
318
+ justifyContent: "center",
319
+ fontSize: 14,
320
+ flexShrink: 0
321
+ },
322
+ children: e.senderType === "HUMAN" ? "U" : "A"
323
+ }
324
+ ),
325
+ /* @__PURE__ */ a("div", { style: { maxWidth: "70%" }, children: [
326
+ /* @__PURE__ */ a(
327
+ "div",
328
+ {
329
+ style: {
330
+ fontSize: 11,
331
+ color: "#999",
332
+ marginBottom: 2,
333
+ textAlign: e.senderType === "HUMAN" ? "right" : "left"
334
+ },
335
+ children: [
336
+ e.senderType === "HUMAN" ? "You" : "Agent",
337
+ " ·",
338
+ " ",
339
+ e.messageType
340
+ ]
341
+ }
342
+ ),
343
+ /* @__PURE__ */ i(
344
+ "div",
345
+ {
346
+ style: {
347
+ padding: "8px 12px",
348
+ borderRadius: 8,
349
+ background: e.senderType === "HUMAN" ? "#1677ff" : "#f5f5f5",
350
+ color: e.senderType === "HUMAN" ? "#fff" : "#333",
351
+ fontSize: 13,
352
+ whiteSpace: "pre-wrap",
353
+ wordBreak: "break-word"
354
+ },
355
+ children: e.content
356
+ }
357
+ )
358
+ ] })
359
+ ]
360
+ },
361
+ e.id
362
+ )),
363
+ /* @__PURE__ */ i("div", { ref: C })
364
+ ]
365
+ }
366
+ ),
367
+ /* @__PURE__ */ a(
368
+ "div",
369
+ {
370
+ style: {
371
+ padding: "12px 20px",
372
+ borderTop: "1px solid #e8e8e8",
373
+ display: "flex",
374
+ gap: 8,
375
+ background: "#fafafa"
376
+ },
377
+ children: [
378
+ /* @__PURE__ */ i(
379
+ "textarea",
380
+ {
381
+ style: {
382
+ flex: 1,
383
+ padding: "8px 12px",
384
+ border: "1px solid #d9d9d9",
385
+ borderRadius: 4,
386
+ resize: "none",
387
+ minHeight: 40,
388
+ maxHeight: 120,
389
+ fontSize: 13
390
+ },
391
+ placeholder: x.length > 0 ? `Type message. @${(M = x[0]) == null ? void 0 : M.displayName} to mention agent.` : "Type message...",
392
+ value: v,
393
+ onChange: (e) => b(e.target.value),
394
+ onKeyDown: (e) => {
395
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), E());
396
+ }
397
+ }
398
+ ),
399
+ /* @__PURE__ */ i(
400
+ "button",
401
+ {
402
+ style: {
403
+ padding: "8px 20px",
404
+ background: "#1677ff",
405
+ color: "#fff",
406
+ border: "none",
407
+ borderRadius: 4,
408
+ cursor: "pointer",
409
+ fontSize: 13
410
+ },
411
+ onClick: E,
412
+ children: "Send"
413
+ }
414
+ )
415
+ ]
416
+ }
417
+ )
418
+ ] }) : /* @__PURE__ */ i(
419
+ "div",
420
+ {
421
+ style: {
422
+ flex: 1,
423
+ display: "flex",
424
+ alignItems: "center",
425
+ justifyContent: "center",
426
+ color: "#999"
427
+ },
428
+ children: "Select or create a scenario instance to start"
429
+ }
430
+ ) })
431
+ ] });
432
+ }
433
+ export {
434
+ ee as default
435
+ };