@opentiny/tiny-robot 0.4.0-alpha.13 → 0.4.0-alpha.15

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/index.js CHANGED
@@ -1,80 +1,76 @@
1
- import F from "./attachments/index.js";
2
- import { B as S, a as b, b as x } from "./index6.js";
3
- import { c as xe, d as Ee, u as ze, e as Ce, f as Pe, g as Ae, h as Le, i as ye, j as Oe } from "./index6.js";
1
+ import z from "./attachments/index.js";
2
+ import { B as b, a as x, b as S } from "./index2.js";
3
+ import { c as ve, d as fe, u as _e, e as ge, f as he, g as De, h as Te, i as Fe, j as ze } from "./index2.js";
4
4
  import E from "./container/index.js";
5
- import z from "./conversations/index.js";
6
- import C from "./drag-overlay/index.js";
7
- import P from "./dropdown-menu/index.js";
8
- import A from "./feedback/index.js";
9
- import { H as L } from "./index7.js";
10
- import { u as je } from "./index7.js";
11
- import y from "./icon-button/index.js";
12
- import { Prompt as O, Prompts as M } from "./prompts/index.js";
13
- import j from "./sender/index.js";
14
- import H from "./sender-compat/index.js";
15
- import R, { SuggestionPillButton as W } from "./suggestion-pills/index.js";
5
+ import P from "./conversations/index.js";
6
+ import B from "./drag-overlay/index.js";
7
+ import C from "./dropdown-menu/index.js";
8
+ import L from "./feedback/index.js";
9
+ import { H as y } from "./index3.js";
10
+ import { u as xe } from "./index3.js";
11
+ import O from "./icon-button/index.js";
12
+ import { Prompt as M, Prompts as j } from "./prompts/index.js";
13
+ import A from "./sender/index.js";
14
+ import H, { SuggestionPillButton as R } from "./suggestion-pills/index.js";
16
15
  import w from "./suggestion-popover/index.js";
