@tusi-ai/plugins 0.0.2-beta.1 → 0.0.2-beta.2

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/README.md CHANGED
@@ -43,7 +43,7 @@ const picked = await Filesystem.pickMedia({ mediaType: 'image', maxCount: 1 });
43
43
  | 引入 | 方法 |
44
44
  |---|---|
45
45
  | `@tusi-ai/plugins/camera` | `getPhoto`、`checkPermissions`、`requestPermissions` |
46
- | `@tusi-ai/plugins/filesystem` | `pickMedia`、`saveFile`、`readFile`、`writeFile`、`appendFile`、`deleteFile`、`mkdir`、`rmdir`、`readdir`、`getUri`、`stat`、`rename`、`copy` |
46
+ | `@tusi-ai/plugins/filesystem` | `pickMedia`、`saveFile` |
47
47
  | `@tusi-ai/plugins/geolocation` | `getCurrentPos` |
48
48
  | `@tusi-ai/plugins/contact-picker` | `pickContact` |
49
49
  | `@tusi-ai/plugins/local-notifications` | `schedule`、`cancel`、`getPending` |
@@ -51,8 +51,6 @@ const picked = await Filesystem.pickMedia({ mediaType: 'image', maxCount: 1 });
51
51
  | `@tusi-ai/plugins/clipboard` | `write`、`read` |
52
52
  | `@tusi-ai/plugins/calendar` | `createEventWithPrompt` |
53
53
 
54
- 目录读写使用 `path` + `directory`。`directory` 为 `DOCUMENTS`、`DATA`、`CACHE`、`EXTERNAL`。路径拒绝 `..`。
55
-
56
54
  每个插件目录有 `SKILL.md`,写方法参数和返回值。
57
55
 
58
56
  ## 目录结构
@@ -87,6 +85,6 @@ pnpm --filter @tusi-ai/plugins build
87
85
 
88
86
  ## 硬约束
89
87
 
90
- - 8 个插件、26 个一次性方法。没有 `addListener`、`removeListener`、`removeAllListeners`
88
+ - 8 个插件、15 个一次性方法。没有 `addListener`、`removeListener`、`removeAllListeners`
91
89
  - 浏览器实现在进入 `bridge` 之前选定
92
90
  - 系统差异留在同一个 Native 适配器里,通过 `getNativeHost()` 读取后再分支
