@opentiny/tiny-robot 0.4.0-alpha.2 → 0.4.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bubble/index.js +12 -10
- package/dist/index.d.ts +147 -64
- package/dist/index.js +31 -29
- package/dist/index2.js +605 -501
- package/dist/mcp-server-picker/index.js +58 -57
- package/dist/sender/index.js +548 -540
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, ref as V, computed as g, createElementBlock as n, openBlock as a, normalizeClass as G, createElementVNode as s, createBlock as k, createCommentVNode as v, toDisplayString as x, renderSlot as
|
|
1
|
+
import { defineComponent as q, ref as V, computed as g, createElementBlock as n, openBlock as a, normalizeClass as G, createElementVNode as s, createBlock as k, createCommentVNode as v, toDisplayString as x, renderSlot as D, Fragment as F, unref as d, createVNode as _, withCtx as T, Transition as K, withDirectives as pe, renderList as N, vShow as ge, mergeModels as J, useModel as ae, watch as H, normalizeStyle as me, createTextVNode as _e } from "vue";
|
|
2
2
|
import { TinyPopconfirm as ve, TinySwitch as X, TinyTabs as fe, TinyTabItem as Y, TinyInput as Z, TinyBaseSelect as he, TinyOption as ye } from "@opentiny/vue";
|
|
3
3
|
import { IconArrowRight as ke, IconArrowDown as be, IconDelete as Te, IconClose as oe, IconEmptySearch as Ce, IconPlus as Pe, IconSearch as ee } from "@opentiny/tiny-robot-svgs";
|
|
4
4
|
import { _ as z } from "../_plugin-vue_export-helper.js";
|
|
@@ -35,20 +35,20 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
35
35
|
}, S = g(() => {
|
|
36
36
|
if (!h.value)
|
|
37
37
|
return { checked: e.plugin.enabled || !1, indeterminate: !1 };
|
|
38
|
-
const c = e.plugin.tools.filter((y) => y.enabled),
|
|
39
|
-
return c.length === 0 ? { checked: !1, indeterminate: !1 } : c.length ===
|
|
38
|
+
const c = e.plugin.tools.filter((y) => y.enabled), m = e.plugin.tools.length;
|
|
39
|
+
return c.length === 0 ? { checked: !1, indeterminate: !1 } : c.length === m ? { checked: !0, indeterminate: !1 } : { checked: !0, indeterminate: !0 };
|
|
40
40
|
}), Q = (c) => {
|
|
41
|
-
h.value && e.plugin.tools.forEach((
|
|
42
|
-
|
|
41
|
+
h.value && e.plugin.tools.forEach((m) => {
|
|
42
|
+
m.enabled !== c && (m.enabled = c, r("toggle-tool", m.id, c));
|
|
43
43
|
}), r("toggle-plugin", c);
|
|
44
|
-
}, R = (c,
|
|
45
|
-
r("toggle-tool", c,
|
|
46
|
-
},
|
|
44
|
+
}, R = (c, m) => {
|
|
45
|
+
r("toggle-tool", c, m);
|
|
46
|
+
}, I = () => {
|
|
47
47
|
r("delete-plugin");
|
|
48
|
-
}, $ = g(() => e.plugin.addState || "idle"),
|
|
48
|
+
}, $ = g(() => e.plugin.addState || "idle"), E = (c) => {
|
|
49
49
|
$.value === "idle" && r("add-plugin", c);
|
|
50
|
-
},
|
|
51
|
-
return (c,
|
|
50
|
+
}, L = (c) => c ? "关闭插件" : "打开插件";
|
|
51
|
+
return (c, m) => (a(), n("div", {
|
|
52
52
|
class: G(["plugin-card", C.value])
|
|
53
53
|
}, [
|
|
54
54
|
s("div", $e, [
|
|
@@ -67,7 +67,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
67
67
|
}, x(i.plugin.description), 9, De)
|
|
68
68
|
]),
|
|
69
69
|
s("div", Ie, [
|
|
70
|
-
|
|
70
|
+
D(c.$slots, "actions", {
|
|
71
71
|
plugin: i.plugin,
|
|
72
72
|
expanded: u.value,
|
|
73
73
|
mode: i.mode
|
|
@@ -78,7 +78,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
78
78
|
class: "plugin-card__expand",
|
|
79
79
|
onClick: w
|
|
80
80
|
}, [
|
|
81
|
-
|
|
81
|
+
D(c.$slots, "expand-icon", { expanded: u.value }, () => [
|
|
82
82
|
u.value ? (a(), k(d(be), {
|
|
83
83
|
key: 1,
|
|
84
84
|
class: "common-icon"
|
|
@@ -89,37 +89,37 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
89
89
|
], !0)
|
|
90
90
|
])) : v("", !0),
|
|
91
91
|
s("div", Ee, [
|
|
92
|
-
|
|
92
|
+
_(d(ve), {
|
|
93
93
|
title: "确定移除该插件吗?",
|
|
94
94
|
style: { height: "16px" },
|
|
95
95
|
type: "info",
|
|
96
|
-
onConfirm:
|
|
96
|
+
onConfirm: I,
|
|
97
97
|
trigger: "click"
|
|
98
98
|
}, {
|
|
99
99
|
reference: T(() => [
|
|
100
|
-
|
|
100
|
+
D(c.$slots, "delete-icon", {}, () => [
|
|
101
101
|
s("span", Le, [
|
|
102
|
-
|
|
102
|
+
_(d(Te), { class: "common-icon delete" })
|
|
103
103
|
])
|
|
104
104
|
], !0)
|
|
105
105
|
]),
|
|
106
106
|
_: 3
|
|
107
107
|
}),
|
|
108
|
-
|
|
109
|
-
title:
|
|
108
|
+
_(d(X), {
|
|
109
|
+
title: L(S.value.checked),
|
|
110
110
|
"model-value": S.value.checked,
|
|
111
111
|
indeterminate: S.value.indeterminate,
|
|
112
112
|
"onUpdate:modelValue": Q
|
|
113
113
|
}, null, 8, ["title", "model-value", "indeterminate"])
|
|
114
114
|
])
|
|
115
115
|
], 64)) : i.mode === "market" ? (a(), n("div", Ue, [
|
|
116
|
-
|
|
116
|
+
D(c.$slots, "add-button", {}, () => [
|
|
117
117
|
s("div", {
|
|
118
118
|
class: G(["plugin-card__add-button", {
|
|
119
119
|
"plugin-card__add-button--loading": $.value === "loading",
|
|
120
120
|
"plugin-card__add-button--added": $.value === "added"
|
|
121
121
|
}]),
|
|
122
|
-
onClick:
|
|
122
|
+
onClick: m[0] || (m[0] = (y) => E(i.plugin))
|
|
123
123
|
}, [
|
|
124
124
|
$.value === "idle" ? (a(), n("span", Ne, "添加")) : $.value === "loading" ? (a(), n("span", Oe, "添加中")) : (a(), n("span", qe, "已添加"))
|
|
125
125
|
], 2)
|
|
@@ -134,15 +134,15 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
134
134
|
}, {
|
|
135
135
|
default: T(() => [
|
|
136
136
|
pe(s("div", ze, [
|
|
137
|
-
|
|
137
|
+
m[2] || (m[2] = s("div", { class: "plugin-card__divider" }, null, -1)),
|
|
138
138
|
(a(!0), n(F, null, N(i.plugin.tools, (y, A) => {
|
|
139
|
-
var
|
|
139
|
+
var U;
|
|
140
140
|
return a(), n("div", {
|
|
141
141
|
key: y.id,
|
|
142
142
|
class: "plugin-card__tool-item"
|
|
143
143
|
}, [
|
|
144
144
|
s("div", Qe, [
|
|
145
|
-
|
|
145
|
+
m[1] || (m[1] = s("div", { class: "plugin-card__icon plugin-card__icon--placeholder" }, null, -1)),
|
|
146
146
|
s("div", Re, [
|
|
147
147
|
s("div", je, [
|
|
148
148
|
s("span", He, x(y.name), 1)
|
|
@@ -153,14 +153,14 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
153
153
|
}, x(y.description), 9, Ge)
|
|
154
154
|
]),
|
|
155
155
|
s("div", Je, [
|
|
156
|
-
|
|
157
|
-
title:
|
|
156
|
+
_(d(X), {
|
|
157
|
+
title: L(y.enabled),
|
|
158
158
|
"model-value": y.enabled,
|
|
159
159
|
"onUpdate:modelValue": (j) => R(y.id, j)
|
|
160
160
|
}, null, 8, ["title", "model-value", "onUpdate:modelValue"])
|
|
161
161
|
])
|
|
162
162
|
]),
|
|
163
|
-
A < (((
|
|
163
|
+
A < (((U = i.plugin.tools) == null ? void 0 : U.length) || 0) - 1 ? (a(), n("div", Ke)) : v("", !0)
|
|
164
164
|
]);
|
|
165
165
|
}), 128))
|
|
166
166
|
], 512), [
|
|
@@ -193,7 +193,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
193
193
|
};
|
|
194
194
|
return (C, w) => (a(), n(F, null, [
|
|
195
195
|
r.value ? (a(), n("div", Xe)) : v("", !0),
|
|
196
|
-
|
|
196
|
+
_(K, { name: "plugin-editor" }, {
|
|
197
197
|
default: T(() => [
|
|
198
198
|
r.value ? (a(), n("div", {
|
|
199
199
|
key: 0,
|
|
@@ -203,12 +203,12 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
203
203
|
}, [
|
|
204
204
|
s("div", Ye, [
|
|
205
205
|
w[0] || (w[0] = s("h3", { class: "plugin-editor__title" }, "添加插件", -1)),
|
|
206
|
-
|
|
206
|
+
_(d(oe), {
|
|
207
207
|
class: "plugin-editor__close",
|
|
208
208
|
onClick: f
|
|
209
209
|
})
|
|
210
210
|
]),
|
|
211
|
-
|
|
211
|
+
_(d(Se), {
|
|
212
212
|
onConfirm: h,
|
|
213
213
|
onCancel: f
|
|
214
214
|
})
|
|
@@ -259,10 +259,10 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
259
259
|
}, gt = {
|
|
260
260
|
key: 0,
|
|
261
261
|
style: { width: "168px" }
|
|
262
|
-
},
|
|
262
|
+
}, mt = {
|
|
263
263
|
key: 1,
|
|
264
264
|
style: { width: "264px", "flex-shrink": "0" }
|
|
265
|
-
},
|
|
265
|
+
}, _t = {
|
|
266
266
|
key: 1,
|
|
267
267
|
class: "mcp-server-picker__content-list"
|
|
268
268
|
}, vt = {
|
|
@@ -319,7 +319,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
319
319
|
), H(u, (t, o) => {
|
|
320
320
|
t !== o && r("tab-change", t);
|
|
321
321
|
});
|
|
322
|
-
const
|
|
322
|
+
const I = g(() => S.value.filter((t) => e.installedSearchFn(f.value, t))), $ = g(() => {
|
|
323
323
|
const { category: t, search: o } = {
|
|
324
324
|
category: C.value,
|
|
325
325
|
search: h.value
|
|
@@ -328,11 +328,11 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
328
328
|
return P && B;
|
|
329
329
|
};
|
|
330
330
|
return Q.value.filter(p);
|
|
331
|
-
}),
|
|
331
|
+
}), E = g(() => u.value === "installed" ? I.value.length > 0 : $.value.length > 0);
|
|
332
332
|
H(C, (t) => {
|
|
333
333
|
r("market-category-change", t);
|
|
334
334
|
});
|
|
335
|
-
const
|
|
335
|
+
const L = (t, o) => {
|
|
336
336
|
var p;
|
|
337
337
|
e.allowPluginToggle && (r("plugin-toggle", t, o), (p = t.tools) != null && p.length && (o ? t.tools.filter((P) => P.enabled).length === 0 && t.tools.forEach((P) => {
|
|
338
338
|
r("tool-toggle", t, P.id, !0);
|
|
@@ -345,11 +345,11 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
345
345
|
const P = t.tools.filter((M) => M.id !== o).some((M) => M.enabled), B = p || P;
|
|
346
346
|
t.enabled !== B && r("plugin-toggle", t, B);
|
|
347
347
|
}
|
|
348
|
-
},
|
|
348
|
+
}, m = (t) => {
|
|
349
349
|
e.allowPluginDelete && r("plugin-delete", t);
|
|
350
350
|
}, y = (t) => {
|
|
351
351
|
e.allowPluginAdd && r("plugin-add", t);
|
|
352
|
-
}, A = V(!1),
|
|
352
|
+
}, A = V(!1), U = () => {
|
|
353
353
|
A.value = !0;
|
|
354
354
|
}, j = (t, o) => {
|
|
355
355
|
r("plugin-create", t, o), A.value = !1;
|
|
@@ -408,27 +408,28 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
408
408
|
ne.value ? (a(), n("div", {
|
|
409
409
|
key: 0,
|
|
410
410
|
class: G(["mcp-server-picker", [`popup-type-${((p = e.popupConfig) == null ? void 0 : p.type) || "fixed"}`, W.value]]),
|
|
411
|
-
style:
|
|
411
|
+
style: me(se.value)
|
|
412
412
|
}, [
|
|
413
413
|
s("div", nt, [
|
|
414
414
|
s("div", it, x(e.title), 1),
|
|
415
415
|
s("div", st, [
|
|
416
|
+
D(t.$slots, "header-actions", {}, void 0, !0),
|
|
416
417
|
e.showCustomAddButton ? (a(), n("div", {
|
|
417
418
|
key: 0,
|
|
418
419
|
class: "mcp-server-picker__header-right-item",
|
|
419
|
-
onClick:
|
|
420
|
+
onClick: U
|
|
420
421
|
}, [
|
|
421
|
-
|
|
422
|
+
_(d(Pe), { class: "mcp-server-picker__icon" }),
|
|
422
423
|
s("span", null, x(e.customAddButtonText), 1)
|
|
423
424
|
])) : v("", !0),
|
|
424
|
-
|
|
425
|
+
_(d(oe), {
|
|
425
426
|
class: "mcp-server-picker__header-right-close",
|
|
426
427
|
onClick: ie
|
|
427
428
|
})
|
|
428
429
|
])
|
|
429
430
|
]),
|
|
430
431
|
s("div", rt, [
|
|
431
|
-
|
|
432
|
+
_(d(fe), {
|
|
432
433
|
modelValue: u.value,
|
|
433
434
|
"onUpdate:modelValue": o[3] || (o[3] = (l) => u.value = l)
|
|
434
435
|
}, {
|
|
@@ -440,28 +441,28 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
440
441
|
}, {
|
|
441
442
|
default: T(() => [
|
|
442
443
|
e.enableSearch ? (a(), n("div", dt, [
|
|
443
|
-
|
|
444
|
+
_(d(Z), {
|
|
444
445
|
modelValue: f.value,
|
|
445
446
|
"onUpdate:modelValue": o[0] || (o[0] = (l) => f.value = l),
|
|
446
447
|
placeholder: e.searchPlaceholder
|
|
447
448
|
}, {
|
|
448
449
|
suffix: T(() => [
|
|
449
|
-
|
|
450
|
+
_(d(ee), { class: "mcp-server-picker__icon" })
|
|
450
451
|
]),
|
|
451
452
|
_: 1
|
|
452
453
|
}, 8, ["modelValue", "placeholder"])
|
|
453
454
|
])) : v("", !0),
|
|
454
|
-
|
|
455
|
-
e.loading ? (a(), n("div", ut, "加载中...")) : (a(!0), n(F, { key: 1 }, N(
|
|
455
|
+
E.value ? (a(), n("div", ct, [
|
|
456
|
+
e.loading ? (a(), n("div", ut, "加载中...")) : (a(!0), n(F, { key: 1 }, N(I.value, (l) => {
|
|
456
457
|
var P;
|
|
457
458
|
return a(), k(d(te), {
|
|
458
459
|
key: l.id,
|
|
459
460
|
plugin: l,
|
|
460
461
|
mode: "installed",
|
|
461
462
|
expandable: !!((P = l.tools) != null && P.length),
|
|
462
|
-
onTogglePlugin: (B) =>
|
|
463
|
+
onTogglePlugin: (B) => L(l, B),
|
|
463
464
|
onToggleTool: (B, M) => c(l, B, M),
|
|
464
|
-
onDeletePlugin: () =>
|
|
465
|
+
onDeletePlugin: () => m(l)
|
|
465
466
|
}, null, 8, ["plugin", "expandable", "onTogglePlugin", "onToggleTool", "onDeletePlugin"]);
|
|
466
467
|
}), 128))
|
|
467
468
|
])) : (a(), k(d(le), {
|
|
@@ -479,7 +480,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
479
480
|
default: T(() => [
|
|
480
481
|
e.enableSearch || e.enableMarketCategoryFilter ? (a(), n("div", pt, [
|
|
481
482
|
e.enableMarketCategoryFilter ? (a(), n("div", gt, [
|
|
482
|
-
|
|
483
|
+
_(d(he), {
|
|
483
484
|
modelValue: C.value,
|
|
484
485
|
"onUpdate:modelValue": o[1] || (o[1] = (l) => C.value = l),
|
|
485
486
|
placeholder: e.marketCategoryPlaceholder,
|
|
@@ -493,7 +494,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
493
494
|
class: "mcp-server-picker__content-market-header-select-option"
|
|
494
495
|
}, {
|
|
495
496
|
default: T(() => [
|
|
496
|
-
|
|
497
|
+
_e(x(l.label), 1)
|
|
497
498
|
]),
|
|
498
499
|
_: 2
|
|
499
500
|
}, 1032, ["label", "value"]))), 128))
|
|
@@ -501,20 +502,20 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
501
502
|
_: 1
|
|
502
503
|
}, 8, ["modelValue", "placeholder"])
|
|
503
504
|
])) : v("", !0),
|
|
504
|
-
e.enableSearch ? (a(), n("div",
|
|
505
|
-
|
|
505
|
+
e.enableSearch ? (a(), n("div", mt, [
|
|
506
|
+
_(d(Z), {
|
|
506
507
|
modelValue: h.value,
|
|
507
508
|
"onUpdate:modelValue": o[2] || (o[2] = (l) => h.value = l),
|
|
508
509
|
placeholder: w.value
|
|
509
510
|
}, {
|
|
510
511
|
suffix: T(() => [
|
|
511
|
-
|
|
512
|
+
_(d(ee), { class: "mcp-server-picker__icon" })
|
|
512
513
|
]),
|
|
513
514
|
_: 1
|
|
514
515
|
}, 8, ["modelValue", "placeholder"])
|
|
515
516
|
])) : v("", !0)
|
|
516
517
|
])) : v("", !0),
|
|
517
|
-
|
|
518
|
+
E.value ? (a(), n("div", _t, [
|
|
518
519
|
e.marketLoading ? (a(), n("div", vt, "加载中...")) : (a(!0), n(F, { key: 1 }, N($.value, (l) => (a(), k(d(te), {
|
|
519
520
|
key: l.id,
|
|
520
521
|
plugin: l,
|
|
@@ -534,7 +535,7 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
534
535
|
_: 1
|
|
535
536
|
}, 8, ["modelValue"])
|
|
536
537
|
]),
|
|
537
|
-
|
|
538
|
+
_(d(et), {
|
|
538
539
|
visible: A.value,
|
|
539
540
|
"onUpdate:visible": o[4] || (o[4] = (l) => A.value = l),
|
|
540
541
|
onConfirm: j
|
|
@@ -542,10 +543,10 @@ const $e = { class: "plugin-card__main" }, Be = ["src"], Ve = { class: "plugin-c
|
|
|
542
543
|
], 6)) : v("", !0)
|
|
543
544
|
];
|
|
544
545
|
}),
|
|
545
|
-
_:
|
|
546
|
+
_: 3
|
|
546
547
|
}, 8, ["name"]));
|
|
547
548
|
}
|
|
548
|
-
}), O = /* @__PURE__ */ z(ft, [["__scopeId", "data-v-
|
|
549
|
+
}), O = /* @__PURE__ */ z(ft, [["__scopeId", "data-v-1708103a"]]);
|
|
549
550
|
O.name = "McpServerPicker";
|
|
550
551
|
const ht = function(i) {
|
|
551
552
|
i.component(O.name, O);
|