17
- import $ from "./theme-provider/index.js";
18
- import { useTheme as Re } from "./theme-provider/index.js";
19
- import k from "./welcome/index.js";
20
- import N from "./mcp-server-picker/index.js";
21
- import V from "./mcp-add-form/index.js";
22
- import { A as I, S as U, _ as K, W as X, D as Y } from "./index2.js";
23
- import { a as we, u as $e } from "./index2.js";
24
- import { _ as q, V as G } from "./index3.js";
25
- var u = /* @__PURE__ */ ((e) => (e.FileTypeNotAllowed = "file-type-not-allowed", e.FileSizeExceeded = "file-size-exceeded", e.FileCountExceeded = "file-count-exceeded", e))(u || {});
26
- function J(e, r) {
16
+ import k from "./theme-provider/index.js";
17
+ import { useTheme as Ee } from "./theme-provider/index.js";
18
+ import W from "./welcome/index.js";
19
+ import $ from "./mcp-server-picker/index.js";
20
+ import I from "./mcp-add-form/index.js";
21
+ var d = /* @__PURE__ */ ((e) => (e.FileTypeNotAllowed = "file-type-not-allowed", e.FileSizeExceeded = "file-size-exceeded", e.FileCountExceeded = "file-count-exceeded", e))(d || {});
22
+ function N(e, r) {
27
23
  if (!r) return !0;
28
- const o = r.split(",").map((t) => t.trim());
29
- return o.includes("*") ? !0 : o.some((t) => {
30
- if (t.startsWith("."))
31
- return e.name.toLowerCase().endsWith(t.toLowerCase());
32
- if (t.includes("/*")) {
33
- const a = t.split("/")[0];
34
- return e.type.startsWith(a + "/");
24
+ const t = r.split(",").map((o) => o.trim());
25
+ return t.includes("*") ? !0 : t.some((o) => {
26
+ if (o.startsWith("."))
27
+ return e.name.toLowerCase().endsWith(o.toLowerCase());
28
+ if (o.includes("/*")) {
29
+ const s = o.split("/")[0];
30
+ return e.type.startsWith(s + "/");
35
31
  } else
36
- return e.type === t;
32
+ return e.type === o;
37
33
  });
38
34
  }
39
- function v(e, r) {
35
+ function _(e, r) {
40
36
  return e.size <= r;
41
37
  }
42
- function Q(e, r) {
38
+ function q(e, r) {
43
39
  return e.length <= r;
44
40
  }
45
- function Z(e, r) {
46
- const { accept: o, multiple: t, maxSize: a, maxFiles: l } = r, n = [], s = [];
47
- if (!Q(e, l))
41
+ function G(e, r) {
42
+ const { accept: t, multiple: o, maxSize: s, maxFiles: l } = r, n = [], a = [];
43
+ if (!q(e, l))
48
44
  return {
49
45
  acceptedFiles: n,
50
46
  rejectedFiles: Array.from(e),
51
47
  rejectionReason: {
52
- code: u.FileCountExceeded,
48
+ code: d.FileCountExceeded,
53
49
  message: `文件数量不能超过 ${l} 个`
54
50
  }
55
51
  };
56
52
  if (e.forEach((i) => {
57
- J(i, o) && v(i, a) ? n.push(i) : s.push(i);
58
- }), !t && n.length > 1)
53
+ N(i, t) && _(i, s) ? n.push(i) : a.push(i);
54
+ }), !o && n.length > 1)
59
55
  return {
60
56
  acceptedFiles: [],
61
57
  rejectedFiles: n,
62
58
  rejectionReason: {
63
- code: u.FileCountExceeded,
59
+ code: d.FileCountExceeded,
64
60
  message: "只允许上传一个文件"
65
61
  }
66
62
  };
67
- if (s.length > 0) {
68
- const i = s.some((p) => !v(p, a)), d = i ? u.FileSizeExceeded : u.FileTypeNotAllowed, m = i ? `文件大小不能超过 ${a / 1024 / 1024}MB` : `文件类型不匹配 (accept: ${o})`;
63
+ if (a.length > 0) {
64
+ const i = a.some((m) => !_(m, s)), u = i ? d.FileSizeExceeded : d.FileTypeNotAllowed, p = i ? `文件大小不能超过 ${s / 1024 / 1024}MB` : `文件类型不匹配 (accept: ${t})`;
69
65
  return {
70
66
  acceptedFiles: n,
71
- rejectedFiles: s,
72
- rejectionReason: { code: d, message: m }
67
+ rejectedFiles: a,
68
+ rejectionReason: { code: u, message: p }
73
69
  };
74
70
  }
75
- return { acceptedFiles: n, rejectedFiles: s, rejectionReason: null };
71
+ return { acceptedFiles: n, rejectedFiles: a, rejectionReason: null };
76
72
  }
77
- function T(e) {
73
+ function g(e) {
78
74
  return {
79
75
  accept: e.accept || "*",
80
76
  multiple: e.multiple ?? !0,
@@ -85,35 +81,35 @@ function T(e) {
85
81
  disabled: e.disabled || !1
86
82
  };
87
83
  }
88
- const Be = {
84
+ const ue = {
89
85
  /**
90
86
  * 挂载指令
91
87
  * @param el 元素
92
88
  * @param binding 绑定
93
89
  */
94
90
  mounted(e, r) {
95
- let o = 0;
96
- const { disabled: t, onDraggingChange: a } = r.value;
97
- e.__vDropzoneOptions__ = T(r.value);
91
+ let t = 0;
92
+ const { disabled: o, onDraggingChange: s } = r.value;
93
+ e.__vDropzoneOptions__ = g(r.value);
98
94
  const l = {
99
95
  /**
100
96
  * 拖拽进入
101
97
  */
102
98
  handleDragEnter: () => {
103
- t || (o++, o === 1 && a(!0, e));
99
+ o || (t++, t === 1 && s(!0, e));
104
100
  },
105
101
  /**
106
102
  * 拖拽覆盖
107
103
  * @param e 事件
108
104
  */
109
105
  handleDragOver: (n) => {
110
- t || n.preventDefault();
106
+ o || n.preventDefault();
111
107
  },
112
108
  /**
113
109
  * 拖拽离开
114
110
  */
115
111
  handleDragLeave: () => {
116
- t || (o--, o === 0 && a(!1, null));
112
+ o || (t--, t === 0 && s(!1, null));
117
113
  },
118
114
  /**
119
115
  * 拖拽放下
@@ -121,24 +117,24 @@ const Be = {
121
117
  */
122
118
  handleDrop: (n) => {
123
119
  var c;
124
- if (t) return;
125
- n.preventDefault(), o = 0, a(!1, null);
126
- const s = (c = n.dataTransfer) == null ? void 0 : c.files, { onDrop: i, onError: d, accept: m, multiple: p, maxSize: D, maxFiles: g } = e.__vDropzoneOptions__;
127
- if (s && s.length > 0) {
128
- const h = Array.from(s), { acceptedFiles: f, rejectedFiles: B, rejectionReason: _ } = Z(h, {
129
- accept: m,
130
- multiple: p,
131
- maxSize: D,
132
- maxFiles: g
120
+ if (o) return;
121
+ n.preventDefault(), t = 0, s(!1, null);
122
+ const a = (c = n.dataTransfer) == null ? void 0 : c.files, { onDrop: i, onError: u, accept: p, multiple: m, maxSize: h, maxFiles: D } = e.__vDropzoneOptions__;
123
+ if (a && a.length > 0) {
124
+ const T = Array.from(a), { acceptedFiles: v, rejectedFiles: F, rejectionReason: f } = G(T, {
125
+ accept: p,
126
+ multiple: m,
127
+ maxSize: h,
128
+ maxFiles: D
133
129
  });
134
- _ && d({ files: B, ..._ }), f.length > 0 && i(f);
130
+ f && u({ files: F, ...f }), v.length > 0 && i(v);
135
131
  }
136
132
  }
137
133
  };
138
134
  e.__vDropzoneHandlers__ = l, e.addEventListener("dragenter", l.handleDragEnter), e.addEventListener("dragover", l.handleDragOver), e.addEventListener("dragleave", l.handleDragLeave), e.addEventListener("drop", l.handleDrop);
139
135
  },
140
136
  updated(e, r) {
141
- e.__vDropzoneOptions__ && (e.__vDropzoneOptions__ = T(r.value));
137
+ e.__vDropzoneOptions__ && (e.__vDropzoneOptions__ = g(r.value));
142
138
  },
143
139
  /**
144
140
  * 卸载指令
@@ -147,116 +143,90 @@ const Be = {
147
143
  unmounted(e) {
148
144
  e.__vDropzoneHandlers__ && (e.removeEventListener("dragenter", e.__vDropzoneHandlers__.handleDragEnter), e.removeEventListener("dragover", e.__vDropzoneHandlers__.handleDragOver), e.removeEventListener("dragleave", e.__vDropzoneHandlers__.handleDragLeave), e.removeEventListener("drop", e.__vDropzoneHandlers__.handleDrop), delete e.__vDropzoneHandlers__), delete e.__vDropzoneOptions__;
149
145
  }
150
- }, ee = [
151
- F,
152
- S,
146
+ }, J = [
147
+ z,
153
148
  b,
154
149
  x,
150
+ S,
155
151
  E,
156
- z,
157
- C,
158
152
  P,
159
- A,
153
+ B,
154
+ C,
160
155
  L,
161
156
  y,
162
157
  O,
163
158
  M,
164
159
  j,
160
+ A,
165
161
  H,
166
162
  R,
167
- W,
168
163
  w,
169
- $,
170
164
  k,
171
- N,
172
- V,
173
- I,
174
- U,
175
- K,
176
- q,
177
- G,
178
- X,
179
- Y
180
- ], Fe = {
165
+ W,
166
+ $,
167
+ I
168
+ ], pe = {
181
169
  install(e) {
182
- ee.forEach((r) => {
183
- const o = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
184
- e.component(`Tr${o}`, r);
170
+ J.forEach((r) => {
171
+ const t = r.name.replace(/^Tiny/, "").replace(/^Tr/, "");
172
+ e.component(`Tr${t}`, r);
185
173
  });
186
174
  }
187
175
  };
188
176
  export {
189
- I as ActionButton,
190
- F as Attachments,
191
- S as Bubble,
192
- b as BubbleList,
193
- x as BubbleProvider,
194
- xe as BubbleRendererMatchPriority,
195
- Ee as BubbleRenderers,
196
- K as ClearButton,
177
+ z as Attachments,
178
+ b as Bubble,
179
+ x as BubbleList,
180
+ S as BubbleProvider,
181
+ ve as BubbleRendererMatchPriority,
182
+ fe as BubbleRenderers,
197
183
  E as Container,
198
- z as Conversations,
199
- Y as DefaultActionButtons,
200
- C as DragOverlay,
201
- P as DropdownMenu,
202
- A as Feedback,
203
- L as History,
204
- y as IconButton,
205
- V as McpAddForm,
206
- N as McpServerPicker,
207
- O as Prompt,
208
- M as Prompts,
209
- we as SENDER_CONTEXT_KEY,
210
- j as Sender,
211
- H as SenderCompat,
212
- U as SubmitButton,
213
- W as SuggestionPillButton,
214
- R as SuggestionPills,
184
+ P as Conversations,
185
+ B as DragOverlay,
186
+ C as DropdownMenu,
187
+ L as Feedback,
188
+ y as History,
189
+ O as IconButton,
190
+ I as McpAddForm,
191
+ $ as McpServerPicker,
192
+ M as Prompt,
193
+ j as Prompts,
194
+ A as Sender,
195
+ R as SuggestionPillButton,
196
+ H as SuggestionPills,
215
197
  w as SuggestionPopover,
216
- $ as ThemeProvider,
217
- I as TrActionButton,
218
- F as TrAttachments,
219
- S as TrBubble,
220
- b as TrBubbleList,
221
- x as TrBubbleProvider,
222
- K as TrClearButton,
198
+ k as ThemeProvider,
199
+ z as TrAttachments,
200
+ b as TrBubble,
201
+ x as TrBubbleList,
202
+ S as TrBubbleProvider,
223
203
  E as TrContainer,
224
- z as TrConversations,
225
- Y as TrDefaultActionButtons,
226
- C as TrDragOverlay,
227
- P as TrDropdownMenu,
228
- A as TrFeedback,
229
- L as TrHistory,
230
- y as TrIconButton,
231
- V as TrMcpAddForm,
232
- N as TrMcpServerPicker,
233
- O as TrPrompt,
234
- M as TrPrompts,
235
- j as TrSender,
236
- H as TrSenderCompat,
237
- U as TrSubmitButton,
238
- W as TrSuggestionPillButton,
239
- R as TrSuggestionPills,
204
+ P as TrConversations,
205
+ B as TrDragOverlay,
206
+ C as TrDropdownMenu,
207
+ L as TrFeedback,
208
+ y as TrHistory,
209
+ O as TrIconButton,
210
+ I as TrMcpAddForm,
211
+ $ as TrMcpServerPicker,
212
+ M as TrPrompt,
213
+ j as TrPrompts,
214
+ A as TrSender,
215
+ R as TrSuggestionPillButton,
216
+ H as TrSuggestionPills,
240
217
  w as TrSuggestionPopover,
241
- $ as TrThemeProvider,
242
- q as TrUploadButton,
243
- G as TrVoiceButton,
244
- k as TrWelcome,
245
- X as TrWordCounter,
246
- q as UploadButton,
247
- G as VoiceButton,
248
- k as Welcome,
249
- X as WordCounter,
250
- Fe as default,
251
- ze as useAutoScroll,
252
- Ce as useBubbleBoxRenderer,
253
- Pe as useBubbleContentRenderer,
254
- Ae as useBubbleStateChangeFn,
255
- Le as useMessageContent,
256
- ye as useOmitMessageFields,
257
- $e as useSenderContext,
258
- Re as useTheme,
259
- Oe as useToolCall,
260
- je as useTouchDevice,
261
- Be as vDropzone
218
+ k as TrThemeProvider,
219
+ W as TrWelcome,
220
+ W as Welcome,
221
+ pe as default,
222
+ _e as useAutoScroll,
223
+ ge as useBubbleBoxRenderer,
224
+ he as useBubbleContentRenderer,
225
+ De as useBubbleStateChangeFn,
226
+ Te as useMessageContent,
227
+ Fe as useOmitMessageFields,
228
+ Ee as useTheme,
229
+ ze as useToolCall,
230
+ xe as useTouchDevice,
231
+ ue as vDropzone
262
232
  };