@@ -23,7 +23,13 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  function callPlugin(task) {
26
- return Promise.resolve().then(task).then((data) => ({
26
+ let pending;
27
+ try {
28
+ pending = Promise.resolve(task());
29
+ } catch (error) {
30
+ pending = Promise.reject(error);
31
+ }
32
+ return pending.then((data) => ({
27
33
  code: core.ErrorCode.Success,
28
34
  data: data === void 0 ? null : data,
29
35
  errMsg: ""
@@ -21,7 +21,13 @@ var __async = (__this, __arguments, generator) => {
21
21
  });
22
22
  };
23
23
  function callPlugin(task) {
24
- return Promise.resolve().then(task).then((data) => ({
24
+ let pending;
25
+ try {
26
+ pending = Promise.resolve(task());
27
+ } catch (error) {
28
+ pending = Promise.reject(error);
29
+ }
30
+ return pending.then((data) => ({
25
31
  code: ErrorCode.Success,
26
32
  data: data === void 0 ? null : data,
27
33
  errMsg: ""
@@ -23,7 +23,13 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  function callPlugin(task) {
26
- return Promise.resolve().then(task).then((data) => ({
26
+ let pending;
27
+ try {
28
+ pending = Promise.resolve(task());
29
+ } catch (error) {
30
+ pending = Promise.reject(error);
31
+ }
32
+ return pending.then((data) => ({
27
33
  code: core.ErrorCode.Success,
28
34
  data: data === void 0 ? null : data,
29
35
  errMsg: ""
@@ -21,7 +21,13 @@ var __async = (__this, __arguments, generator) => {
21
21
  });
22
22
  };
23
23
  function callPlugin(task) {
24
- return Promise.resolve().then(task).then((data) => ({
24
+ let pending;
25
+ try {
26
+ pending = Promise.resolve(task());
27
+ } catch (error) {
28
+ pending = Promise.reject(error);
29
+ }
30
+ return pending.then((data) => ({
25
31
  code: ErrorCode.Success,
26
32
  data: data === void 0 ? null : data,
27
33
  errMsg: ""
@@ -23,7 +23,13 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  function callPlugin(task) {
26
- return Promise.resolve().then(task).then((data) => ({
26
+ let pending;
27
+ try {
28
+ pending = Promise.resolve(task());
29
+ } catch (error) {
30
+ pending = Promise.reject(error);
31
+ }
32
+ return pending.then((data) => ({
27
33
  code: core.ErrorCode.Success,
28
34
  data: data === void 0 ? null : data,
29
35
  errMsg: ""
@@ -108,28 +114,99 @@ var BrowserClipboardAdapter = class extends ClipboardAdapter {
108
114
  if (value === void 0) {
109
115
  throw new core.TusiError(core.ErrorCode.InvalidParams, "string, image or url is required", "Clipboard.write");
110
116
  }
111
- if (!clipboard()) this.unsupported("write");
112
- yield navigator.clipboard.writeText(value);
117
+ if (canWriteText()) {
118
+ yield navigator.clipboard.writeText(value);
119
+ return;
120
+ }
121
+ if (writeByCommand(value)) return;
122
+ this.unsupported("write");
113
123
  });
114
124
  }
115
125
  read() {
116
126
  return __async(this, null, function* () {
117
- if (!clipboard()) this.unsupported("read");
118
- try {
119
- const value = yield navigator.clipboard.readText();
120
- if (!value) {
121
- throw new core.TusiError(core.ErrorCode.NotFound, "Clipboard is empty", "Clipboard.read");
122
- }
123
- return { value, type: "text/plain" };
124
- } catch (error) {
125
- if (error instanceof core.TusiError) throw error;
126
- throw new core.TusiError(core.ErrorCode.NotFound, "Clipboard read failed", "Clipboard.read", error);
127
+ const value = yield readClipboardText();
128
+ if (!value) {
129
+ throw new core.TusiError(core.ErrorCode.NotFound, "Clipboard is empty", "Clipboard.read");
127
130
  }
131
+ return { value, type: "text/plain" };
128
132
  });
129
133
  }
130
134
  };
131
- function clipboard() {
132
- return typeof navigator !== "undefined" && !!navigator.clipboard;
135
+ function canWriteText() {
136
+ var _a;
137
+ return typeof navigator !== "undefined" && typeof ((_a = navigator.clipboard) == null ? void 0 : _a.writeText) === "function";
138
+ }
139
+ function canReadText() {
140
+ var _a;
141
+ return typeof navigator !== "undefined" && typeof ((_a = navigator.clipboard) == null ? void 0 : _a.readText) === "function";
142
+ }
143
+ function readClipboardText() {
144
+ if (typeof window !== "undefined") window.focus();
145
+ if (isSafari() || !canReadText()) {
146
+ const pasted = readByCommand();
147
+ if (pasted) return Promise.resolve(pasted);
148
+ }
149
+ if (!canReadText()) {
150
+ throw new core.TusiError(core.ErrorCode.Unsupported, "Clipboard.read is not supported", "Clipboard.read");
151
+ }
152
+ return navigator.clipboard.readText().catch((error) => {
153
+ throw new core.TusiError(core.ErrorCode.NotFound, "Clipboard read failed", "Clipboard.read", error);
154
+ });
155
+ }
156
+ function isSafari() {
157
+ const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
158
+ return /safari/i.test(ua) && !/chrome|chromium|crios|android|edg|fxios/i.test(ua);
159
+ }
160
+ function readByCommand() {
161
+ if (typeof document === "undefined" || typeof document.execCommand !== "function" || !document.body) {
162
+ return "";
163
+ }
164
+ const area = document.createElement("textarea");
165
+ area.setAttribute("readonly", "");
166
+ area.style.position = "fixed";
167
+ area.style.top = "0";
168
+ area.style.left = "0";
169
+ area.style.opacity = "0";
170
+ document.body.appendChild(area);
171
+ area.focus();
172
+ let pasted = "";
173
+ const onPaste = (event) => {
174
+ var _a, _b;
175
+ pasted = (_b = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain")) != null ? _b : area.value;
176
+ event.preventDefault();
177
+ };
178
+ area.addEventListener("paste", onPaste);
179
+ try {
180
+ const ok = document.execCommand("paste");
181
+ return pasted || (ok ? area.value : "");
182
+ } catch (e) {
183
+ return pasted;
184
+ } finally {
185
+ area.removeEventListener("paste", onPaste);
186
+ area.remove();
187
+ }
188
+ }
189
+ function writeByCommand(value) {
190
+ if (typeof document === "undefined" || typeof document.execCommand !== "function" || !document.body) {
191
+ return false;
192
+ }
193
+ const area = document.createElement("textarea");
194
+ area.value = value;
195
+ area.setAttribute("readonly", "");
196
+ area.style.position = "fixed";
197
+ area.style.top = "0";
198
+ area.style.left = "0";
199
+ area.style.opacity = "0";
200
+ document.body.appendChild(area);
201
+ area.focus();
202
+ area.select();
203
+ try {
204
+ return document.execCommand("copy");
205
+ } catch (e) {
206
+ return false;
207
+ } finally {
208
+ area.remove();
209
+ }
133
210
  }
134
211
 
135
212
  // src/clipboard/native.ts
@@ -21,7 +21,13 @@ var __async = (__this, __arguments, generator) => {
21
21
  });
22
22
  };
23
23
  function callPlugin(task) {
24
- return Promise.resolve().then(task).then((data) => ({
24
+ let pending;
25
+ try {
26
+ pending = Promise.resolve(task());
27
+ } catch (error) {
28
+ pending = Promise.reject(error);
29
+ }
30
+ return pending.then((data) => ({
25
31
  code: ErrorCode.Success,
26
32
  data: data === void 0 ? null : data,
27
33
  errMsg: ""
@@ -106,28 +112,99 @@ var BrowserClipboardAdapter = class extends ClipboardAdapter {
106
112
  if (value === void 0) {
107
113
  throw new TusiError(ErrorCode.InvalidParams, "string, image or url is required", "Clipboard.write");
108
114
  }
109
- if (!clipboard()) this.unsupported("write");
110
- yield navigator.clipboard.writeText(value);
115
+ if (canWriteText()) {
116
+ yield navigator.clipboard.writeText(value);
117
+ return;
118
+ }
119
+ if (writeByCommand(value)) return;
120
+ this.unsupported("write");
111
121
  });
112
122
  }
113
123
  read() {
114
124
  return __async(this, null, function* () {
115
- if (!clipboard()) this.unsupported("read");
116
- try {
117
- const value = yield navigator.clipboard.readText();
118
- if (!value) {
119
- throw new TusiError(ErrorCode.NotFound, "Clipboard is empty", "Clipboard.read");
120
- }
121
- return { value, type: "text/plain" };
122
- } catch (error) {
123
- if (error instanceof TusiError) throw error;
124
- throw new TusiError(ErrorCode.NotFound, "Clipboard read failed", "Clipboard.read", error);
125
+ const value = yield readClipboardText();
126
+ if (!value) {
127
+ throw new TusiError(ErrorCode.NotFound, "Clipboard is empty", "Clipboard.read");
125
128
  }
129
+ return { value, type: "text/plain" };
126
130
  });
127
131
  }
128
132
  };
129
- function clipboard() {
130
- return typeof navigator !== "undefined" && !!navigator.clipboard;
133
+ function canWriteText() {
134
+ var _a;
135
+ return typeof navigator !== "undefined" && typeof ((_a = navigator.clipboard) == null ? void 0 : _a.writeText) === "function";
136
+ }
137
+ function canReadText() {
138
+ var _a;
139
+ return typeof navigator !== "undefined" && typeof ((_a = navigator.clipboard) == null ? void 0 : _a.readText) === "function";
140
+ }
141
+ function readClipboardText() {
142
+ if (typeof window !== "undefined") window.focus();
143
+ if (isSafari() || !canReadText()) {
144
+ const pasted = readByCommand();
145
+ if (pasted) return Promise.resolve(pasted);
146
+ }
147
+ if (!canReadText()) {
148
+ throw new TusiError(ErrorCode.Unsupported, "Clipboard.read is not supported", "Clipboard.read");
149
+ }
150
+ return navigator.clipboard.readText().catch((error) => {
151
+ throw new TusiError(ErrorCode.NotFound, "Clipboard read failed", "Clipboard.read", error);
152
+ });
153
+ }
154
+ function isSafari() {
155
+ const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
156
+ return /safari/i.test(ua) && !/chrome|chromium|crios|android|edg|fxios/i.test(ua);
157
+ }
158
+ function readByCommand() {
159
+ if (typeof document === "undefined" || typeof document.execCommand !== "function" || !document.body) {
160
+ return "";
161
+ }
162
+ const area = document.createElement("textarea");
163
+ area.setAttribute("readonly", "");
164
+ area.style.position = "fixed";
165
+ area.style.top = "0";
166
+ area.style.left = "0";
167
+ area.style.opacity = "0";
168
+ document.body.appendChild(area);
169
+ area.focus();
170
+ let pasted = "";
171
+ const onPaste = (event) => {
172
+ var _a, _b;
173
+ pasted = (_b = (_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain")) != null ? _b : area.value;
174
+ event.preventDefault();
175
+ };
176
+ area.addEventListener("paste", onPaste);
177
+ try {
178
+ const ok = document.execCommand("paste");
179
+ return pasted || (ok ? area.value : "");
180
+ } catch (e) {
181
+ return pasted;
182
+ } finally {
183
+ area.removeEventListener("paste", onPaste);
184
+ area.remove();
185
+ }
186
+ }
187
+ function writeByCommand(value) {
188
+ if (typeof document === "undefined" || typeof document.execCommand !== "function" || !document.body) {
189
+ return false;
190
+ }
191
+ const area = document.createElement("textarea");
192
+ area.value = value;
193
+ area.setAttribute("readonly", "");
194
+ area.style.position = "fixed";
195
+ area.style.top = "0";
196
+ area.style.left = "0";
197
+ area.style.opacity = "0";
198
+ document.body.appendChild(area);
199
+ area.focus();
200
+ area.select();
201
+ try {
202
+ return document.execCommand("copy");
203
+ } catch (e) {
204
+ return false;
205
+ } finally {
206
+ area.remove();
207
+ }
131
208
  }
132
209
 
133
210
  // src/clipboard/native.ts
@@ -4,7 +4,13 @@ var core = require('@tusi-ai/core');
4
4
 
5
5
  // src/contact-picker/index.ts
6
6
  function callPlugin(task) {
7
- return Promise.resolve().then(task).then((data) => ({
7
+ let pending;
8
+ try {
9
+ pending = Promise.resolve(task());
10
+ } catch (error) {
11
+ pending = Promise.reject(error);
12
+ }
13
+ return pending.then((data) => ({
8
14
  code: core.ErrorCode.Success,
9
15
  data: data === void 0 ? null : data,
10
16
  errMsg: ""
@@ -2,7 +2,13 @@ import { ErrorCode, TusiError, getRuntimeEnv, RuntimeEnv, bridge } from '@tusi-a
2
2
 
3
3
  // src/contact-picker/index.ts
4
4
  function callPlugin(task) {
5
- return Promise.resolve().then(task).then((data) => ({
5
+ let pending;
6
+ try {
7
+ pending = Promise.resolve(task());
8
+ } catch (error) {
9
+ pending = Promise.reject(error);
10
+ }
11
+ return pending.then((data) => ({
6
12
  code: ErrorCode.Success,
7
13
  data: data === void 0 ? null : data,
8
14
  errMsg: ""
@@ -23,7 +23,13 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  function callPlugin(task) {
26
- return Promise.resolve().then(task).then((data) => ({
26
+ let pending;
27
+ try {
28
+ pending = Promise.resolve(task());
29
+ } catch (error) {
30
+ pending = Promise.reject(error);
31
+ }
32
+ return pending.then((data) => ({
27
33
  code: core.ErrorCode.Success,
28
34
  data: data === void 0 ? null : data,
29
35
  errMsg: ""
@@ -124,39 +130,6 @@ var BrowserFilesystemAdapter = class extends FilesystemAdapter {
124
130
  saveFile(options) {
125
131
  return downloadFile(options);
126
132
  }
127
- readFile(_options) {
128
- this.unsupported("readFile");
129
- }
130
- writeFile(_options) {
131
- this.unsupported("writeFile");
132
- }
133
- appendFile(_options) {
134
- this.unsupported("appendFile");
135
- }
136
- deleteFile(_options) {
137
- this.unsupported("deleteFile");
138
- }
139
- mkdir(_options) {
140
- this.unsupported("mkdir");
141
- }
142
- rmdir(_options) {
143
- this.unsupported("rmdir");
144
- }
145
- readdir(_options) {
146
- this.unsupported("readdir");
147
- }
148
- getUri(_options) {
149
- this.unsupported("getUri");
150
- }
151
- stat(_options) {
152
- this.unsupported("stat");
153
- }
154
- rename(_options) {
155
- this.unsupported("rename");
156
- }
157
- copy(_options) {
158
- this.unsupported("copy");
159
- }
160
133
  };
161
134
  function openFileInput(mediaType, maxCount) {
162
135
  return new Promise((resolve) => {
@@ -228,8 +201,12 @@ function downloadFile(options) {
228
201
  const anchor = document.createElement("a");
229
202
  anchor.href = url;
230
203
  anchor.download = fileName;
204
+ anchor.rel = "noopener";
205
+ anchor.style.display = "none";
206
+ document.body.appendChild(anchor);
231
207
  anchor.click();
232
- URL.revokeObjectURL(url);
208
+ anchor.remove();
209
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
233
210
  return {
234
211
  success: true,
235
212
  filePath: fileName,
@@ -285,46 +262,12 @@ var NativeFilesystemAdapter = class extends FilesystemAdapter {
285
262
  saveFile(options) {
286
263
  return this.callNative("saveFile", options);
287
264
  }
288
- readFile(options) {
289
- return this.callNative("readFile", options);
290
- }
291
- writeFile(options) {
292
- return this.callNative("writeFile", options);
293
- }
294
- appendFile(options) {
295
- return this.callNative("appendFile", options);
296
- }
297
- deleteFile(options) {
298
- return this.callNative("deleteFile", options);
299
- }
300
- mkdir(options) {
301
- return this.callNative("mkdir", options);
302
- }
303
- rmdir(options) {
304
- return this.callNative("rmdir", options);
305
- }
306
- readdir(options) {
307
- return this.callNative("readdir", options);
308
- }
309
- getUri(options) {
310
- return this.callNative("getUri", options);
311
- }
312
- stat(options) {
313
- return this.callNative("stat", options);
314
- }
315
- rename(options) {
316
- return this.callNative("rename", options);
317
- }
318
- copy(options) {
319
- return this.callNative("copy", options);
320
- }
321
265
  };
322
266
 
323
267
  // src/filesystem/index.ts
324
268
  var MEDIA_TYPES = ["all", "image", "video", "audio", "file"];
325
269
  var FILE_TYPES = ["image", "video", "audio", "document", "other"];
326
270
  var SOURCE_TYPES = ["url", "base64", "path"];
327
- var DIRECTORIES = ["DOCUMENTS", "DATA", "CACHE", "EXTERNAL"];
328
271
  var adapter;
329
272
  function getAdapter() {
330
273
  adapter != null ? adapter : adapter = core.getRuntimeEnv() === core.RuntimeEnv.Browser ? new BrowserFilesystemAdapter() : new NativeFilesystemAdapter();
@@ -352,26 +295,6 @@ function assertSave(options) {
352
295
  invalid("Filesystem.saveFile", "data is required");
353
296
  }
354
297
  }
355
- function assertDirectory(method, directory) {
356
- if (directory !== void 0 && !DIRECTORIES.includes(directory)) {
357
- invalid(method, "directory is not allowed");
358
- }
359
- }
360
- function assertRelative(method, value, label) {
361
- if (!value || value.startsWith("/") || value.startsWith("\\") || value.split(/[/\\]/).includes("..")) {
362
- invalid(method, `${label} must be a relative path`);
363
- }
364
- }
365
- function assertPath(method, options) {
366
- assertDirectory(method, options == null ? void 0 : options.directory);
367
- assertRelative(method, options == null ? void 0 : options.path, "path");
368
- }
369
- function assertTransfer(method, options) {
370
- assertDirectory(method, options == null ? void 0 : options.directory);
371
- assertDirectory(method, options == null ? void 0 : options.toDirectory);
372
- assertRelative(method, options == null ? void 0 : options.from, "from");
373
- assertRelative(method, options == null ? void 0 : options.to, "to");
374
- }
375
298
  var Filesystem = {
376
299
  /**
377
300
  * 打开系统选择器。
@@ -396,91 +319,6 @@ var Filesystem = {
396
319
  assertSave(options);
397
320
  return getAdapter().saveFile(options);
398
321
  }));
399
- },
400
- /** 读取应用目录里的文件。浏览器不提供这些目录。 */
401
- readFile(options) {
402
- return callPlugin(() => __async(null, null, function* () {
403
- assertPath("Filesystem.readFile", options);
404
- return getAdapter().readFile(options);
405
- }));
406
- },
407
- /** 写入应用目录。 */
408
- writeFile(options) {
409
- return callPlugin(() => __async(null, null, function* () {
410
- assertPath("Filesystem.writeFile", options);
411
- if (options.data === void 0) invalid("Filesystem.writeFile", "data is required");
412
- return getAdapter().writeFile(options);
413
- }));
414
- },
415
- /** 向已有文件追加内容。 */
416
- appendFile(options) {
417
- return callPlugin(() => __async(null, null, function* () {
418
- assertPath("Filesystem.appendFile", options);
419
- if (options.data === void 0) invalid("Filesystem.appendFile", "data is required");
420
- yield getAdapter().appendFile(options);
421
- return null;
422
- }));
423
- },
424
- /** 删除应用目录里的文件。 */
425
- deleteFile(options) {
426
- return callPlugin(() => __async(null, null, function* () {
427
- assertPath("Filesystem.deleteFile", options);
428
- yield getAdapter().deleteFile(options);
429
- return null;
430
- }));
431
- },
432
- /** 创建目录。 */
433
- mkdir(options) {
434
- return callPlugin(() => __async(null, null, function* () {
435
- assertPath("Filesystem.mkdir", options);
436
- yield getAdapter().mkdir(options);
437
- return null;
438
- }));
439
- },
440
- /** 删除目录。 */
441
- rmdir(options) {
442
- return callPlugin(() => __async(null, null, function* () {
443
- assertPath("Filesystem.rmdir", options);
444
- yield getAdapter().rmdir(options);
445
- return null;
446
- }));
447
- },
448
- /** 列出目录。 */
449
- readdir(options) {
450
- return callPlugin(() => __async(null, null, function* () {
451
- assertPath("Filesystem.readdir", options);
452
- return getAdapter().readdir(options);
453
- }));
454
- },
455
- /** 取当前页面可加载的地址。 */
456
- getUri(options) {
457
- return callPlugin(() => __async(null, null, function* () {
458
- assertPath("Filesystem.getUri", options);
459
- return getAdapter().getUri(options);
460
- }));
461
- },
462
- /** 读取大小和修改时间。 */
463
- stat(options) {
464
- return callPlugin(() => __async(null, null, function* () {
465
- assertPath("Filesystem.stat", options);
466
- return getAdapter().stat(options);
467
- }));
468
- },
469
- /** 改名或移动。 */
470
- rename(options) {
471
- return callPlugin(() => __async(null, null, function* () {
472
- assertTransfer("Filesystem.rename", options);
473
- yield getAdapter().rename(options);
474
- return null;
475
- }));
476
- },
477
- /** 复制。 */
478
- copy(options) {
479
- return callPlugin(() => __async(null, null, function* () {
480
- assertTransfer("Filesystem.copy", options);
481
- yield getAdapter().copy(options);
482
- return null;
483
- }));
484
322
  }
485
323
  };
486
324
 
@@ -76,81 +76,9 @@ interface SaveFileResult {
76
76
  /** `success` 为 false 时的原因。 */
77
77
  errMsg?: string;
78
78
  }
79
- /** 应用目录。`EXTERNAL_STORAGE` 不在其中。 */
80
- type FilesystemDirectory = 'DOCUMENTS' | 'DATA' | 'CACHE' | 'EXTERNAL';
81
- /** 文本编码。`ascii` 和 `utf16` 只在 Android 接受。 */
82
- type FilesystemEncoding = 'utf8' | 'ascii' | 'utf16';
83
- /** 带目录的路径参数。不传 `directory` 时端上使用 `DOCUMENTS`。 */
84
- interface DirectoryPathOptions {
85
- /** 目录内的相对路径。 */
86
- path: string;
87
- /** 应用目录。 */
88
- directory?: FilesystemDirectory;
89
- }
90
- /** {@link Filesystem.readFile} 的入参。 */
91
- interface ReadFileOptions extends DirectoryPathOptions {
92
- /** 文本编码。不传时端上按 base64 返回。 */
93
- encoding?: FilesystemEncoding;
94
- }
95
- /** {@link Filesystem.writeFile} 的入参。 */
96
- interface WriteFileOptions extends ReadFileOptions {
97
- /** 要写入的内容。 */
98
- data: string;
99
- /** 父目录不存在时是否创建。 */
100
- recursive?: boolean;
101
- }
102
- /** {@link Filesystem.appendFile} 的入参。 */
103
- interface AppendFileOptions extends ReadFileOptions {
104
- /** 追加的内容。 */
105
- data: string;
106
- }
107
- /** 删除、建目录、列目录、取地址和 stat 共用的路径参数。 */
108
- interface FilesystemPathOptions extends DirectoryPathOptions {
109
- /** 父目录不存在时是否一并处理。只对 `mkdir` 和 `rmdir` 有意义。 */
110
- recursive?: boolean;
111
- }
112
- /** 在应用目录之间移动或复制。 */
113
- interface TransferOptions {
114
- /** 源相对路径。 */
115
- from: string;
116
- /** 目标相对路径。 */
117
- to: string;
118
- /** 源目录。 */
119
- directory?: FilesystemDirectory;
120
- /** 目标目录。不传时与源目录相同。 */
121
- toDirectory?: FilesystemDirectory;
122
- }
123
- /** 目录项或文件的元数据。 */
124
- interface FilesystemFileInfo {
125
- /** 名称,不含父路径。 */
126
- name: string;
127
- /** 是文件还是目录。 */
128
- type: 'directory' | 'file';
129
- /** 字节大小。 */
130
- size: number;
131
- /** 修改时间,Unix 毫秒。 */
132
- mtime: number;
133
- /** 当前页面可加载的地址。 */
134
- uri: string;
135
- /** 创建时间,Unix 毫秒。 */
136
- ctime?: number;
137
- }
138
- /** {@link Filesystem.stat} 的结果。 */
139
- interface FilesystemStat {
140
- /** 是文件还是目录。 */
141
- type: 'directory' | 'file';
142
- /** 字节大小。 */
143
- size: number;
144
- /** 修改时间,Unix 毫秒。 */
145
- mtime: number;
146
- /** 当前页面可加载的地址。 */
147
- uri: string;
148
- /** 创建时间,Unix 毫秒。 */
149
- ctime?: number;
150
- }
151
79
 
152
80
  /**
153
- * 文件插件。选择和保存,以及应用目录读写,都从这里进入。
81
+ * 文件插件。选择已有文件和保存文件从这里进入。
154
82
  */
155
83
  declare const Filesystem: {
156
84
  /**
@@ -167,36 +95,6 @@ declare const Filesystem: {
167
95
  * @returns `code` 为 0 时 `data` 是保存结果。可预期的失败在 `data.success` 和 `data.errMsg` 里。调用失败时外层 `errMsg` 可直接 toast
168
96
  */
169
97
  saveFile(options: SaveFileOptions): Promise<PluginResult<SaveFileResult>>;
170
- /** 读取应用目录里的文件。浏览器不提供这些目录。 */
171
- readFile(options: ReadFileOptions): Promise<PluginResult<{
172
- data: string;
173
- }>>;
174
- /** 写入应用目录。 */
175
- writeFile(options: WriteFileOptions): Promise<PluginResult<{
176
- uri: string;
177
- }>>;
178
- /** 向已有文件追加内容。 */
179
- appendFile(options: AppendFileOptions): Promise<PluginResult<null>>;
180
- /** 删除应用目录里的文件。 */
181
- deleteFile(options: FilesystemPathOptions): Promise<PluginResult<null>>;
182
- /** 创建目录。 */
183
- mkdir(options: FilesystemPathOptions): Promise<PluginResult<null>>;
184
- /** 删除目录。 */
185
- rmdir(options: FilesystemPathOptions): Promise<PluginResult<null>>;
186
- /** 列出目录。 */
187
- readdir(options: FilesystemPathOptions): Promise<PluginResult<{
188
- files: FilesystemFileInfo[];
189
- }>>;
190
- /** 取当前页面可加载的地址。 */
191
- getUri(options: FilesystemPathOptions): Promise<PluginResult<{
192
- uri: string;
193
- }>>;
194
- /** 读取大小和修改时间。 */
195
- stat(options: FilesystemPathOptions): Promise<PluginResult<FilesystemStat>>;
196
- /** 改名或移动。 */
197
- rename(options: TransferOptions): Promise<PluginResult<null>>;
198
- /** 复制。 */
199
- copy(options: TransferOptions): Promise<PluginResult<null>>;
200
98
  };
201
99
 
202
- export { type AppendFileOptions, Filesystem, type FilesystemDirectory, type FilesystemEncoding, type FilesystemFileInfo, type FilesystemPathOptions, type FilesystemStat, type MediaFile, type MediaFileType, type MediaType, type PickMediaOptions, type PickMediaResult, PluginResult, type ReadFileOptions, type SaveFileOptions, type SaveFileResult, type SaveFileSource, type SaveFileType, type TransferOptions, type WriteFileOptions };
100
+ export { Filesystem, type MediaFile, type MediaFileType, type MediaType, type PickMediaOptions, type PickMediaResult, PluginResult, type SaveFileOptions, type SaveFileResult, type SaveFileSource, type SaveFileType };
@@ -76,81 +76,9 @@ interface SaveFileResult {
76
76
  /** `success` 为 false 时的原因。 */
77
77
  errMsg?: string;
78
78
  }
79
- /** 应用目录。`EXTERNAL_STORAGE` 不在其中。 */
80
- type FilesystemDirectory = 'DOCUMENTS' | 'DATA' | 'CACHE' | 'EXTERNAL';
81
- /** 文本编码。`ascii` 和 `utf16` 只在 Android 接受。 */
82
- type FilesystemEncoding = 'utf8' | 'ascii' | 'utf16';
83
- /** 带目录的路径参数。不传 `directory` 时端上使用 `DOCUMENTS`。 */
84
- interface DirectoryPathOptions {
85
- /** 目录内的相对路径。 */
86
- path: string;
87
- /** 应用目录。 */
88
- directory?: FilesystemDirectory;
89
- }
90
- /** {@link Filesystem.readFile} 的入参。 */
91
- interface ReadFileOptions extends DirectoryPathOptions {
92
- /** 文本编码。不传时端上按 base64 返回。 */
93
- encoding?: FilesystemEncoding;
94
- }
95
- /** {@link Filesystem.writeFile} 的入参。 */
96
- interface WriteFileOptions extends ReadFileOptions {
97
- /** 要写入的内容。 */
98
- data: string;
99
- /** 父目录不存在时是否创建。 */
100
- recursive?: boolean;
101
- }
102
- /** {@link Filesystem.appendFile} 的入参。 */
103
- interface AppendFileOptions extends ReadFileOptions {
104
- /** 追加的内容。 */
105
- data: string;
106
- }
107
- /** 删除、建目录、列目录、取地址和 stat 共用的路径参数。 */
108
- interface FilesystemPathOptions extends DirectoryPathOptions {
109
- /** 父目录不存在时是否一并处理。只对 `mkdir` 和 `rmdir` 有意义。 */
110
- recursive?: boolean;
111
- }
112
- /** 在应用目录之间移动或复制。 */
113
- interface TransferOptions {
114
- /** 源相对路径。 */
115
- from: string;
116
- /** 目标相对路径。 */
117
- to: string;
118
- /** 源目录。 */
119
- directory?: FilesystemDirectory;
120
- /** 目标目录。不传时与源目录相同。 */
121
- toDirectory?: FilesystemDirectory;
122
- }
123
- /** 目录项或文件的元数据。 */
124
- interface FilesystemFileInfo {
125
- /** 名称,不含父路径。 */
126
- name: string;
127
- /** 是文件还是目录。 */
128
- type: 'directory' | 'file';
129
- /** 字节大小。 */
130
- size: number;
131
- /** 修改时间,Unix 毫秒。 */
132
- mtime: number;
133
- /** 当前页面可加载的地址。 */
134
- uri: string;
135
- /** 创建时间,Unix 毫秒。 */
136
- ctime?: number;
137
- }
138
- /** {@link Filesystem.stat} 的结果。 */
139
- interface FilesystemStat {
140
- /** 是文件还是目录。 */
141
- type: 'directory' | 'file';
142
- /** 字节大小。 */
143
- size: number;
144
- /** 修改时间,Unix 毫秒。 */
145
- mtime: number;
146
- /** 当前页面可加载的地址。 */
147
- uri: string;
148
- /** 创建时间,Unix 毫秒。 */
149
- ctime?: number;
150
- }
151
79
 
152
80
  /**
153
- * 文件插件。选择和保存,以及应用目录读写,都从这里进入。
81
+ * 文件插件。选择已有文件和保存文件从这里进入。
154
82
  */
155
83
  declare const Filesystem: {
156
84
  /**
@@ -167,36 +95,6 @@ declare const Filesystem: {
167
95
  * @returns `code` 为 0 时 `data` 是保存结果。可预期的失败在 `data.success` 和 `data.errMsg` 里。调用失败时外层 `errMsg` 可直接 toast
168
96
  */
169
97
  saveFile(options: SaveFileOptions): Promise<PluginResult<SaveFileResult>>;
170
- /** 读取应用目录里的文件。浏览器不提供这些目录。 */
171
- readFile(options: ReadFileOptions): Promise<PluginResult<{
172
- data: string;
173
- }>>;
174
- /** 写入应用目录。 */
175
- writeFile(options: WriteFileOptions): Promise<PluginResult<{
176
- uri: string;
177
- }>>;
178
- /** 向已有文件追加内容。 */
179
- appendFile(options: AppendFileOptions): Promise<PluginResult<null>>;
180
- /** 删除应用目录里的文件。 */
181
- deleteFile(options: FilesystemPathOptions): Promise<PluginResult<null>>;
182
- /** 创建目录。 */
183
- mkdir(options: FilesystemPathOptions): Promise<PluginResult<null>>;
184
- /** 删除目录。 */
185
- rmdir(options: FilesystemPathOptions): Promise<PluginResult<null>>;
186
- /** 列出目录。 */
187
- readdir(options: FilesystemPathOptions): Promise<PluginResult<{
188
- files: FilesystemFileInfo[];
189
- }>>;
190
- /** 取当前页面可加载的地址。 */
191
- getUri(options: FilesystemPathOptions): Promise<PluginResult<{
192
- uri: string;
193
- }>>;
194
- /** 读取大小和修改时间。 */
195
- stat(options: FilesystemPathOptions): Promise<PluginResult<FilesystemStat>>;
196
- /** 改名或移动。 */
197
- rename(options: TransferOptions): Promise<PluginResult<null>>;
198
- /** 复制。 */
199
- copy(options: TransferOptions): Promise<PluginResult<null>>;
200
98
  };
201
99
 
202
- export { type AppendFileOptions, Filesystem, type FilesystemDirectory, type FilesystemEncoding, type FilesystemFileInfo, type FilesystemPathOptions, type FilesystemStat, type MediaFile, type MediaFileType, type MediaType, type PickMediaOptions, type PickMediaResult, PluginResult, type ReadFileOptions, type SaveFileOptions, type SaveFileResult, type SaveFileSource, type SaveFileType, type TransferOptions, type WriteFileOptions };
100
+ export { Filesystem, type MediaFile, type MediaFileType, type MediaType, type PickMediaOptions, type PickMediaResult, PluginResult, type SaveFileOptions, type SaveFileResult, type SaveFileSource, type SaveFileType };
@@ -21,7 +21,13 @@ var __async = (__this, __arguments, generator) => {
21
21
  });
22
22
  };
23
23
  function callPlugin(task) {
24
- return Promise.resolve().then(task).then((data) => ({
24
+ let pending;
25
+ try {
26
+ pending = Promise.resolve(task());
27
+ } catch (error) {
28
+ pending = Promise.reject(error);
29
+ }
30
+ return pending.then((data) => ({
25
31
  code: ErrorCode.Success,
26
32
  data: data === void 0 ? null : data,
27
33
  errMsg: ""
@@ -122,39 +128,6 @@ var BrowserFilesystemAdapter = class extends FilesystemAdapter {
122
128
  saveFile(options) {
123
129
  return downloadFile(options);
124
130
  }
125
- readFile(_options) {
126
- this.unsupported("readFile");
127
- }
128
- writeFile(_options) {
129
- this.unsupported("writeFile");
130
- }
131
- appendFile(_options) {
132
- this.unsupported("appendFile");
133
- }
134
- deleteFile(_options) {
135
- this.unsupported("deleteFile");
136
- }
137
- mkdir(_options) {
138
- this.unsupported("mkdir");
139
- }
140
- rmdir(_options) {
141
- this.unsupported("rmdir");
142
- }
143
- readdir(_options) {
144
- this.unsupported("readdir");
145
- }
146
- getUri(_options) {
147
- this.unsupported("getUri");
148
- }
149
- stat(_options) {
150
- this.unsupported("stat");
151
- }
152
- rename(_options) {
153
- this.unsupported("rename");
154
- }
155
- copy(_options) {
156
- this.unsupported("copy");
157
- }
158
131
  };
159
132
  function openFileInput(mediaType, maxCount) {
160
133
  return new Promise((resolve) => {
@@ -226,8 +199,12 @@ function downloadFile(options) {
226
199
  const anchor = document.createElement("a");
227
200
  anchor.href = url;
228
201
  anchor.download = fileName;
202
+ anchor.rel = "noopener";
203
+ anchor.style.display = "none";
204
+ document.body.appendChild(anchor);
229
205
  anchor.click();
230
- URL.revokeObjectURL(url);
206
+ anchor.remove();
207
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
231
208
  return {
232
209
  success: true,
233
210
  filePath: fileName,
@@ -283,46 +260,12 @@ var NativeFilesystemAdapter = class extends FilesystemAdapter {
283
260
  saveFile(options) {
284
261
  return this.callNative("saveFile", options);
285
262
  }
286
- readFile(options) {
287
- return this.callNative("readFile", options);
288
- }
289
- writeFile(options) {
290
- return this.callNative("writeFile", options);
291
- }
292
- appendFile(options) {
293
- return this.callNative("appendFile", options);
294
- }
295
- deleteFile(options) {
296
- return this.callNative("deleteFile", options);
297
- }
298
- mkdir(options) {
299
- return this.callNative("mkdir", options);
300
- }
301
- rmdir(options) {
302
- return this.callNative("rmdir", options);
303
- }
304
- readdir(options) {
305
- return this.callNative("readdir", options);
306
- }
307
- getUri(options) {
308
- return this.callNative("getUri", options);
309
- }
310
- stat(options) {
311
- return this.callNative("stat", options);
312
- }
313
- rename(options) {
314
- return this.callNative("rename", options);
315
- }
316
- copy(options) {
317
- return this.callNative("copy", options);
318
- }
319
263
  };
320
264
 
321
265
  // src/filesystem/index.ts
322
266
  var MEDIA_TYPES = ["all", "image", "video", "audio", "file"];
323
267
  var FILE_TYPES = ["image", "video", "audio", "document", "other"];
324
268
  var SOURCE_TYPES = ["url", "base64", "path"];
325
- var DIRECTORIES = ["DOCUMENTS", "DATA", "CACHE", "EXTERNAL"];
326
269
  var adapter;
327
270
  function getAdapter() {
328
271
  adapter != null ? adapter : adapter = getRuntimeEnv() === RuntimeEnv.Browser ? new BrowserFilesystemAdapter() : new NativeFilesystemAdapter();
@@ -350,26 +293,6 @@ function assertSave(options) {
350
293
  invalid("Filesystem.saveFile", "data is required");
351
294
  }
352
295
  }
353
- function assertDirectory(method, directory) {
354
- if (directory !== void 0 && !DIRECTORIES.includes(directory)) {
355
- invalid(method, "directory is not allowed");
356
- }
357
- }
358
- function assertRelative(method, value, label) {
359
- if (!value || value.startsWith("/") || value.startsWith("\\") || value.split(/[/\\]/).includes("..")) {
360
- invalid(method, `${label} must be a relative path`);
361
- }
362
- }
363
- function assertPath(method, options) {
364
- assertDirectory(method, options == null ? void 0 : options.directory);
365
- assertRelative(method, options == null ? void 0 : options.path, "path");
366
- }
367
- function assertTransfer(method, options) {
368
- assertDirectory(method, options == null ? void 0 : options.directory);
369
- assertDirectory(method, options == null ? void 0 : options.toDirectory);
370
- assertRelative(method, options == null ? void 0 : options.from, "from");
371
- assertRelative(method, options == null ? void 0 : options.to, "to");
372
- }
373
296
  var Filesystem = {
374
297
  /**
375
298
  * 打开系统选择器。
@@ -394,91 +317,6 @@ var Filesystem = {
394
317
  assertSave(options);
395
318
  return getAdapter().saveFile(options);
396
319
  }));
397
- },
398
- /** 读取应用目录里的文件。浏览器不提供这些目录。 */
399
- readFile(options) {
400
- return callPlugin(() => __async(null, null, function* () {
401
- assertPath("Filesystem.readFile", options);
402
- return getAdapter().readFile(options);
403
- }));
404
- },
405
- /** 写入应用目录。 */
406
- writeFile(options) {
407
- return callPlugin(() => __async(null, null, function* () {
408
- assertPath("Filesystem.writeFile", options);
409
- if (options.data === void 0) invalid("Filesystem.writeFile", "data is required");
410
- return getAdapter().writeFile(options);
411
- }));
412
- },
413
- /** 向已有文件追加内容。 */
414
- appendFile(options) {
415
- return callPlugin(() => __async(null, null, function* () {
416
- assertPath("Filesystem.appendFile", options);
417
- if (options.data === void 0) invalid("Filesystem.appendFile", "data is required");
418
- yield getAdapter().appendFile(options);
419
- return null;
420
- }));
421
- },
422
- /** 删除应用目录里的文件。 */
423
- deleteFile(options) {
424
- return callPlugin(() => __async(null, null, function* () {
425
- assertPath("Filesystem.deleteFile", options);
426
- yield getAdapter().deleteFile(options);
427
- return null;
428
- }));
429
- },
430
- /** 创建目录。 */
431
- mkdir(options) {
432
- return callPlugin(() => __async(null, null, function* () {
433
- assertPath("Filesystem.mkdir", options);
434
- yield getAdapter().mkdir(options);
435
- return null;
436
- }));
437
- },
438
- /** 删除目录。 */
439
- rmdir(options) {
440
- return callPlugin(() => __async(null, null, function* () {
441
- assertPath("Filesystem.rmdir", options);
442
- yield getAdapter().rmdir(options);
443
- return null;
444
- }));
445
- },
446
- /** 列出目录。 */
447
- readdir(options) {
448
- return callPlugin(() => __async(null, null, function* () {
449
- assertPath("Filesystem.readdir", options);
450
- return getAdapter().readdir(options);
451
- }));
452
- },
453
- /** 取当前页面可加载的地址。 */
454
- getUri(options) {
455
- return callPlugin(() => __async(null, null, function* () {
456
- assertPath("Filesystem.getUri", options);
457
- return getAdapter().getUri(options);
458
- }));
459
- },
460
- /** 读取大小和修改时间。 */
461
- stat(options) {
462
- return callPlugin(() => __async(null, null, function* () {
463
- assertPath("Filesystem.stat", options);
464
- return getAdapter().stat(options);
465
- }));
466
- },
467
- /** 改名或移动。 */
468
- rename(options) {
469
- return callPlugin(() => __async(null, null, function* () {
470
- assertTransfer("Filesystem.rename", options);
471
- yield getAdapter().rename(options);
472
- return null;
473
- }));
474
- },
475
- /** 复制。 */
476
- copy(options) {
477
- return callPlugin(() => __async(null, null, function* () {
478
- assertTransfer("Filesystem.copy", options);
479
- yield getAdapter().copy(options);
480
- return null;
481
- }));
482
320
  }
483
321
  };
484
322
 
@@ -4,7 +4,13 @@ var core = require('@tusi-ai/core');
4
4
 
5
5
  // src/geolocation/index.ts
6
6
  function callPlugin(task) {
7
- return Promise.resolve().then(task).then((data) => ({
7
+ let pending;
8
+ try {
9
+ pending = Promise.resolve(task());
10
+ } catch (error) {
11
+ pending = Promise.reject(error);
12
+ }
13
+ return pending.then((data) => ({
8
14
  code: core.ErrorCode.Success,
9
15
  data: data === void 0 ? null : data,
10
16
  errMsg: ""
@@ -2,7 +2,13 @@ import { ErrorCode, TusiError, getRuntimeEnv, RuntimeEnv, bridge } from '@tusi-a
2
2
 
3
3
  // src/geolocation/index.ts
4
4
  function callPlugin(task) {
5
- return Promise.resolve().then(task).then((data) => ({
5
+ let pending;
6
+ try {
7
+ pending = Promise.resolve(task());
8
+ } catch (error) {
9
+ pending = Promise.reject(error);
10
+ }
11
+ return pending.then((data) => ({
6
12
  code: ErrorCode.Success,
7
13
  data: data === void 0 ? null : data,
8
14
  errMsg: ""
@@ -23,7 +23,13 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  function callPlugin(task) {
26
- return Promise.resolve().then(task).then((data) => ({
26
+ let pending;
27
+ try {
28
+ pending = Promise.resolve(task());
29
+ } catch (error) {
30
+ pending = Promise.reject(error);
31
+ }
32
+ return pending.then((data) => ({
27
33
  code: core.ErrorCode.Success,
28
34
  data: data === void 0 ? null : data,
29
35
  errMsg: ""
@@ -21,7 +21,13 @@ var __async = (__this, __arguments, generator) => {
21
21
  });
22
22
  };
23
23
  function callPlugin(task) {
24
- return Promise.resolve().then(task).then((data) => ({
24
+ let pending;
25
+ try {
26
+ pending = Promise.resolve(task());
27
+ } catch (error) {
28
+ pending = Promise.reject(error);
29
+ }
30
+ return pending.then((data) => ({
25
31
  code: ErrorCode.Success,
26
32
  data: data === void 0 ? null : data,
27
33
  errMsg: ""
@@ -23,7 +23,13 @@ var __async = (__this, __arguments, generator) => {
23
23
  });
24
24
  };
25
25
  function callPlugin(task) {
26
- return Promise.resolve().then(task).then((data) => ({
26
+ let pending;
27
+ try {
28
+ pending = Promise.resolve(task());
29
+ } catch (error) {
30
+ pending = Promise.reject(error);
31
+ }
32
+ return pending.then((data) => ({
27
33
  code: core.ErrorCode.Success,
28
34
  data: data === void 0 ? null : data,
29
35
  errMsg: ""
@@ -21,7 +21,13 @@ var __async = (__this, __arguments, generator) => {
21
21
  });
22
22
  };
23
23
  function callPlugin(task) {
24
- return Promise.resolve().then(task).then((data) => ({
24
+ let pending;
25
+ try {
26
+ pending = Promise.resolve(task());
27
+ } catch (error) {
28
+ pending = Promise.reject(error);
29
+ }
30
+ return pending.then((data) => ({
25
31
  code: ErrorCode.Success,
26
32
  data: data === void 0 ? null : data,
27
33
  errMsg: ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tusi-ai/plugins",
3
- "version": "0.0.2-beta.1",
3
+ "version": "0.0.2-beta.2",
4
4
  "description": "吐司端能力插件",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -102,7 +102,7 @@
102
102
  ],
103
103
  "sideEffects": false,
104
104
  "dependencies": {
105
- "@tusi-ai/core": "^0.0.2-beta.1"
105
+ "@tusi-ai/core": "^0.0.2-beta.2"
106
106
  },
107
107
  "devDependencies": {
108
108
  "@types/node": "^22.19.0",