@zhin.js/adapter-sandbox 3.0.5 → 3.0.6
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/CHANGELOG.md +88 -79
- package/README.md +17 -29
- package/client/index.tsx +1 -1
- package/client/tsconfig.json +1 -1
- package/dist/index.js +3 -3
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/package.json +9 -15
- package/src/index.ts +1 -4
- package/lib/fetch-ws.d.ts +0 -7
- package/lib/fetch-ws.d.ts.map +0 -1
- package/lib/fetch-ws.js +0 -10
- package/lib/fetch-ws.js.map +0 -1
- package/src/fetch-ws.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @zhin.js/adapter-process
|
|
2
2
|
|
|
3
|
+
## 3.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 90d9efd: fix: 处理包名
|
|
8
|
+
- @zhin.js/core@1.1.29
|
|
9
|
+
- @zhin.js/host-api@0.0.1
|
|
10
|
+
- @zhin.js/host-router@0.0.1
|
|
11
|
+
|
|
3
12
|
## 3.0.5
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -10,10 +19,10 @@
|
|
|
10
19
|
- Updated dependencies [996ebb3]
|
|
11
20
|
- @zhin.js/core@1.1.28
|
|
12
21
|
- @zhin.js/client@1.1.4
|
|
13
|
-
- @zhin.js/
|
|
22
|
+
- @zhin.js/host-router-host@0.1.4
|
|
14
23
|
- zhin.js@1.0.86
|
|
15
24
|
- @zhin.js/console@3.0.5
|
|
16
|
-
- @zhin.js/
|
|
25
|
+
- @zhin.js/host-router@1.0.79
|
|
17
26
|
|
|
18
27
|
## 3.0.4
|
|
19
28
|
|
|
@@ -21,7 +30,7 @@
|
|
|
21
30
|
|
|
22
31
|
- zhin.js@1.0.85
|
|
23
32
|
- @zhin.js/console@3.0.4
|
|
24
|
-
- @zhin.js/
|
|
33
|
+
- @zhin.js/host-router@1.0.78
|
|
25
34
|
- @zhin.js/core@1.1.27
|
|
26
35
|
|
|
27
36
|
## 3.0.3
|
|
@@ -34,11 +43,11 @@
|
|
|
34
43
|
- Updated dependencies [f19d2e0]
|
|
35
44
|
- Updated dependencies [2d24338]
|
|
36
45
|
- @zhin.js/console@3.0.3
|
|
37
|
-
- @zhin.js/
|
|
46
|
+
- @zhin.js/host-router-host@0.1.3
|
|
38
47
|
- @zhin.js/core@1.1.26
|
|
39
48
|
- zhin.js@1.0.84
|
|
40
49
|
- @zhin.js/client@1.1.3
|
|
41
|
-
- @zhin.js/
|
|
50
|
+
- @zhin.js/host-router@1.0.77
|
|
42
51
|
|
|
43
52
|
## 3.0.2
|
|
44
53
|
|
|
@@ -47,7 +56,7 @@
|
|
|
47
56
|
- 775427e: fix: edge 支持
|
|
48
57
|
- Updated dependencies [775427e]
|
|
49
58
|
- @zhin.js/console@3.0.2
|
|
50
|
-
- @zhin.js/
|
|
59
|
+
- @zhin.js/host-router@1.0.76
|
|
51
60
|
- @zhin.js/client@1.1.2
|
|
52
61
|
- @zhin.js/core@1.1.25
|
|
53
62
|
- zhin.js@1.0.83
|
|
@@ -59,7 +68,7 @@
|
|
|
59
68
|
- 32049f5: fix: init publish
|
|
60
69
|
- Updated dependencies [32049f5]
|
|
61
70
|
- @zhin.js/console@3.0.1
|
|
62
|
-
- @zhin.js/
|
|
71
|
+
- @zhin.js/host-router@1.0.75
|
|
63
72
|
- @zhin.js/client@1.1.1
|
|
64
73
|
- @zhin.js/core@1.1.24
|
|
65
74
|
- zhin.js@1.0.82
|
|
@@ -80,7 +89,7 @@
|
|
|
80
89
|
- @zhin.js/core@1.1.23
|
|
81
90
|
- zhin.js@1.0.81
|
|
82
91
|
- @zhin.js/console@2.0.24
|
|
83
|
-
- @zhin.js/
|
|
92
|
+
- @zhin.js/host-router@1.0.74
|
|
84
93
|
|
|
85
94
|
## 2.0.23
|
|
86
95
|
|
|
@@ -88,7 +97,7 @@
|
|
|
88
97
|
|
|
89
98
|
- zhin.js@1.0.80
|
|
90
99
|
- @zhin.js/console@2.0.23
|
|
91
|
-
- @zhin.js/
|
|
100
|
+
- @zhin.js/host-router@1.0.73
|
|
92
101
|
- @zhin.js/core@1.1.22
|
|
93
102
|
|
|
94
103
|
## 2.0.22
|
|
@@ -97,7 +106,7 @@
|
|
|
97
106
|
|
|
98
107
|
- zhin.js@1.0.79
|
|
99
108
|
- @zhin.js/console@2.0.22
|
|
100
|
-
- @zhin.js/
|
|
109
|
+
- @zhin.js/host-router@1.0.72
|
|
101
110
|
- @zhin.js/core@1.1.21
|
|
102
111
|
|
|
103
112
|
## 2.0.21
|
|
@@ -108,7 +117,7 @@
|
|
|
108
117
|
- @zhin.js/console@2.0.21
|
|
109
118
|
- @zhin.js/core@1.1.20
|
|
110
119
|
- zhin.js@1.0.78
|
|
111
|
-
- @zhin.js/
|
|
120
|
+
- @zhin.js/host-router@1.0.71
|
|
112
121
|
|
|
113
122
|
## 2.0.20
|
|
114
123
|
|
|
@@ -117,7 +126,7 @@
|
|
|
117
126
|
- zhin.js@1.0.77
|
|
118
127
|
- @zhin.js/core@1.1.19
|
|
119
128
|
- @zhin.js/console@2.0.20
|
|
120
|
-
- @zhin.js/
|
|
129
|
+
- @zhin.js/host-router@1.0.70
|
|
121
130
|
|
|
122
131
|
## 2.0.19
|
|
123
132
|
|
|
@@ -126,7 +135,7 @@
|
|
|
126
135
|
- Updated dependencies [cb9fbf1]
|
|
127
136
|
- zhin.js@1.0.76
|
|
128
137
|
- @zhin.js/console@2.0.19
|
|
129
|
-
- @zhin.js/
|
|
138
|
+
- @zhin.js/host-router@1.0.69
|
|
130
139
|
- @zhin.js/core@1.1.18
|
|
131
140
|
|
|
132
141
|
## 2.0.18
|
|
@@ -136,7 +145,7 @@
|
|
|
136
145
|
- @zhin.js/core@1.1.17
|
|
137
146
|
- zhin.js@1.0.75
|
|
138
147
|
- @zhin.js/console@2.0.18
|
|
139
|
-
- @zhin.js/
|
|
148
|
+
- @zhin.js/host-router@1.0.68
|
|
140
149
|
|
|
141
150
|
## 2.0.17
|
|
142
151
|
|
|
@@ -146,7 +155,7 @@
|
|
|
146
155
|
- @zhin.js/core@1.1.16
|
|
147
156
|
- zhin.js@1.0.74
|
|
148
157
|
- @zhin.js/console@2.0.17
|
|
149
|
-
- @zhin.js/
|
|
158
|
+
- @zhin.js/host-router@1.0.67
|
|
150
159
|
|
|
151
160
|
## 2.0.16
|
|
152
161
|
|
|
@@ -155,7 +164,7 @@
|
|
|
155
164
|
- f1e9a76: fix: 提高 skill 质量
|
|
156
165
|
- zhin.js@1.0.73
|
|
157
166
|
- @zhin.js/console@2.0.16
|
|
158
|
-
- @zhin.js/
|
|
167
|
+
- @zhin.js/host-router@1.0.66
|
|
159
168
|
- @zhin.js/core@1.1.15
|
|
160
169
|
|
|
161
170
|
## 2.0.15
|
|
@@ -183,7 +192,7 @@
|
|
|
183
192
|
- @zhin.js/core@1.1.14
|
|
184
193
|
- zhin.js@1.0.72
|
|
185
194
|
- @zhin.js/console@2.0.13
|
|
186
|
-
- @zhin.js/
|
|
195
|
+
- @zhin.js/host-router@1.0.65
|
|
187
196
|
|
|
188
197
|
## 2.0.12
|
|
189
198
|
|
|
@@ -202,7 +211,7 @@
|
|
|
202
211
|
- @zhin.js/core@1.1.13
|
|
203
212
|
- zhin.js@1.0.71
|
|
204
213
|
- @zhin.js/console@2.0.11
|
|
205
|
-
- @zhin.js/
|
|
214
|
+
- @zhin.js/host-router@1.0.64
|
|
206
215
|
|
|
207
216
|
## 2.0.10
|
|
208
217
|
|
|
@@ -212,14 +221,14 @@
|
|
|
212
221
|
- @zhin.js/core@1.1.10
|
|
213
222
|
- zhin.js@1.0.68
|
|
214
223
|
- @zhin.js/console@2.0.10
|
|
215
|
-
- @zhin.js/
|
|
224
|
+
- @zhin.js/host-router@1.0.63
|
|
216
225
|
|
|
217
226
|
## 2.0.9
|
|
218
227
|
|
|
219
228
|
### Patch Changes
|
|
220
229
|
|
|
221
230
|
- Updated dependencies [0eba6d6]
|
|
222
|
-
- @zhin.js/
|
|
231
|
+
- @zhin.js/host-router@1.0.62
|
|
223
232
|
- @zhin.js/core@1.1.9
|
|
224
233
|
- zhin.js@1.0.67
|
|
225
234
|
- @zhin.js/console@2.0.9
|
|
@@ -231,7 +240,7 @@
|
|
|
231
240
|
- zhin.js@1.0.66
|
|
232
241
|
- @zhin.js/core@1.1.8
|
|
233
242
|
- @zhin.js/console@2.0.8
|
|
234
|
-
- @zhin.js/
|
|
243
|
+
- @zhin.js/host-router@1.0.61
|
|
235
244
|
|
|
236
245
|
## 2.0.7
|
|
237
246
|
|
|
@@ -240,7 +249,7 @@
|
|
|
240
249
|
- @zhin.js/core@1.1.7
|
|
241
250
|
- zhin.js@1.0.65
|
|
242
251
|
- @zhin.js/console@2.0.7
|
|
243
|
-
- @zhin.js/
|
|
252
|
+
- @zhin.js/host-router@1.0.60
|
|
244
253
|
|
|
245
254
|
## 2.0.6
|
|
246
255
|
|
|
@@ -252,7 +261,7 @@
|
|
|
252
261
|
- @zhin.js/core@1.1.6
|
|
253
262
|
- zhin.js@1.0.64
|
|
254
263
|
- @zhin.js/console@2.0.6
|
|
255
|
-
- @zhin.js/
|
|
264
|
+
- @zhin.js/host-router@1.0.59
|
|
256
265
|
|
|
257
266
|
## 2.0.5
|
|
258
267
|
|
|
@@ -261,7 +270,7 @@
|
|
|
261
270
|
- ba30934: fix: web 优化
|
|
262
271
|
- Updated dependencies [ba30934]
|
|
263
272
|
- @zhin.js/console@2.0.5
|
|
264
|
-
- @zhin.js/
|
|
273
|
+
- @zhin.js/host-router@1.0.58
|
|
265
274
|
- zhin.js@1.0.63
|
|
266
275
|
- @zhin.js/core@1.1.5
|
|
267
276
|
|
|
@@ -271,7 +280,7 @@
|
|
|
271
280
|
|
|
272
281
|
- zhin.js@1.0.62
|
|
273
282
|
- @zhin.js/console@2.0.4
|
|
274
|
-
- @zhin.js/
|
|
283
|
+
- @zhin.js/host-router@1.0.57
|
|
275
284
|
- @zhin.js/core@1.1.4
|
|
276
285
|
|
|
277
286
|
## 2.0.3
|
|
@@ -280,7 +289,7 @@
|
|
|
280
289
|
|
|
281
290
|
- zhin.js@1.0.61
|
|
282
291
|
- @zhin.js/console@2.0.3
|
|
283
|
-
- @zhin.js/
|
|
292
|
+
- @zhin.js/host-router@1.0.56
|
|
284
293
|
- @zhin.js/core@1.1.3
|
|
285
294
|
|
|
286
295
|
## 2.0.2
|
|
@@ -298,7 +307,7 @@
|
|
|
298
307
|
- @zhin.js/console@2.0.2
|
|
299
308
|
- @zhin.js/core@1.1.2
|
|
300
309
|
- zhin.js@1.0.60
|
|
301
|
-
- @zhin.js/
|
|
310
|
+
- @zhin.js/host-router@1.0.55
|
|
302
311
|
|
|
303
312
|
## 2.0.1
|
|
304
313
|
|
|
@@ -310,7 +319,7 @@
|
|
|
310
319
|
- @zhin.js/core@1.1.1
|
|
311
320
|
- zhin.js@1.0.59
|
|
312
321
|
- @zhin.js/console@2.0.1
|
|
313
|
-
- @zhin.js/
|
|
322
|
+
- @zhin.js/host-router@1.0.54
|
|
314
323
|
|
|
315
324
|
## 2.0.0
|
|
316
325
|
|
|
@@ -320,7 +329,7 @@
|
|
|
320
329
|
- @zhin.js/core@1.1.0
|
|
321
330
|
- zhin.js@1.0.58
|
|
322
331
|
- @zhin.js/console@2.0.0
|
|
323
|
-
- @zhin.js/
|
|
332
|
+
- @zhin.js/host-router@1.0.53
|
|
324
333
|
|
|
325
334
|
## 1.0.70
|
|
326
335
|
|
|
@@ -331,7 +340,7 @@
|
|
|
331
340
|
- @zhin.js/core@1.0.57
|
|
332
341
|
- zhin.js@1.0.57
|
|
333
342
|
- @zhin.js/console@1.0.59
|
|
334
|
-
- @zhin.js/
|
|
343
|
+
- @zhin.js/host-router@1.0.52
|
|
335
344
|
|
|
336
345
|
## 1.0.69
|
|
337
346
|
|
|
@@ -340,7 +349,7 @@
|
|
|
340
349
|
- zhin.js@1.0.56
|
|
341
350
|
- @zhin.js/core@1.0.56
|
|
342
351
|
- @zhin.js/console@1.0.58
|
|
343
|
-
- @zhin.js/
|
|
352
|
+
- @zhin.js/host-router@1.0.51
|
|
344
353
|
|
|
345
354
|
## 1.0.68
|
|
346
355
|
|
|
@@ -357,7 +366,7 @@
|
|
|
357
366
|
- @zhin.js/core@1.0.55
|
|
358
367
|
- zhin.js@1.0.55
|
|
359
368
|
- @zhin.js/console@1.0.56
|
|
360
|
-
- @zhin.js/
|
|
369
|
+
- @zhin.js/host-router@1.0.50
|
|
361
370
|
|
|
362
371
|
## 1.0.66
|
|
363
372
|
|
|
@@ -369,7 +378,7 @@
|
|
|
369
378
|
- @zhin.js/core@1.0.54
|
|
370
379
|
- zhin.js@1.0.54
|
|
371
380
|
- @zhin.js/console@1.0.55
|
|
372
|
-
- @zhin.js/
|
|
381
|
+
- @zhin.js/host-router@1.0.49
|
|
373
382
|
|
|
374
383
|
## 1.0.65
|
|
375
384
|
|
|
@@ -378,7 +387,7 @@
|
|
|
378
387
|
- @zhin.js/core@1.0.53
|
|
379
388
|
- zhin.js@1.0.53
|
|
380
389
|
- @zhin.js/console@1.0.54
|
|
381
|
-
- @zhin.js/
|
|
390
|
+
- @zhin.js/host-router@1.0.48
|
|
382
391
|
|
|
383
392
|
## 1.0.64
|
|
384
393
|
|
|
@@ -387,7 +396,7 @@
|
|
|
387
396
|
- a3511a0: 各包内 Agent 技能说明已固定为随包发布的 `skills/*/SKILL.md`(替代已移除的运行时 `declareSkill`)。本批为 registry / 分发侧对齐的 **patch** 版本递增。
|
|
388
397
|
- Updated dependencies [a3511a0]
|
|
389
398
|
- @zhin.js/console@1.0.53
|
|
390
|
-
- @zhin.js/
|
|
399
|
+
- @zhin.js/host-router@1.0.47
|
|
391
400
|
|
|
392
401
|
## 1.0.63
|
|
393
402
|
|
|
@@ -400,7 +409,7 @@
|
|
|
400
409
|
- zhin.js@1.0.52
|
|
401
410
|
- @zhin.js/console@1.0.52
|
|
402
411
|
- @zhin.js/client@1.0.13
|
|
403
|
-
- @zhin.js/
|
|
412
|
+
- @zhin.js/host-router@1.0.46
|
|
404
413
|
|
|
405
414
|
## 1.0.62
|
|
406
415
|
|
|
@@ -415,7 +424,7 @@
|
|
|
415
424
|
|
|
416
425
|
- zhin.js@1.0.51
|
|
417
426
|
- @zhin.js/console@1.0.50
|
|
418
|
-
- @zhin.js/
|
|
427
|
+
- @zhin.js/host-router@1.0.45
|
|
419
428
|
- @zhin.js/core@1.0.51
|
|
420
429
|
|
|
421
430
|
## 1.0.60
|
|
@@ -432,7 +441,7 @@
|
|
|
432
441
|
|
|
433
442
|
- zhin.js@1.0.50
|
|
434
443
|
- @zhin.js/console@1.0.48
|
|
435
|
-
- @zhin.js/
|
|
444
|
+
- @zhin.js/host-router@1.0.44
|
|
436
445
|
- @zhin.js/core@1.0.50
|
|
437
446
|
|
|
438
447
|
## 1.0.58
|
|
@@ -443,7 +452,7 @@
|
|
|
443
452
|
- @zhin.js/core@1.0.49
|
|
444
453
|
- zhin.js@1.0.49
|
|
445
454
|
- @zhin.js/console@1.0.47
|
|
446
|
-
- @zhin.js/
|
|
455
|
+
- @zhin.js/host-router@1.0.43
|
|
447
456
|
|
|
448
457
|
## 1.0.57
|
|
449
458
|
|
|
@@ -453,7 +462,7 @@
|
|
|
453
462
|
- @zhin.js/core@1.0.48
|
|
454
463
|
- zhin.js@1.0.48
|
|
455
464
|
- @zhin.js/console@1.0.46
|
|
456
|
-
- @zhin.js/
|
|
465
|
+
- @zhin.js/host-router@1.0.42
|
|
457
466
|
|
|
458
467
|
## 1.0.56
|
|
459
468
|
|
|
@@ -463,7 +472,7 @@
|
|
|
463
472
|
- @zhin.js/core@1.0.47
|
|
464
473
|
- zhin.js@1.0.47
|
|
465
474
|
- @zhin.js/console@1.0.45
|
|
466
|
-
- @zhin.js/
|
|
475
|
+
- @zhin.js/host-router@1.0.41
|
|
467
476
|
|
|
468
477
|
## 1.0.55
|
|
469
478
|
|
|
@@ -473,7 +482,7 @@
|
|
|
473
482
|
- @zhin.js/core@1.0.46
|
|
474
483
|
- zhin.js@1.0.46
|
|
475
484
|
- @zhin.js/console@1.0.44
|
|
476
|
-
- @zhin.js/
|
|
485
|
+
- @zhin.js/host-router@1.0.40
|
|
477
486
|
|
|
478
487
|
## 1.0.54
|
|
479
488
|
|
|
@@ -483,7 +492,7 @@
|
|
|
483
492
|
- @zhin.js/core@1.0.45
|
|
484
493
|
- zhin.js@1.0.45
|
|
485
494
|
- @zhin.js/console@1.0.43
|
|
486
|
-
- @zhin.js/
|
|
495
|
+
- @zhin.js/host-router@1.0.39
|
|
487
496
|
|
|
488
497
|
## 1.0.53
|
|
489
498
|
|
|
@@ -491,7 +500,7 @@
|
|
|
491
500
|
|
|
492
501
|
- zhin.js@1.0.44
|
|
493
502
|
- @zhin.js/console@1.0.42
|
|
494
|
-
- @zhin.js/
|
|
503
|
+
- @zhin.js/host-router@1.0.38
|
|
495
504
|
- @zhin.js/core@1.0.44
|
|
496
505
|
|
|
497
506
|
## 1.0.52
|
|
@@ -500,7 +509,7 @@
|
|
|
500
509
|
|
|
501
510
|
- Updated dependencies [72ec4ba]
|
|
502
511
|
- @zhin.js/console@1.0.41
|
|
503
|
-
- @zhin.js/
|
|
512
|
+
- @zhin.js/host-router@1.0.37
|
|
504
513
|
- @zhin.js/client@1.0.11
|
|
505
514
|
- @zhin.js/core@1.0.43
|
|
506
515
|
- zhin.js@1.0.43
|
|
@@ -519,7 +528,7 @@
|
|
|
519
528
|
- zhin.js@1.0.42
|
|
520
529
|
- @zhin.js/core@1.0.42
|
|
521
530
|
- @zhin.js/console@1.0.39
|
|
522
|
-
- @zhin.js/
|
|
531
|
+
- @zhin.js/host-router@1.0.36
|
|
523
532
|
|
|
524
533
|
## 1.0.49
|
|
525
534
|
|
|
@@ -529,7 +538,7 @@
|
|
|
529
538
|
- @zhin.js/core@1.0.41
|
|
530
539
|
- zhin.js@1.0.41
|
|
531
540
|
- @zhin.js/console@1.0.38
|
|
532
|
-
- @zhin.js/
|
|
541
|
+
- @zhin.js/host-router@1.0.35
|
|
533
542
|
|
|
534
543
|
## 1.0.48
|
|
535
544
|
|
|
@@ -539,7 +548,7 @@
|
|
|
539
548
|
- @zhin.js/core@1.0.40
|
|
540
549
|
- zhin.js@1.0.40
|
|
541
550
|
- @zhin.js/console@1.0.37
|
|
542
|
-
- @zhin.js/
|
|
551
|
+
- @zhin.js/host-router@1.0.34
|
|
543
552
|
|
|
544
553
|
## 1.0.47
|
|
545
554
|
|
|
@@ -549,7 +558,7 @@
|
|
|
549
558
|
- @zhin.js/core@1.0.39
|
|
550
559
|
- zhin.js@1.0.39
|
|
551
560
|
- @zhin.js/console@1.0.36
|
|
552
|
-
- @zhin.js/
|
|
561
|
+
- @zhin.js/host-router@1.0.33
|
|
553
562
|
|
|
554
563
|
## 1.0.46
|
|
555
564
|
|
|
@@ -559,7 +568,7 @@
|
|
|
559
568
|
- @zhin.js/core@1.0.38
|
|
560
569
|
- zhin.js@1.0.38
|
|
561
570
|
- @zhin.js/console@1.0.35
|
|
562
|
-
- @zhin.js/
|
|
571
|
+
- @zhin.js/host-router@1.0.32
|
|
563
572
|
|
|
564
573
|
## 1.0.45
|
|
565
574
|
|
|
@@ -567,7 +576,7 @@
|
|
|
567
576
|
|
|
568
577
|
- Updated dependencies [631da6e]
|
|
569
578
|
- @zhin.js/console@1.0.34
|
|
570
|
-
- @zhin.js/
|
|
579
|
+
- @zhin.js/host-router@1.0.31
|
|
571
580
|
|
|
572
581
|
## 1.0.44
|
|
573
582
|
|
|
@@ -577,7 +586,7 @@
|
|
|
577
586
|
- @zhin.js/core@1.0.37
|
|
578
587
|
- zhin.js@1.0.37
|
|
579
588
|
- @zhin.js/console@1.0.33
|
|
580
|
-
- @zhin.js/
|
|
589
|
+
- @zhin.js/host-router@1.0.30
|
|
581
590
|
|
|
582
591
|
## 1.0.43
|
|
583
592
|
|
|
@@ -586,7 +595,7 @@
|
|
|
586
595
|
- Updated dependencies [432d0a5]
|
|
587
596
|
- Updated dependencies [6d94111]
|
|
588
597
|
- @zhin.js/console@1.0.32
|
|
589
|
-
- @zhin.js/
|
|
598
|
+
- @zhin.js/host-router@1.0.29
|
|
590
599
|
- @zhin.js/core@1.0.36
|
|
591
600
|
- zhin.js@1.0.36
|
|
592
601
|
|
|
@@ -598,7 +607,7 @@
|
|
|
598
607
|
- @zhin.js/core@1.0.35
|
|
599
608
|
- zhin.js@1.0.35
|
|
600
609
|
- @zhin.js/console@1.0.31
|
|
601
|
-
- @zhin.js/
|
|
610
|
+
- @zhin.js/host-router@1.0.28
|
|
602
611
|
|
|
603
612
|
## 1.0.41
|
|
604
613
|
|
|
@@ -608,7 +617,7 @@
|
|
|
608
617
|
- @zhin.js/core@1.0.34
|
|
609
618
|
- zhin.js@1.0.34
|
|
610
619
|
- @zhin.js/console@1.0.30
|
|
611
|
-
- @zhin.js/
|
|
620
|
+
- @zhin.js/host-router@1.0.27
|
|
612
621
|
|
|
613
622
|
## 1.0.40
|
|
614
623
|
|
|
@@ -618,14 +627,14 @@
|
|
|
618
627
|
- @zhin.js/core@1.0.33
|
|
619
628
|
- zhin.js@1.0.33
|
|
620
629
|
- @zhin.js/console@1.0.29
|
|
621
|
-
- @zhin.js/
|
|
630
|
+
- @zhin.js/host-router@1.0.26
|
|
622
631
|
|
|
623
632
|
## 1.0.39
|
|
624
633
|
|
|
625
634
|
### Patch Changes
|
|
626
635
|
|
|
627
636
|
- Updated dependencies [48481a8]
|
|
628
|
-
- @zhin.js/
|
|
637
|
+
- @zhin.js/host-router@1.0.25
|
|
629
638
|
|
|
630
639
|
## 1.0.38
|
|
631
640
|
|
|
@@ -635,7 +644,7 @@
|
|
|
635
644
|
- @zhin.js/core@1.0.32
|
|
636
645
|
- zhin.js@1.0.32
|
|
637
646
|
- @zhin.js/console@1.0.28
|
|
638
|
-
- @zhin.js/
|
|
647
|
+
- @zhin.js/host-router@1.0.24
|
|
639
648
|
|
|
640
649
|
## 1.0.37
|
|
641
650
|
|
|
@@ -645,7 +654,7 @@
|
|
|
645
654
|
- @zhin.js/core@1.0.31
|
|
646
655
|
- zhin.js@1.0.31
|
|
647
656
|
- @zhin.js/console@1.0.27
|
|
648
|
-
- @zhin.js/
|
|
657
|
+
- @zhin.js/host-router@1.0.23
|
|
649
658
|
|
|
650
659
|
## 1.0.36
|
|
651
660
|
|
|
@@ -654,7 +663,7 @@
|
|
|
654
663
|
- Updated dependencies [460a6c6]
|
|
655
664
|
- zhin.js@1.0.30
|
|
656
665
|
- @zhin.js/console@1.0.26
|
|
657
|
-
- @zhin.js/
|
|
666
|
+
- @zhin.js/host-router@1.0.22
|
|
658
667
|
- @zhin.js/core@1.0.30
|
|
659
668
|
|
|
660
669
|
## 1.0.35
|
|
@@ -665,7 +674,7 @@
|
|
|
665
674
|
- @zhin.js/core@1.0.29
|
|
666
675
|
- zhin.js@1.0.29
|
|
667
676
|
- @zhin.js/console@1.0.25
|
|
668
|
-
- @zhin.js/
|
|
677
|
+
- @zhin.js/host-router@1.0.21
|
|
669
678
|
|
|
670
679
|
## 1.0.34
|
|
671
680
|
|
|
@@ -673,7 +682,7 @@
|
|
|
673
682
|
|
|
674
683
|
- Updated dependencies [05a514d]
|
|
675
684
|
- @zhin.js/console@1.0.24
|
|
676
|
-
- @zhin.js/
|
|
685
|
+
- @zhin.js/host-router@1.0.20
|
|
677
686
|
- @zhin.js/client@1.0.10
|
|
678
687
|
- @zhin.js/core@1.0.28
|
|
679
688
|
- zhin.js@1.0.28
|
|
@@ -683,14 +692,14 @@
|
|
|
683
692
|
### Patch Changes
|
|
684
693
|
|
|
685
694
|
- Updated dependencies [2b44e18]
|
|
686
|
-
- @zhin.js/
|
|
695
|
+
- @zhin.js/host-router@1.0.19
|
|
687
696
|
|
|
688
697
|
## 1.0.32
|
|
689
698
|
|
|
690
699
|
### Patch Changes
|
|
691
700
|
|
|
692
701
|
- Updated dependencies [b27e633]
|
|
693
|
-
- @zhin.js/
|
|
702
|
+
- @zhin.js/host-router@1.0.18
|
|
694
703
|
- @zhin.js/core@1.0.27
|
|
695
704
|
- zhin.js@1.0.27
|
|
696
705
|
- @zhin.js/console@1.0.23
|
|
@@ -702,7 +711,7 @@
|
|
|
702
711
|
- 106d357: fix: ai
|
|
703
712
|
- Updated dependencies [106d357]
|
|
704
713
|
- @zhin.js/console@1.0.22
|
|
705
|
-
- @zhin.js/
|
|
714
|
+
- @zhin.js/host-router@1.0.17
|
|
706
715
|
- @zhin.js/client@1.0.9
|
|
707
716
|
- @zhin.js/core@1.0.26
|
|
708
717
|
- zhin.js@1.0.26
|
|
@@ -719,7 +728,7 @@
|
|
|
719
728
|
- @zhin.js/core@1.0.25
|
|
720
729
|
- zhin.js@1.0.25
|
|
721
730
|
- @zhin.js/console@1.0.21
|
|
722
|
-
- @zhin.js/
|
|
731
|
+
- @zhin.js/host-router@1.0.16
|
|
723
732
|
|
|
724
733
|
## 1.0.29
|
|
725
734
|
|
|
@@ -729,7 +738,7 @@
|
|
|
729
738
|
- @zhin.js/core@1.0.24
|
|
730
739
|
- zhin.js@1.0.24
|
|
731
740
|
- @zhin.js/console@1.0.20
|
|
732
|
-
- @zhin.js/
|
|
741
|
+
- @zhin.js/host-router@1.0.15
|
|
733
742
|
|
|
734
743
|
## 1.0.28
|
|
735
744
|
|
|
@@ -740,7 +749,7 @@
|
|
|
740
749
|
- @zhin.js/core@1.0.23
|
|
741
750
|
- zhin.js@1.0.23
|
|
742
751
|
- @zhin.js/console@1.0.19
|
|
743
|
-
- @zhin.js/
|
|
752
|
+
- @zhin.js/host-router@1.0.14
|
|
744
753
|
|
|
745
754
|
## 1.0.27
|
|
746
755
|
|
|
@@ -749,7 +758,7 @@
|
|
|
749
758
|
- Updated dependencies [26aba27]
|
|
750
759
|
- zhin.js@1.0.22
|
|
751
760
|
- @zhin.js/console@1.0.18
|
|
752
|
-
- @zhin.js/
|
|
761
|
+
- @zhin.js/host-router@1.0.13
|
|
753
762
|
- @zhin.js/core@1.0.22
|
|
754
763
|
|
|
755
764
|
## 1.0.26
|
|
@@ -760,7 +769,7 @@
|
|
|
760
769
|
- @zhin.js/core@1.0.21
|
|
761
770
|
- zhin.js@1.0.21
|
|
762
771
|
- @zhin.js/console@1.0.17
|
|
763
|
-
- @zhin.js/
|
|
772
|
+
- @zhin.js/host-router@1.0.12
|
|
764
773
|
|
|
765
774
|
## 1.0.25
|
|
766
775
|
|
|
@@ -771,7 +780,7 @@
|
|
|
771
780
|
- Updated dependencies [a3b7673]
|
|
772
781
|
- Updated dependencies [5141137]
|
|
773
782
|
- @zhin.js/console@1.0.16
|
|
774
|
-
- @zhin.js/
|
|
783
|
+
- @zhin.js/host-router@1.0.11
|
|
775
784
|
- @zhin.js/core@1.0.20
|
|
776
785
|
- zhin.js@1.0.20
|
|
777
786
|
|
|
@@ -785,7 +794,7 @@
|
|
|
785
794
|
- @zhin.js/core@1.0.19
|
|
786
795
|
- zhin.js@1.0.19
|
|
787
796
|
- @zhin.js/console@1.0.15
|
|
788
|
-
- @zhin.js/
|
|
797
|
+
- @zhin.js/host-router@1.0.10
|
|
789
798
|
|
|
790
799
|
## 1.0.23
|
|
791
800
|
|
|
@@ -797,7 +806,7 @@
|
|
|
797
806
|
- @zhin.js/core@1.0.18
|
|
798
807
|
- zhin.js@1.0.18
|
|
799
808
|
- @zhin.js/console@1.0.14
|
|
800
|
-
- @zhin.js/
|
|
809
|
+
- @zhin.js/host-router@1.0.9
|
|
801
810
|
|
|
802
811
|
## 1.0.22
|
|
803
812
|
|
|
@@ -849,7 +858,7 @@
|
|
|
849
858
|
- Updated dependencies [547028f]
|
|
850
859
|
- @zhin.js/console@1.0.10
|
|
851
860
|
- @zhin.js/types@1.0.5
|
|
852
|
-
- @zhin.js/
|
|
861
|
+
- @zhin.js/host-router@1.0.7
|
|
853
862
|
- zhin.js@1.0.14
|
|
854
863
|
|
|
855
864
|
## 1.0.15
|
|
@@ -889,7 +898,7 @@
|
|
|
889
898
|
- Updated dependencies [c490260]
|
|
890
899
|
- @zhin.js/console@1.0.7
|
|
891
900
|
- @zhin.js/client@1.0.5
|
|
892
|
-
- @zhin.js/
|
|
901
|
+
- @zhin.js/host-router@1.0.6
|
|
893
902
|
- zhin.js@1.0.9
|
|
894
903
|
|
|
895
904
|
## 1.0.10
|
|
@@ -902,7 +911,7 @@
|
|
|
902
911
|
- @zhin.js/types@1.0.3
|
|
903
912
|
- @zhin.js/client@1.0.4
|
|
904
913
|
- zhin.js@1.0.8
|
|
905
|
-
- @zhin.js/
|
|
914
|
+
- @zhin.js/host-router@1.0.5
|
|
906
915
|
|
|
907
916
|
## 1.0.9
|
|
908
917
|
|
|
@@ -921,7 +930,7 @@
|
|
|
921
930
|
- Updated dependencies [b213bbc]
|
|
922
931
|
- @zhin.js/console@1.0.4
|
|
923
932
|
- @zhin.js/client@1.0.3
|
|
924
|
-
- @zhin.js/
|
|
933
|
+
- @zhin.js/host-router@1.0.4
|
|
925
934
|
- zhin.js@1.0.6
|
|
926
935
|
|
|
927
936
|
## 1.0.7
|
|
@@ -937,7 +946,7 @@
|
|
|
937
946
|
|
|
938
947
|
- f347667: fix: runtime error
|
|
939
948
|
- Updated dependencies [f347667]
|
|
940
|
-
- @zhin.js/
|
|
949
|
+
- @zhin.js/host-router@1.0.3
|
|
941
950
|
- zhin.js@1.0.5
|
|
942
951
|
|
|
943
952
|
## 1.0.5
|
|
@@ -947,7 +956,7 @@
|
|
|
947
956
|
- Updated dependencies [d291005]
|
|
948
957
|
- @zhin.js/console@1.0.2
|
|
949
958
|
- @zhin.js/client@1.0.2
|
|
950
|
-
- @zhin.js/
|
|
959
|
+
- @zhin.js/host-router@1.0.2
|
|
951
960
|
|
|
952
961
|
## 1.0.4
|
|
953
962
|
|
package/README.md
CHANGED
|
@@ -20,49 +20,37 @@ pnpm add @zhin.js/adapter-sandbox
|
|
|
20
20
|
|
|
21
21
|
Sandbox 适配器需要以下服务插件:
|
|
22
22
|
|
|
23
|
-
- `@zhin.js/
|
|
24
|
-
- `@zhin.js/
|
|
23
|
+
- `@zhin.js/host-router` — HTTP 服务(提供 Router 和 WebSocket)
|
|
24
|
+
- `@zhin.js/host-api` — Host 侧 Console API(`addEntry` 注册 Sandbox 扩展)
|
|
25
25
|
- `@zhin.js/client` — Remote Console 客户端 SDK(UI 在 zhin-console 仓库)
|
|
26
26
|
|
|
27
27
|
## 配置
|
|
28
28
|
|
|
29
|
+
**推荐(与 [minimal-bot](../../../examples/minimal-bot/) 一致)**:`bots: []`,在 Remote Console 打开「沙盒」页时经 `/sandbox` WebSocket **自动创建** bot(如 `sandbox-xxxx`),无需在 yaml 里写 `context: sandbox`。
|
|
30
|
+
|
|
29
31
|
```yaml
|
|
30
32
|
# zhin.config.yml
|
|
31
|
-
bots:
|
|
32
|
-
- context: sandbox
|
|
33
|
-
name: sandbox-bot
|
|
33
|
+
bots: []
|
|
34
34
|
|
|
35
35
|
plugins:
|
|
36
|
-
- adapter-sandbox
|
|
37
|
-
-
|
|
38
|
-
-
|
|
36
|
+
- "@zhin.js/adapter-sandbox"
|
|
37
|
+
- "@zhin.js/host-router"
|
|
38
|
+
- "@zhin.js/host-api"
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
bots: [
|
|
48
|
-
{
|
|
49
|
-
context: 'sandbox',
|
|
50
|
-
name: 'sandbox-bot',
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
plugins: [
|
|
54
|
-
'adapter-sandbox',
|
|
55
|
-
'http',
|
|
56
|
-
'console',
|
|
57
|
-
]
|
|
58
|
-
})
|
|
41
|
+
可选:若需在启动时即在 bot 列表显示**固定名称**的离线占位 bot,可显式配置:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
bots:
|
|
45
|
+
- context: sandbox
|
|
46
|
+
name: sandbox-bot
|
|
59
47
|
```
|
|
60
48
|
|
|
61
49
|
## 使用方式
|
|
62
50
|
|
|
63
|
-
1. 启动机器人:`pnpm dev
|
|
64
|
-
2. 打开 **[Remote Console](https://console.zhin.dev)**,API Base
|
|
65
|
-
3. 在
|
|
51
|
+
1. 启动机器人:`pnpm dev`(终端会打印 Host 地址,一般为 `http://127.0.0.1:8086`)
|
|
52
|
+
2. 打开 **[Remote Console](https://console.zhin.dev)**,API Base 与 Host 地址一致,Token 与 `http.token` / `HTTP_TOKEN` 一致
|
|
53
|
+
3. 在 Console **沙盒** 页连接后发送消息进行测试
|
|
66
54
|
|
|
67
55
|
每个浏览器客户端连接后创建 Sandbox Bot(无 yaml 固定名时为 `sandbox-xxxx`)。
|
|
68
56
|
|
package/client/index.tsx
CHANGED
package/client/tsconfig.json
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import ze,{useState as C,useEffect as Ie,useRef as we}from"react";import{cn as A,resolveMediaSrc as Pe,pickMediaRawUrl as ye}from"@zhin.js/client";function Te(){let i=localStorage.getItem("zhin_api_base")?.trim();return(i?i.replace(/\/$/,""):null)??window.location.origin}import{forwardRef as la,createElement as
|
|
1
|
+
import ze,{useState as C,useEffect as Ie,useRef as we}from"react";import{cn as A,resolveMediaSrc as Pe,pickMediaRawUrl as ye}from"@zhin.js/client";function Te(){let i=localStorage.getItem("zhin_api_base")?.trim();return(i?i.replace(/\/$/,""):null)??window.location.origin}import{forwardRef as la,createElement as ra}from"react";var Le=(...i)=>i.filter((m,w,I)=>!!m&&m.trim()!==""&&I.indexOf(m)===w).join(" ").trim();var qe=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Ue=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(m,w,I)=>I?I.toUpperCase():w.toLowerCase());var ke=i=>{let m=Ue(i);return m.charAt(0).toUpperCase()+m.slice(1)};import{forwardRef as ua,createElement as Ne}from"react";var xe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var He=i=>{for(let m in i)if(m.startsWith("aria-")||m==="role"||m==="title")return!0;return!1};import{createContext as ta,useContext as oa,useMemo as Ga,createElement as Wa}from"react";var da=ta({});var Oe=()=>oa(da);var Ee=ua(({color:i,size:m,strokeWidth:w,absoluteStrokeWidth:I,className:N="",children:D,iconNode:g,...p},S)=>{let{size:B=24,strokeWidth:U=2,absoluteStrokeWidth:_=!1,color:E="currentColor",className:G=""}=Oe()??{},H=I??_?Number(w??U)*24/Number(m??B):w??U;return Ne("svg",{ref:S,...xe,width:m??B??xe.width,height:m??B??xe.height,stroke:i??E,strokeWidth:H,className:Le("lucide",G,N),...!D&&!He(p)&&{"aria-hidden":"true"},...p},[...g.map(([M,k])=>Ne(M,k)),...Array.isArray(D)?D:[D]])});var s=(i,m)=>{let w=la(({className:I,...N},D)=>ra(Ee,{ref:D,iconNode:m,className:Le(`lucide-${qe(ke(i))}`,`lucide-${i}`,I),...N}));return w.displayName=ke(i),w};var sa=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],X=s("bell",sa);var fa=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ee=s("bot",fa);var ia=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ae=s("check",ia);var ca=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],te=s("hash",ca);var na=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],oe=s("image",na);var pa=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],de=s("info",pa);var ma=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],O=s("message-square",ma);var La=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],ue=s("music",La);var xa=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],j=s("search",xa);var Ia=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],le=s("send",Ia);var Ca=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],re=s("smile",Ca);var ga=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],se=s("trash-2",ga);var ha=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],K=s("user-plus",ha);var Sa=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Z=s("user",Sa);var ka=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],fe=s("users",ka);var wa=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],ie=s("video",wa);var Pa=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ce=s("wifi-off",Pa);var ya=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ne=s("wifi",ya);var Aa=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pe=s("x",Aa);import{useRef as Ge,forwardRef as Ma,useImperativeHandle as Ba}from"react";import{jsx as Fa}from"react/jsx-runtime";var We=Ma(({placeholder:i="\u8F93\u5165\u6D88\u606F...",onSend:m,onChange:w,onAtTrigger:I,minHeight:N="44px",maxHeight:D="200px"},g)=>{let p=Ge(null),S=Ge(null),B=()=>{if(!p.current)return{text:"",segments:[]};let d="",t=[],u=Array.from(p.current.childNodes);for(let c of u)if(c.nodeType===Node.TEXT_NODE){let l=c.textContent||"";l&&(d+=l,t.push({type:"text",data:{text:l}}))}else if(c.nodeType===Node.ELEMENT_NODE){let l=c;if(l.classList.contains("editor-face")){let n=l.dataset.id;d+=`[face:${n}]`,t.push({type:"face",data:{id:Number(n)}})}else if(l.classList.contains("editor-image")){let n=l.dataset.url;d+=`[image:${n}]`,t.push({type:"image",data:{url:n}})}else if(l.classList.contains("editor-video")){let n=l.dataset.url||"";d+=`[video:${n}]`,t.push({type:"video",data:{url:n}})}else if(l.classList.contains("editor-audio")){let n=l.dataset.url||"";d+=`[audio:${n}]`,t.push({type:"audio",data:{url:n}})}else if(l.classList.contains("editor-at")){let n=l.dataset.name,y=l.dataset.id;d+=`[@${n}]`,t.push({type:"at",data:{name:n,qq:y}})}else l.tagName==="BR"&&(d+=`
|
|
2
2
|
`)}return{text:d,segments:t}},U=d=>{if(!p.current)return;let t=document.createElement("img");t.src=`https://face.viki.moe/apng/${d}.png`,t.alt=`[face:${d}]`,t.dataset.type="face",t.dataset.id=String(d),t.className="editor-face",M(t),R()},_=d=>{if(!p.current||!d.trim())return;let t=document.createElement("img");t.src=d.trim(),t.alt=`[image:${d.trim()}]`,t.dataset.type="image",t.dataset.url=d.trim(),t.className="editor-image",M(t),R()},E=d=>{if(!p.current||!d.trim())return;let t=d.trim(),u=document.createElement("span");u.className="editor-video",u.dataset.url=t,u.contentEditable="false",u.textContent="\u{1F4F9} \u89C6\u9891",M(u),R()},G=d=>{if(!p.current||!d.trim())return;let t=d.trim(),u=document.createElement("span");u.className="editor-audio",u.dataset.url=t,u.contentEditable="false",u.textContent="\u{1F3B5} \u97F3\u9891",M(u),R()},H=(d,t)=>{if(!p.current||!d.trim())return;let u=document.createElement("span");u.dataset.type="at",u.dataset.name=d,t&&(u.dataset.id=t),u.className="editor-at",u.contentEditable="false";let c=document.createElement("span");c.textContent="@",c.className="editor-at-symbol";let l=document.createElement("span");l.textContent=d,l.className="editor-at-name",u.appendChild(c),u.appendChild(l),M(u),R()},M=d=>{if(!p.current)return;p.current.focus();let t=window.getSelection();if(t&&t.rangeCount>0){let u=t.getRangeAt(0);if(p.current.contains(u.commonAncestorContainer))u.deleteContents(),u.insertNode(d),u.collapse(!1),t.removeAllRanges(),t.addRange(u);else{p.current.appendChild(d);let l=document.createRange();l.setStartAfter(d),l.collapse(!0),t.removeAllRanges(),t.addRange(l)}}else{p.current.appendChild(d);let u=window.getSelection();if(u){let c=document.createRange();c.setStartAfter(d),c.collapse(!0),u.removeAllRanges(),u.addRange(c)}}},k=()=>{p.current&&(p.current.innerHTML="",R())},W=()=>{p.current?.focus()},$=()=>B(),me=()=>{if(!p.current||!I)return;let d=window.getSelection();if(!d||d.rangeCount===0){I(!1,""),S.current=null;return}let t=d.getRangeAt(0);if(!p.current.contains(t.commonAncestorContainer)){I(!1,""),S.current=null;return}let u=t.startContainer;if(u.nodeType!==Node.TEXT_NODE){I(!1,""),S.current=null;return}let c=u,l=c.textContent?.substring(0,t.startOffset)||"",n=l.lastIndexOf("@");if(n!==-1){let y=l.substring(n+1);if(y.includes(" ")||y.includes(`
|
|
3
|
-
`)){I(!1,""),S.current=null;return}S.current=c;let V=document.createRange();V.setStart(c,n),V.setEnd(c,n+1);let v=V.getBoundingClientRect(),b=p.current.getBoundingClientRect();I(!0,y,{top:v.bottom-b.top,left:v.left-b.left})}else I(!1,""),S.current=null},R=()=>{if(me(),w){let{text:d,segments:t}=B();w(d,t)}},Ce=(d,t)=>{if(!S.current)return;let u=S.current,c=u.textContent||"",l=c.lastIndexOf("@");if(l!==-1){let n=c.substring(l+1),y=l+1+n.split(/[\s\n]/)[0].length,V=c.substring(0,l),v=c.substring(y);u.textContent=V+v;let b=window.getSelection();if(b){let T=document.createRange();T.setStart(u,l),T.collapse(!0),b.removeAllRanges(),b.addRange(T)}}S.current=null,H(d,t)},Y=d=>{d.preventDefault();let t=d.clipboardData,c=Array.from(t.items).find(n=>n.type.startsWith("image/"));if(c){let n=c.getAsFile();if(n){let y=new FileReader;y.onload=()=>{typeof y.result=="string"&&_(y.result)},y.readAsDataURL(n)}return}let l=t.getData("text/plain");l&&(document.execCommand("insertText",!1,l),R())},Q=d=>{if(d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),m)){let{text:t,segments:u}=B();m(t,u)}};return Ba(g,()=>({focus:W,clear:k,insertFace:U,insertImage:_,insertVideo:E,insertAudio:G,insertAt:H,replaceAtTrigger:Ce,getContent:$})),Fa("div",{ref:p,contentEditable:!0,suppressContentEditableWarning:!0,onInput:R,onKeyDown:Q,onPaste:Y,"data-placeholder":i,className:"rich-text-editor",style:{width:"100%",minHeight:N,maxHeight:D,padding:"0.5rem 0.75rem",border:"1px solid var(--gray-6)",borderRadius:"6px",backgroundColor:"var(--gray-1)",fontSize:"var(--font-size-2)",outline:"none",overflowY:"auto",lineHeight:"1.5",wordWrap:"break-word",color:"var(--gray-12)"}})});We.displayName="RichTextEditor";var Ve=We;import{Fragment as Da,jsx as a,jsxs as o}from"react/jsx-runtime";function Ae(){let[i,m]=C([]),[w,I]=C([{id:"user_1001",name:"\u6D4B\u8BD5\u7528\u6237",type:"private",unread:0},{id:"group_2001",name:"\u6D4B\u8BD5\u7FA4\u7EC4",type:"group",unread:0},{id:"channel_3001",name:"\u6D4B\u8BD5\u9891\u9053",type:"channel",unread:0}]),[N,D]=C([]),[g,p]=C(w[0]),[S,B]=C(""),[U,_]=C("ProcessBot"),[E,G]=C(!1),[H,M]=C(!1),[k,W]=C(null),[$,me]=C(""),[R,Ce]=C(!1),[Y,Q]=C(null),[d,t]=C(""),[u,c]=C(""),[l,n]=C(""),[y]=C([{id:"10001",name:"\u5F20\u4E09"},{id:"10002",name:"\u674E\u56DB"},{id:"10003",name:"\u738B\u4E94"},{id:"10004",name:"\u8D75\u516D"},{id:"10005",name:"\u6D4B\u8BD5\u7528\u6237"},{id:"10086",name:"Admin"},{id:"10010",name:"Test User"}]),[V,v]=C([]),[b,T]=C(!1),[J,ge]=C("chat"),Me=we(null),z=we(null),q=we(null),Xe=async()=>{try{let e=await fetch("https://face.viki.moe/metadata.json");D(await e.json())}catch(e){console.error("[Sandbox] Failed to fetch face list:",e)}};Ie(()=>{Xe()},[]);let Ke=e=>{let
|
|
3
|
+
`)){I(!1,""),S.current=null;return}S.current=c;let V=document.createRange();V.setStart(c,n),V.setEnd(c,n+1);let v=V.getBoundingClientRect(),b=p.current.getBoundingClientRect();I(!0,y,{top:v.bottom-b.top,left:v.left-b.left})}else I(!1,""),S.current=null},R=()=>{if(me(),w){let{text:d,segments:t}=B();w(d,t)}},Ce=(d,t)=>{if(!S.current)return;let u=S.current,c=u.textContent||"",l=c.lastIndexOf("@");if(l!==-1){let n=c.substring(l+1),y=l+1+n.split(/[\s\n]/)[0].length,V=c.substring(0,l),v=c.substring(y);u.textContent=V+v;let b=window.getSelection();if(b){let T=document.createRange();T.setStart(u,l),T.collapse(!0),b.removeAllRanges(),b.addRange(T)}}S.current=null,H(d,t)},Y=d=>{d.preventDefault();let t=d.clipboardData,c=Array.from(t.items).find(n=>n.type.startsWith("image/"));if(c){let n=c.getAsFile();if(n){let y=new FileReader;y.onload=()=>{typeof y.result=="string"&&_(y.result)},y.readAsDataURL(n)}return}let l=t.getData("text/plain");l&&(document.execCommand("insertText",!1,l),R())},Q=d=>{if(d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),m)){let{text:t,segments:u}=B();m(t,u)}};return Ba(g,()=>({focus:W,clear:k,insertFace:U,insertImage:_,insertVideo:E,insertAudio:G,insertAt:H,replaceAtTrigger:Ce,getContent:$})),Fa("div",{ref:p,contentEditable:!0,suppressContentEditableWarning:!0,onInput:R,onKeyDown:Q,onPaste:Y,"data-placeholder":i,className:"rich-text-editor",style:{width:"100%",minHeight:N,maxHeight:D,padding:"0.5rem 0.75rem",border:"1px solid var(--gray-6)",borderRadius:"6px",backgroundColor:"var(--gray-1)",fontSize:"var(--font-size-2)",outline:"none",overflowY:"auto",lineHeight:"1.5",wordWrap:"break-word",color:"var(--gray-12)"}})});We.displayName="RichTextEditor";var Ve=We;import{Fragment as Da,jsx as a,jsxs as o}from"react/jsx-runtime";function Ae(){let[i,m]=C([]),[w,I]=C([{id:"user_1001",name:"\u6D4B\u8BD5\u7528\u6237",type:"private",unread:0},{id:"group_2001",name:"\u6D4B\u8BD5\u7FA4\u7EC4",type:"group",unread:0},{id:"channel_3001",name:"\u6D4B\u8BD5\u9891\u9053",type:"channel",unread:0}]),[N,D]=C([]),[g,p]=C(w[0]),[S,B]=C(""),[U,_]=C("ProcessBot"),[E,G]=C(!1),[H,M]=C(!1),[k,W]=C(null),[$,me]=C(""),[R,Ce]=C(!1),[Y,Q]=C(null),[d,t]=C(""),[u,c]=C(""),[l,n]=C(""),[y]=C([{id:"10001",name:"\u5F20\u4E09"},{id:"10002",name:"\u674E\u56DB"},{id:"10003",name:"\u738B\u4E94"},{id:"10004",name:"\u8D75\u516D"},{id:"10005",name:"\u6D4B\u8BD5\u7528\u6237"},{id:"10086",name:"Admin"},{id:"10010",name:"Test User"}]),[V,v]=C([]),[b,T]=C(!1),[J,ge]=C("chat"),Me=we(null),z=we(null),q=we(null),Xe=async()=>{try{let e=await fetch("https://face.viki.moe/metadata.json");D(await e.json())}catch(e){console.error("[Sandbox] Failed to fetch face list:",e)}};Ie(()=>{Xe()},[]);let Ke=e=>{let r=typeof e.content=="string"?he(e.content):Array.isArray(e.content)?e.content:he(String(e.content??"")),L=e.type==="private"?`\u79C1\u804A-${e.bot||U}`:e.type==="group"?`\u7FA4\u7EC4-${e.id}`:`\u9891\u9053-${e.id}`,x=e.type;I(f=>{if(f.some(F=>F.id===e.id))return f;let h={id:e.id,name:L,type:x,unread:0};return p(h),[...f,h]}),m(f=>[...f,{id:`bot_${e.timestamp}`,type:"received",channelType:x,channelId:e.id,channelName:L,senderId:"bot",senderName:e.bot||U,content:r,timestamp:e.timestamp}])};Ie(()=>{let e=Te(),r=new URL("/sandbox",`${e}/`);return r.protocol=r.protocol==="https:"?"wss:":"ws:",z.current=new WebSocket(r.href),z.current.onopen=()=>G(!0),z.current.onmessage=L=>{try{Ke(JSON.parse(L.data))}catch(x){console.error("[Sandbox] Failed to parse message:",x)}},z.current.onclose=()=>G(!1),()=>{z.current?.close(),z.current=null,G(!1)}},[]),Ie(()=>{Me.current?.scrollIntoView({behavior:"smooth"})},[i]),Ie(()=>{v(S.trim()?he(S):[])},[S]);let he=e=>{let r=[],L=/\[@([^\]]+)\]|\[face:(\d+)\]|\[image:([^\]]+)\]|\[video:([^\]]+)\]|\[audio:([^\]]+)\]/g,x=0,f;for(;(f=L.exec(e))!==null;){if(f.index>x){let h=e.substring(x,f.index);h&&r.push({type:"text",data:{text:h}})}f[1]?r.push({type:"at",data:{qq:f[1],name:f[1]}}):f[2]?r.push({type:"face",data:{id:parseInt(f[2],10)}}):f[3]?r.push({type:"image",data:{url:f[3]}}):f[4]?r.push({type:"video",data:{url:f[4]}}):f[5]&&r.push({type:"audio",data:{url:f[5]}}),x=L.lastIndex}if(x<e.length){let h=e.substring(x);h&&r.push({type:"text",data:{text:h}})}return r.length>0?r:[{type:"text",data:{text:e}}]},Be=e=>e.length===0?!1:e.some(r=>r.type==="text"?!!String(r.data?.text??"").trim():!0),Ze=(e,r)=>{let L=r?"ring-1 ring-primary-foreground/25":"ring-1 ring-border/60";return e.map((x,f)=>{if(typeof x=="string")return a("span",{children:x.split(`
|
|
4
4
|
`).map((F,P)=>o(ze.Fragment,{children:[F,P<x.split(`
|
|
5
5
|
`).length-1&&a("br",{})]},P))},f);let h=x.data;switch(x.type){case"text":return a("span",{children:String(h.text??"").split(`
|
|
6
6
|
`).map((F,P)=>o(ze.Fragment,{children:[F,P<String(h.text??"").split(`
|
|
7
|
-
`).length-1&&a("br",{})]},P))},f);case"at":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-accent text-accent-foreground text-xs mx-0.5",children:["@",String(h.name??h.qq??"")]},f);case"face":return a("img",{src:`https://face.viki.moe/apng/${h.id}.png`,alt:"",className:"w-6 h-6 inline-block align-middle mx-0.5"},f);case"image":{let F=ye(h),P=Pe(F,"image");return P?a("a",{href:P,target:"_blank",rel:"noreferrer",className:"block my-1",children:a("img",{src:P,alt:"",className:A("max-w-[min(320px,88vw)] rounded-lg block",L,"ring-offset-0"),onError:aa=>{aa.target.style.display="none"}})},f):a("span",{className:"text-xs opacity-70",children:"[\u56FE\u7247]"},f)}case"video":{let F=ye(h),P=Pe(F,"video");return P?a("video",{src:P,controls:!0,playsInline:!0,preload:"metadata",className:A("max-w-[min(360px,92vw)] max-h-72 rounded-lg my-1 bg-black/10",L)},f):a("span",{className:"text-xs opacity-70",children:"[\u89C6\u9891\u65E0\u5730\u5740]"},f)}case"audio":case"record":{let F=ye(h),P=Pe(F,"audio");return P?a("audio",{src:P,controls:!0,preload:"metadata",className:A("w-full max-w-sm my-2 h-10",s&&"opacity-95")},f):a("span",{className:"text-xs opacity-70",children:"[\u97F3\u9891\u65E0\u5730\u5740]"},f)}case"file":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs mx-0.5",children:["\u{1F4CE} ",String(h.name||"\u6587\u4EF6")]},f);default:return o("span",{className:"text-xs opacity-70",children:["[",x.type,"]"]},f)}})},Fe=(e,s)=>{if(!Be(s))return;let L={id:`msg_${Date.now()}`,type:"sent",channelType:g.type,channelId:g.id,channelName:g.name,senderId:"test_user",senderName:"\u6D4B\u8BD5\u7528\u6237",content:s,timestamp:Date.now()};m(f=>[...f,L]),B(""),v([]),q.current?.clear();let x=JSON.stringify({type:g.type,id:g.id,content:s,timestamp:Date.now()});z.current?.send(x)},_e=()=>{confirm("\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u6D88\u606F\u8BB0\u5F55\uFF1F")&&m([])},Qe=e=>{ge("chat"),p(e),I(s=>s.map(L=>L.id===e.id?{...L,unread:0}:L)),window.innerWidth<768&&T(!1)},Je=()=>{let e=["private","group","channel"],s=e[Math.floor(Math.random()*e.length)],L=prompt("\u8BF7\u8F93\u5165\u9891\u9053\u540D\u79F0\uFF1A");if(L){let x={id:`${s}_${Date.now()}`,name:L,type:s,unread:0};I(f=>[...f,x]),p(x)}},De=e=>{switch(e){case"private":return a(Z,{size:16});case"group":return a(fe,{size:16});case"channel":return a(te,{size:16});default:return a(O,{size:16})}},je=e=>{q.current?.insertFace(e),M(!1)},be=()=>{let e=$.trim();!e||!k||(k==="image"?q.current?.insertImage(e):k==="video"?q.current?.insertVideo(e):q.current?.insertAudio(e),me(""),W(null))},ba=()=>{l.trim()&&(q.current?.insertAt(l.trim()),n(""),Ce(!1))},$e=e=>{q.current?.replaceAtTrigger(e.name,e.id),Q(null),t("")},Ye=(e,s,L)=>{if(g.type==="private"){Q(null),t("");return}e&&L?(Q(L),t(s)):(Q(null),t(""))},Re=y.filter(e=>{if(!d.trim())return!0;let s=d.toLowerCase();return e.name.toLowerCase().includes(s)||e.id.toLowerCase().includes(s)}),ea=(e,s)=>{B(e),v(s)},ve=N.filter(e=>e.name.toLowerCase().includes(u.toLowerCase())||e.describe.toLowerCase().includes(u.toLowerCase())),Se=i.filter(e=>e.channelId===g.id);return o("div",{className:"sandbox-container rounded-xl border border-border/70 bg-card/30 shadow-sm",children:[o("button",{className:"mobile-channel-toggle md:hidden",onClick:()=>T(!b),children:[a(O,{size:20})," \u9891\u9053\u5217\u8868"]}),o("div",{className:A("channel-sidebar rounded-lg border bg-card",b&&"show"),children:[a("div",{className:"p-3 border-b",children:o("div",{className:"flex justify-between items-center",children:[o("div",{className:"flex items-center gap-2",children:[a("div",{className:"p-1 rounded-md bg-secondary",children:a(O,{size:16,className:"text-muted-foreground"})}),a("h3",{className:"font-semibold",children:"\u9891\u9053\u5217\u8868"})]}),o("span",{className:A("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border",E?"bg-emerald-100 text-emerald-800 border-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-400 dark:border-emerald-800":"bg-muted text-muted-foreground"),children:[E?a(ne,{size:12}):a(ce,{size:12}),E?"\u5DF2\u8FDE\u63A5":"\u672A\u8FDE\u63A5"]})]})}),o("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[w.map(e=>{let s=J==="chat"&&g.id===e.id;return o("div",{className:A("menu-item",s&&"active"),onClick:()=>Qe(e),children:[a("span",{className:"shrink-0",children:De(e.type)}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium truncate",children:e.name}),a("div",{className:"text-xs text-muted-foreground",children:e.type==="private"?"\u79C1\u804A":e.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),e.unread>0&&a("span",{className:"inline-flex items-center justify-center h-5 min-w-5 rounded-full bg-destructive text-destructive-foreground text-[10px] font-medium px-1",children:e.unread})]},e.id)}),o("div",{className:"pt-2 mt-2 border-t space-y-1",children:[o("div",{className:A("menu-item",J==="requests"&&"active"),onClick:()=>{ge("requests"),window.innerWidth<768&&T(!1)},children:[a(K,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u8BF7\u6C42"}),a("div",{className:"text-xs text-muted-foreground",children:"\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49"})]})]}),o("div",{className:A("menu-item",J==="notices"&&"active"),onClick:()=>{ge("notices"),window.innerWidth<768&&T(!1)},children:[a(X,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u901A\u77E5"}),a("div",{className:"text-xs text-muted-foreground",children:"\u7FA4\u7BA1/\u64A4\u56DE\u7B49"})]})]})]})]}),a("div",{className:"p-2 border-t",children:a("button",{className:"w-full py-2 px-3 rounded-md border border-dashed text-sm text-muted-foreground hover:bg-accent transition-colors",onClick:Je,children:"+ \u6DFB\u52A0\u9891\u9053"})})]}),b&&a("div",{className:"channel-overlay md:hidden",onClick:()=>T(!1)}),o("div",{className:"chat-area",children:[J==="requests"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(K,{size:20})," \u8BF7\u6C42"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(K,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u8BF7\u6C42\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49\u8BF7\u6C42\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="notices"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(X,{size:20})," \u901A\u77E5"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(X,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u901A\u77E5\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u7FA4\u7BA1\u3001\u64A4\u56DE\u7B49\u901A\u77E5\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="chat"&&o(Da,{children:[a("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0",children:o("div",{className:"flex justify-between items-center flex-wrap gap-2",children:[o("div",{className:"flex items-center gap-3",children:[a("div",{className:"p-2 rounded-lg bg-secondary",children:De(g.type)}),o("div",{children:[a("h2",{className:"text-lg font-bold",children:g.name}),o("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a("span",{children:g.id}),a("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-[10px]",children:Se.length}),a("span",{children:"\u6761\u6D88\u606F"})]})]}),a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-secondary text-secondary-foreground",children:g.type==="private"?"\u79C1\u804A":g.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),o("div",{className:"flex items-center gap-2",children:[a("input",{value:U,onChange:e=>_(e.target.value),placeholder:"\u673A\u5668\u4EBA\u540D\u79F0",className:"h-8 w-28 rounded-md border bg-transparent px-2 text-sm"}),o("button",{className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-secondary text-secondary-foreground text-sm hover:bg-secondary/80",onClick:_e,children:[a(re,{size:14})," \u6E05\u7A7A"]})]})]})}),a("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0",children:a("div",{className:"flex-1 overflow-y-auto p-4",children:Se.length===0?o("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a(O,{size:64,className:"text-muted-foreground/20"}),a("span",{className:"text-muted-foreground",children:"\u6682\u65E0\u6D88\u606F\uFF0C\u5F00\u59CB\u5BF9\u8BDD\u5427\uFF01"})]}):o("div",{className:"space-y-2",children:[Se.map(e=>a("div",{className:A("flex",e.type==="sent"?"justify-end":"justify-start"),children:o("div",{className:A("max-w-[70%] p-3 rounded-2xl",e.type==="sent"?"bg-primary text-primary-foreground":"bg-muted"),children:[o("div",{className:"flex items-center gap-2 mb-1",children:[e.type==="received"&&a(ee,{size:14}),e.type==="sent"&&a(Z,{size:14}),a("span",{className:"text-xs font-medium opacity-90",children:e.senderName}),a("span",{className:"text-xs opacity-70",children:new Date(e.timestamp).toLocaleTimeString()})]}),a("div",{className:"text-sm space-y-1",children:Ze(e.content,e.type==="sent")})]})},e.id)),a("div",{ref:Me})]})})}),o("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0 space-y-3",children:[o("div",{className:"flex gap-2 items-center flex-wrap",children:[a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",H?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{M(!H),W(null)},title:"\u63D2\u5165\u8868\u60C5",children:a(se,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",k==="image"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="image"?null:"image"),M(!1)},title:"\u63D2\u5165\u56FE\u7247 URL",children:a(oe,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",k==="video"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="video"?null:"video"),M(!1)},title:"\u63D2\u5165\u89C6\u9891 URL",children:a(ie,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",k==="audio"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="audio"?null:"audio"),M(!1)},title:"\u63D2\u5165\u97F3\u9891 URL",children:a(ue,{size:16})}),a("div",{className:"flex-1 min-w-[1rem]"}),S&&a("button",{className:"h-8 w-8 rounded-md flex items-center justify-center hover:bg-accent transition-colors",onClick:()=>{B(""),v([])},children:a(pe,{size:16})})]}),H&&o("div",{className:"p-3 rounded-md border bg-muted/30 max-h-64 overflow-y-auto space-y-2",children:[a("input",{value:u,onChange:e=>c(e.target.value),placeholder:"\u641C\u7D22\u8868\u60C5...",className:"w-full h-8 rounded-md border bg-transparent px-2 text-sm"}),a("div",{className:"grid grid-cols-8 gap-1",children:ve.slice(0,80).map(e=>a("button",{onClick:()=>je(e.id),title:e.name,className:"w-10 h-10 rounded-md border flex items-center justify-center hover:bg-accent transition-colors",children:a("img",{src:`https://face.viki.moe/apng/${e.id}.png`,alt:e.name,className:"w-8 h-8"})},e.id))}),ve.length===0&&o("div",{className:"flex flex-col items-center gap-2 py-4",children:[a(j,{size:32,className:"text-muted-foreground/30"}),a("span",{className:"text-sm text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u8868\u60C5"})]})]}),k&&o("div",{className:"p-3 rounded-md border bg-muted/30 space-y-2",children:[o("p",{className:"text-xs text-muted-foreground",children:[k==="image"&&"\u652F\u6301 http(s) \u56FE\u7247\u94FE\u63A5\u6216 data URL",k==="video"&&"\u652F\u6301\u6D4F\u89C8\u5668\u53EF\u89E3\u7801\u7684\u89C6\u9891\u76F4\u94FE\uFF08\u5982 .mp4\u3001.webm\uFF09",k==="audio"&&"\u652F\u6301 .mp3\u3001.ogg\u3001.wav \u7B49\u97F3\u9891\u76F4\u94FE"]}),a("input",{value:$,onChange:e=>me(e.target.value),placeholder:k==="image"?"\u56FE\u7247 URL\u2026":k==="video"?"\u89C6\u9891 URL\u2026":"\u97F3\u9891 URL\u2026",className:"w-full h-8 rounded-md border border-input bg-background px-2 text-sm",onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),be())}}),o("button",{type:"button",className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",onClick:be,disabled:!$.trim(),children:[a(ae,{size:14})," \u63D2\u5165\u5230\u8F93\u5165\u6846"]})]}),o("div",{className:"flex gap-2 items-start",children:[o("div",{className:"flex-1 relative",children:[a(Ve,{ref:q,placeholder:`\u5411 ${g.name} \u53D1\u9001\u6D88\u606F...`,onSend:Fe,onChange:ea,onAtTrigger:Ye,minHeight:"44px",maxHeight:"200px"}),Y&&a("div",{className:"absolute z-50 rounded-lg border bg-popover shadow-md min-w-60 max-h-72 overflow-y-auto p-1",style:{top:`${Y.top}px`,left:`${Y.left}px`},children:Re.length>0?Re.map(e=>o("div",{className:"flex items-center gap-2 p-2 rounded-md cursor-pointer hover:bg-accent transition-colors",onClick:()=>$e(e),children:[a(Z,{size:16,className:"text-muted-foreground"}),o("div",{className:"flex-1",children:[a("div",{className:"text-sm font-medium",children:e.name}),o("div",{className:"text-xs text-muted-foreground",children:["ID: ",e.id]})]})]},e.id)):o("div",{className:"flex flex-col items-center gap-2 p-4",children:[a(j,{size:20,className:"text-muted-foreground/50"}),a("span",{className:"text-xs text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u7528\u6237"})]})})]}),o("button",{className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50 transition-colors hover:bg-primary/90",onClick:()=>{let e=q.current?.getContent();e&&Fe(e.text,e.segments)},disabled:!Be(V),children:[a(le,{size:16})," \u53D1\u9001"]})]}),o("div",{className:"flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[a(de,{size:12})," \u5FEB\u6377\u64CD\u4F5C:",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Enter"})," \u53D1\u9001",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Shift+Enter"})," \u6362\u884C",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[@\u540D\u79F0]"})," @\u67D0\u4EBA",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[video:URL]"}),a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[audio:URL]"})]})]})]})]})]})}function So(i){i.addRoute({path:"/console/sandbox",name:"\u6C99\u76D2",element:i.React.createElement(Ae,{hostReact:i.React})}),i.addTool({id:"sandbox",name:"\u6C99\u76D2",path:"/console/sandbox"})}export{So as register};
|
|
7
|
+
`).length-1&&a("br",{})]},P))},f);case"at":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded bg-accent text-accent-foreground text-xs mx-0.5",children:["@",String(h.name??h.qq??"")]},f);case"face":return a("img",{src:`https://face.viki.moe/apng/${h.id}.png`,alt:"",className:"w-6 h-6 inline-block align-middle mx-0.5"},f);case"image":{let F=ye(h),P=Pe(F,"image");return P?a("a",{href:P,target:"_blank",rel:"noreferrer",className:"block my-1",children:a("img",{src:P,alt:"",className:A("max-w-[min(320px,88vw)] rounded-lg block",L,"ring-offset-0"),onError:aa=>{aa.target.style.display="none"}})},f):a("span",{className:"text-xs opacity-70",children:"[\u56FE\u7247]"},f)}case"video":{let F=ye(h),P=Pe(F,"video");return P?a("video",{src:P,controls:!0,playsInline:!0,preload:"metadata",className:A("max-w-[min(360px,92vw)] max-h-72 rounded-lg my-1 bg-black/10",L)},f):a("span",{className:"text-xs opacity-70",children:"[\u89C6\u9891\u65E0\u5730\u5740]"},f)}case"audio":case"record":{let F=ye(h),P=Pe(F,"audio");return P?a("audio",{src:P,controls:!0,preload:"metadata",className:A("w-full max-w-sm my-2 h-10",r&&"opacity-95")},f):a("span",{className:"text-xs opacity-70",children:"[\u97F3\u9891\u65E0\u5730\u5740]"},f)}case"file":return o("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-xs mx-0.5",children:["\u{1F4CE} ",String(h.name||"\u6587\u4EF6")]},f);default:return o("span",{className:"text-xs opacity-70",children:["[",x.type,"]"]},f)}})},Fe=(e,r)=>{if(!Be(r))return;let L={id:`msg_${Date.now()}`,type:"sent",channelType:g.type,channelId:g.id,channelName:g.name,senderId:"test_user",senderName:"\u6D4B\u8BD5\u7528\u6237",content:r,timestamp:Date.now()};m(f=>[...f,L]),B(""),v([]),q.current?.clear();let x=JSON.stringify({type:g.type,id:g.id,content:r,timestamp:Date.now()});z.current?.send(x)},_e=()=>{confirm("\u786E\u5B9A\u6E05\u7A7A\u6240\u6709\u6D88\u606F\u8BB0\u5F55\uFF1F")&&m([])},Qe=e=>{ge("chat"),p(e),I(r=>r.map(L=>L.id===e.id?{...L,unread:0}:L)),window.innerWidth<768&&T(!1)},Je=()=>{let e=["private","group","channel"],r=e[Math.floor(Math.random()*e.length)],L=prompt("\u8BF7\u8F93\u5165\u9891\u9053\u540D\u79F0\uFF1A");if(L){let x={id:`${r}_${Date.now()}`,name:L,type:r,unread:0};I(f=>[...f,x]),p(x)}},De=e=>{switch(e){case"private":return a(Z,{size:16});case"group":return a(fe,{size:16});case"channel":return a(te,{size:16});default:return a(O,{size:16})}},je=e=>{q.current?.insertFace(e),M(!1)},be=()=>{let e=$.trim();!e||!k||(k==="image"?q.current?.insertImage(e):k==="video"?q.current?.insertVideo(e):q.current?.insertAudio(e),me(""),W(null))},ba=()=>{l.trim()&&(q.current?.insertAt(l.trim()),n(""),Ce(!1))},$e=e=>{q.current?.replaceAtTrigger(e.name,e.id),Q(null),t("")},Ye=(e,r,L)=>{if(g.type==="private"){Q(null),t("");return}e&&L?(Q(L),t(r)):(Q(null),t(""))},Re=y.filter(e=>{if(!d.trim())return!0;let r=d.toLowerCase();return e.name.toLowerCase().includes(r)||e.id.toLowerCase().includes(r)}),ea=(e,r)=>{B(e),v(r)},ve=N.filter(e=>e.name.toLowerCase().includes(u.toLowerCase())||e.describe.toLowerCase().includes(u.toLowerCase())),Se=i.filter(e=>e.channelId===g.id);return o("div",{className:"sandbox-container rounded-xl border border-border/70 bg-card/30 shadow-sm",children:[o("button",{className:"mobile-channel-toggle md:hidden",onClick:()=>T(!b),children:[a(O,{size:20})," \u9891\u9053\u5217\u8868"]}),o("div",{className:A("channel-sidebar rounded-lg border bg-card",b&&"show"),children:[a("div",{className:"p-3 border-b",children:o("div",{className:"flex justify-between items-center",children:[o("div",{className:"flex items-center gap-2",children:[a("div",{className:"p-1 rounded-md bg-secondary",children:a(O,{size:16,className:"text-muted-foreground"})}),a("h3",{className:"font-semibold",children:"\u9891\u9053\u5217\u8868"})]}),o("span",{className:A("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium border",E?"bg-emerald-100 text-emerald-800 border-emerald-200 dark:bg-emerald-900/30 dark:text-emerald-400 dark:border-emerald-800":"bg-muted text-muted-foreground"),children:[E?a(ne,{size:12}):a(ce,{size:12}),E?"\u5DF2\u8FDE\u63A5":"\u672A\u8FDE\u63A5"]})]})}),o("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:[w.map(e=>{let r=J==="chat"&&g.id===e.id;return o("div",{className:A("menu-item",r&&"active"),onClick:()=>Qe(e),children:[a("span",{className:"shrink-0",children:De(e.type)}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium truncate",children:e.name}),a("div",{className:"text-xs text-muted-foreground",children:e.type==="private"?"\u79C1\u804A":e.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),e.unread>0&&a("span",{className:"inline-flex items-center justify-center h-5 min-w-5 rounded-full bg-destructive text-destructive-foreground text-[10px] font-medium px-1",children:e.unread})]},e.id)}),o("div",{className:"pt-2 mt-2 border-t space-y-1",children:[o("div",{className:A("menu-item",J==="requests"&&"active"),onClick:()=>{ge("requests"),window.innerWidth<768&&T(!1)},children:[a(K,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u8BF7\u6C42"}),a("div",{className:"text-xs text-muted-foreground",children:"\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49"})]})]}),o("div",{className:A("menu-item",J==="notices"&&"active"),onClick:()=>{ge("notices"),window.innerWidth<768&&T(!1)},children:[a(X,{size:16,className:"shrink-0"}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"text-sm font-medium",children:"\u901A\u77E5"}),a("div",{className:"text-xs text-muted-foreground",children:"\u7FA4\u7BA1/\u64A4\u56DE\u7B49"})]})]})]})]}),a("div",{className:"p-2 border-t",children:a("button",{className:"w-full py-2 px-3 rounded-md border border-dashed text-sm text-muted-foreground hover:bg-accent transition-colors",onClick:Je,children:"+ \u6DFB\u52A0\u9891\u9053"})})]}),b&&a("div",{className:"channel-overlay md:hidden",onClick:()=>T(!1)}),o("div",{className:"chat-area",children:[J==="requests"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(K,{size:20})," \u8BF7\u6C42"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(K,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u8BF7\u6C42\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u597D\u53CB/\u7FA4\u9080\u8BF7\u7B49\u8BF7\u6C42\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="notices"&&o("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0 overflow-hidden",children:[a("div",{className:"p-3 border-b flex-shrink-0",children:o("h2",{className:"text-lg font-bold flex items-center gap-2",children:[a(X,{size:20})," \u901A\u77E5"]})}),o("div",{className:"flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center gap-3 text-muted-foreground text-center",children:[a(X,{size:48,className:"opacity-30"}),a("span",{children:"\u6C99\u76D2\u4E3A\u6A21\u62DF\u73AF\u5883\uFF0C\u6682\u65E0\u901A\u77E5\u6570\u636E"}),o("span",{className:"text-sm",children:["\u5B9E\u9645\u7FA4\u7BA1\u3001\u64A4\u56DE\u7B49\u901A\u77E5\u8BF7\u5230\u4FA7\u8FB9\u680F ",a("strong",{children:"\u673A\u5668\u4EBA"})," \u9875\u9762\u8FDB\u5165\u5BF9\u5E94\u673A\u5668\u4EBA\u7BA1\u7406\u67E5\u770B"]})]})]}),J==="chat"&&o(Da,{children:[a("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0",children:o("div",{className:"flex justify-between items-center flex-wrap gap-2",children:[o("div",{className:"flex items-center gap-3",children:[a("div",{className:"p-2 rounded-lg bg-secondary",children:De(g.type)}),o("div",{children:[a("h2",{className:"text-lg font-bold",children:g.name}),o("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a("span",{children:g.id}),a("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded border text-[10px]",children:Se.length}),a("span",{children:"\u6761\u6D88\u606F"})]})]}),a("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-secondary text-secondary-foreground",children:g.type==="private"?"\u79C1\u804A":g.type==="group"?"\u7FA4\u804A":"\u9891\u9053"})]}),o("div",{className:"flex items-center gap-2",children:[a("input",{value:U,onChange:e=>_(e.target.value),placeholder:"\u673A\u5668\u4EBA\u540D\u79F0",className:"h-8 w-28 rounded-md border bg-transparent px-2 text-sm"}),o("button",{className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-secondary text-secondary-foreground text-sm hover:bg-secondary/80",onClick:_e,children:[a(se,{size:14})," \u6E05\u7A7A"]})]})]})}),a("div",{className:"rounded-lg border bg-card flex-1 flex flex-col min-h-0",children:a("div",{className:"flex-1 overflow-y-auto p-4",children:Se.length===0?o("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[a(O,{size:64,className:"text-muted-foreground/20"}),a("span",{className:"text-muted-foreground",children:"\u6682\u65E0\u6D88\u606F\uFF0C\u5F00\u59CB\u5BF9\u8BDD\u5427\uFF01"})]}):o("div",{className:"space-y-2",children:[Se.map(e=>a("div",{className:A("flex",e.type==="sent"?"justify-end":"justify-start"),children:o("div",{className:A("max-w-[70%] p-3 rounded-2xl",e.type==="sent"?"bg-primary text-primary-foreground":"bg-muted"),children:[o("div",{className:"flex items-center gap-2 mb-1",children:[e.type==="received"&&a(ee,{size:14}),e.type==="sent"&&a(Z,{size:14}),a("span",{className:"text-xs font-medium opacity-90",children:e.senderName}),a("span",{className:"text-xs opacity-70",children:new Date(e.timestamp).toLocaleTimeString()})]}),a("div",{className:"text-sm space-y-1",children:Ze(e.content,e.type==="sent")})]})},e.id)),a("div",{ref:Me})]})})}),o("div",{className:"rounded-lg border bg-card p-3 flex-shrink-0 space-y-3",children:[o("div",{className:"flex gap-2 items-center flex-wrap",children:[a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",H?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{M(!H),W(null)},title:"\u63D2\u5165\u8868\u60C5",children:a(re,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",k==="image"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="image"?null:"image"),M(!1)},title:"\u63D2\u5165\u56FE\u7247 URL",children:a(oe,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",k==="video"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="video"?null:"video"),M(!1)},title:"\u63D2\u5165\u89C6\u9891 URL",children:a(ie,{size:16})}),a("button",{type:"button",className:A("h-8 w-8 rounded-md flex items-center justify-center border transition-colors",k==="audio"?"bg-primary text-primary-foreground":"hover:bg-accent"),onClick:()=>{W(e=>e==="audio"?null:"audio"),M(!1)},title:"\u63D2\u5165\u97F3\u9891 URL",children:a(ue,{size:16})}),a("div",{className:"flex-1 min-w-[1rem]"}),S&&a("button",{className:"h-8 w-8 rounded-md flex items-center justify-center hover:bg-accent transition-colors",onClick:()=>{B(""),v([])},children:a(pe,{size:16})})]}),H&&o("div",{className:"p-3 rounded-md border bg-muted/30 max-h-64 overflow-y-auto space-y-2",children:[a("input",{value:u,onChange:e=>c(e.target.value),placeholder:"\u641C\u7D22\u8868\u60C5...",className:"w-full h-8 rounded-md border bg-transparent px-2 text-sm"}),a("div",{className:"grid grid-cols-8 gap-1",children:ve.slice(0,80).map(e=>a("button",{onClick:()=>je(e.id),title:e.name,className:"w-10 h-10 rounded-md border flex items-center justify-center hover:bg-accent transition-colors",children:a("img",{src:`https://face.viki.moe/apng/${e.id}.png`,alt:e.name,className:"w-8 h-8"})},e.id))}),ve.length===0&&o("div",{className:"flex flex-col items-center gap-2 py-4",children:[a(j,{size:32,className:"text-muted-foreground/30"}),a("span",{className:"text-sm text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u8868\u60C5"})]})]}),k&&o("div",{className:"p-3 rounded-md border bg-muted/30 space-y-2",children:[o("p",{className:"text-xs text-muted-foreground",children:[k==="image"&&"\u652F\u6301 http(s) \u56FE\u7247\u94FE\u63A5\u6216 data URL",k==="video"&&"\u652F\u6301\u6D4F\u89C8\u5668\u53EF\u89E3\u7801\u7684\u89C6\u9891\u76F4\u94FE\uFF08\u5982 .mp4\u3001.webm\uFF09",k==="audio"&&"\u652F\u6301 .mp3\u3001.ogg\u3001.wav \u7B49\u97F3\u9891\u76F4\u94FE"]}),a("input",{value:$,onChange:e=>me(e.target.value),placeholder:k==="image"?"\u56FE\u7247 URL\u2026":k==="video"?"\u89C6\u9891 URL\u2026":"\u97F3\u9891 URL\u2026",className:"w-full h-8 rounded-md border border-input bg-background px-2 text-sm",onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),be())}}),o("button",{type:"button",className:"inline-flex items-center gap-1 h-8 px-3 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",onClick:be,disabled:!$.trim(),children:[a(ae,{size:14})," \u63D2\u5165\u5230\u8F93\u5165\u6846"]})]}),o("div",{className:"flex gap-2 items-start",children:[o("div",{className:"flex-1 relative",children:[a(Ve,{ref:q,placeholder:`\u5411 ${g.name} \u53D1\u9001\u6D88\u606F...`,onSend:Fe,onChange:ea,onAtTrigger:Ye,minHeight:"44px",maxHeight:"200px"}),Y&&a("div",{className:"absolute z-50 rounded-lg border bg-popover shadow-md min-w-60 max-h-72 overflow-y-auto p-1",style:{top:`${Y.top}px`,left:`${Y.left}px`},children:Re.length>0?Re.map(e=>o("div",{className:"flex items-center gap-2 p-2 rounded-md cursor-pointer hover:bg-accent transition-colors",onClick:()=>$e(e),children:[a(Z,{size:16,className:"text-muted-foreground"}),o("div",{className:"flex-1",children:[a("div",{className:"text-sm font-medium",children:e.name}),o("div",{className:"text-xs text-muted-foreground",children:["ID: ",e.id]})]})]},e.id)):o("div",{className:"flex flex-col items-center gap-2 p-4",children:[a(j,{size:20,className:"text-muted-foreground/50"}),a("span",{className:"text-xs text-muted-foreground",children:"\u672A\u627E\u5230\u5339\u914D\u7684\u7528\u6237"})]})})]}),o("button",{className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-md bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50 transition-colors hover:bg-primary/90",onClick:()=>{let e=q.current?.getContent();e&&Fe(e.text,e.segments)},disabled:!Be(V),children:[a(le,{size:16})," \u53D1\u9001"]})]}),o("div",{className:"flex items-center gap-2 flex-wrap text-xs text-muted-foreground",children:[a(de,{size:12})," \u5FEB\u6377\u64CD\u4F5C:",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Enter"})," \u53D1\u9001",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"Shift+Enter"})," \u6362\u884C",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[@\u540D\u79F0]"})," @\u67D0\u4EBA",a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[video:URL]"}),a("span",{className:"px-1 py-0.5 rounded border text-[10px]",children:"[audio:URL]"})]})]})]})]})]})}function So(i){i.addRoute({path:"/console/sandbox",name:"\u6C99\u76D2",element:i.React.createElement(Ae,{hostReact:i.React})}),i.addTool({id:"sandbox",name:"\u6C99\u76D2",path:"/console/sandbox"})}export{So as register};
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
|
10
10
|
lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
|
package/lib/index.d.ts
CHANGED
|
@@ -18,6 +18,5 @@ export declare class SandboxAdapter extends SandboxWsHostAdapter {
|
|
|
18
18
|
start(): Promise<void>;
|
|
19
19
|
setupWebSocket(router: SandboxRouter): Promise<void>;
|
|
20
20
|
}
|
|
21
|
-
export { registerSandboxWebSocketRoutes, } from "./fetch-ws.js";
|
|
22
21
|
export { SandboxWsBot, SandboxWsHostAdapter, resolveSandboxBot, bindSandboxWsSocket, parseSandboxWsPayload, type ResolvedSandboxBot, type SandboxWsConfig, type SandboxWsSocket, } from "./sandbox-ws.js";
|
|
23
22
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,SAAS,CAAC;AAEjD,OAAO,EACL,oBAAoB,EAGrB,MAAM,iBAAiB,CAAC;AAGzB,KAAK,aAAa,GAAG;IACnB,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,QAAQ;QAChB,OAAO,EAAE,cAAc,CAAC;KACzB;CACF;AAKD,uBAAuB;AACvB,qBAAa,cAAe,SAAQ,oBAAoB;IACtD,GAAG,CAAC,EAAE;QAAE,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;gBAE5E,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC;IAKjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ/B,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB3D;AAkCD,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAe,MAAM,SAAS,CAAC;AAEjD,OAAO,EACL,oBAAoB,EAGrB,MAAM,iBAAiB,CAAC;AAGzB,KAAK,aAAa,GAAG;IACnB,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;CAC1D,CAAC;AAEF,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,QAAQ;QAChB,OAAO,EAAE,cAAc,CAAC;KACzB;CACF;AAKD,uBAAuB;AACvB,qBAAa,cAAe,SAAQ,oBAAoB;IACtD,GAAG,CAAC,EAAE;QAAE,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC;gBAE5E,MAAM,EAAE,UAAU,CAAC,OAAO,SAAS,CAAC;IAKjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ/B,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAsB3D;AAkCD,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -63,6 +63,5 @@ plugin.useContext("web", (pageManager) => {
|
|
|
63
63
|
meta: { name: "Sandbox" },
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
|
-
export { registerSandboxWebSocketRoutes, } from "./fetch-ws.js";
|
|
67
66
|
export { SandboxWsBot, SandboxWsHostAdapter, resolveSandboxBot, bindSandboxWsSocket, parseSandboxWsPayload, } from "./sandbox-ws.js";
|
|
68
67
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAe,MAAM,SAAS,CAAC;AAEjD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,GAElB,MAAM,iBAAiB,CAAC;AAazB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;AAC3B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAE7B,uBAAuB;AACvB,MAAM,OAAO,cAAe,SAAQ,oBAAoB;IACtD,GAAG,CAAqF;IAExF,YAAY,MAAoC;QAC9C,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAA4B,CAAC;QAC3F,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEQ,KAAK,CAAC,KAAK;QAClB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACrC,MAAM,CAAC,KAAK,CACV,wBAAwB,IAAI,CAAC,QAAQ,CAAC,IAAI,8BAA8B,CACzE,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,MAAqB;QACxC,IAAI,IAAI,CAAC,GAAG;YAAE,OAAO;QACrB,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;QAEjC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,GAAG,IAAe,EAAE,EAAE;YAC/C,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAc,CAAC;YAChC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAA4C,CAAC;YAC/D,MAAM,CAAC,KAAK,CACV,+BAA+B,GAAG,CAAC,MAAM,EAAE,aAAa,IAAI,SAAS,EAAE,CACxE,CAAC;YACF,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC,EAAqB,CAAC,CAAC;YACxD,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;gBAClB,MAAM,CAAC,KAAK,CAAC,8BAA8B,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;gBAC/D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;YACH,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,MAAM,CAAC,KAAK,CAAC,+BAA+B,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;YAC1E,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAChF,CAAC;CACF;AAED,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC;AAEhC,OAAO,CAAC;IACN,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,kCAAkC;IAC/C,OAAO,EAAE,KAAK,EAAE,CAAS,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,OAAuB,EAAE,EAAE;QACzC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;QAC1B,CAAC;QACD,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;QACrB,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;CACO,CAAC,CAAC;AAEZ,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAC,SAAS,EAAE,KAAK,EAAE,MAAqB,EAAC,OAAuB,EAAE,EAAE;IAC5F,MAAM,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,EAAE;IACvC,WAAW,CAAC,QAAQ,CAAC;QACnB,EAAE,EAAE,SAAS;QACb,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,qBAAqB,CAAC;QACrE,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,kBAAkB,CAAC;QACjE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC1B,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-sandbox",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"description": "Zhin.js adapter for local testing and development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -48,26 +48,20 @@
|
|
|
48
48
|
"radix-ui": "^1.4.3",
|
|
49
49
|
"lucide-react": "^1.17.0",
|
|
50
50
|
"typescript": "^6.0.3",
|
|
51
|
-
"@zhin.js/
|
|
52
|
-
"@zhin.js/cli": "1.0.82",
|
|
53
|
-
"zhin.js": "1.0.86"
|
|
51
|
+
"@zhin.js/cli": "1.0.83"
|
|
54
52
|
},
|
|
55
53
|
"peerDependencies": {
|
|
56
|
-
"@zhin.js/core": "1.1.
|
|
57
|
-
"@zhin.js/client": "
|
|
58
|
-
"@zhin.js/
|
|
59
|
-
"@zhin.js/
|
|
60
|
-
"zhin.js": "1.0.
|
|
61
|
-
"@zhin.js/console": "3.0.5"
|
|
54
|
+
"@zhin.js/core": "1.1.29",
|
|
55
|
+
"@zhin.js/client": "2.0.0",
|
|
56
|
+
"@zhin.js/host-router": "0.0.1",
|
|
57
|
+
"@zhin.js/host-api": "0.0.1",
|
|
58
|
+
"@zhin.js/contract": "1.0.0"
|
|
62
59
|
},
|
|
63
60
|
"peerDependenciesMeta": {
|
|
64
|
-
"@zhin.js/
|
|
61
|
+
"@zhin.js/host-router": {
|
|
65
62
|
"optional": true
|
|
66
63
|
},
|
|
67
|
-
"@zhin.js/
|
|
68
|
-
"optional": true
|
|
69
|
-
},
|
|
70
|
-
"@zhin.js/console": {
|
|
64
|
+
"@zhin.js/host-api": {
|
|
71
65
|
"optional": true
|
|
72
66
|
},
|
|
73
67
|
"@zhin.js/client": {
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveSandboxBot,
|
|
7
7
|
type SandboxWsSocket,
|
|
8
8
|
} from "./sandbox-ws.js";
|
|
9
|
-
import { PageManager } from "@zhin.js/
|
|
9
|
+
import { PageManager } from "@zhin.js/host-api";
|
|
10
10
|
|
|
11
11
|
type SandboxRouter = {
|
|
12
12
|
ws: (path: string) => NonNullable<SandboxAdapter["wss"]>;
|
|
@@ -94,9 +94,6 @@ plugin.useContext("web", (pageManager) => {
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
export {
|
|
98
|
-
registerSandboxWebSocketRoutes,
|
|
99
|
-
} from "./fetch-ws.js";
|
|
100
97
|
export {
|
|
101
98
|
SandboxWsBot,
|
|
102
99
|
SandboxWsHostAdapter,
|
package/lib/fetch-ws.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type RouteTable } from "@zhin.js/http-host";
|
|
2
|
-
import type { SandboxWsHostAdapter } from "./sandbox-ws.js";
|
|
3
|
-
/**
|
|
4
|
-
* 在 {@link RouteTable} 上注册 `/sandbox` WebSocket。
|
|
5
|
-
*/
|
|
6
|
-
export declare function registerSandboxWebSocketRoutes(table: RouteTable, getAdapter: () => SandboxWsHostAdapter): void;
|
|
7
|
-
//# sourceMappingURL=fetch-ws.d.ts.map
|
package/lib/fetch-ws.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-ws.d.ts","sourceRoot":"","sources":["../src/fetch-ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,iBAAiB,CAAC;AAE7E;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,UAAU,EACjB,UAAU,EAAE,MAAM,oBAAoB,GACrC,IAAI,CAIN"}
|
package/lib/fetch-ws.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { registerWebSocketRoute } from "@zhin.js/http-host";
|
|
2
|
-
/**
|
|
3
|
-
* 在 {@link RouteTable} 上注册 `/sandbox` WebSocket。
|
|
4
|
-
*/
|
|
5
|
-
export function registerSandboxWebSocketRoutes(table, getAdapter) {
|
|
6
|
-
registerWebSocketRoute(table, "/sandbox", (ws) => {
|
|
7
|
-
getAdapter().acceptWebSocket(ws);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=fetch-ws.js.map
|
package/lib/fetch-ws.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-ws.js","sourceRoot":"","sources":["../src/fetch-ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,oBAAoB,CAAC;AAG7E;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,KAAiB,EACjB,UAAsC;IAEtC,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,CAAC,EAAW,EAAE,EAAE;QACxD,UAAU,EAAE,CAAC,eAAe,CAAC,EAAqB,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/src/fetch-ws.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { registerWebSocketRoute, type RouteTable } from "@zhin.js/http-host";
|
|
2
|
-
import type { SandboxWsHostAdapter, SandboxWsSocket } from "./sandbox-ws.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 在 {@link RouteTable} 上注册 `/sandbox` WebSocket。
|
|
6
|
-
*/
|
|
7
|
-
export function registerSandboxWebSocketRoutes(
|
|
8
|
-
table: RouteTable,
|
|
9
|
-
getAdapter: () => SandboxWsHostAdapter,
|
|
10
|
-
): void {
|
|
11
|
-
registerWebSocketRoute(table, "/sandbox", (ws: unknown) => {
|
|
12
|
-
getAdapter().acceptWebSocket(ws as SandboxWsSocket);
|
|
13
|
-
});
|
|
14
|
-
}
|