@glodon-aiot/bot-client-sdk 3.25.1-alpha.6 → 3.26.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.
Files changed (70) hide show
  1. package/README.md +543 -98
  2. package/dist/es/AgentSession.mjs +230 -165
  3. package/dist/es/BotClient.mjs +186 -136
  4. package/dist/es/Config.mjs +111 -26
  5. package/dist/es/Session.mjs +12 -0
  6. package/dist/es/api/index.mjs +42 -33
  7. package/dist/es/index.mjs +68 -9
  8. package/dist/es/localFiles/adapters/FileSystemAccessAdapter.mjs +174 -0
  9. package/dist/es/localFiles/adapters/HostBridgeAdapter.mjs +172 -0
  10. package/dist/es/localFiles/adapters/MemoryWorkspaceAdapter.mjs +162 -0
  11. package/dist/es/localFiles/adapters/WorkspaceFileAdapter.mjs +50 -0
  12. package/dist/es/localFiles/adapters/fsaTypes.mjs +9 -0
  13. package/dist/es/localFiles/constants.mjs +47 -0
  14. package/dist/es/localFiles/createLocalFilesPlugin.mjs +255 -0
  15. package/dist/es/localFiles/createLocalPythonPlugin.mjs +196 -0
  16. package/dist/es/localFiles/errors.mjs +57 -0
  17. package/dist/es/localFiles/host/connectHostBridge.mjs +50 -0
  18. package/dist/es/localFiles/host/protocol.mjs +26 -0
  19. package/dist/es/localFiles/limits.mjs +22 -0
  20. package/dist/es/localFiles/schemas.mjs +327 -0
  21. package/dist/es/localFiles/security/downloadUrlPolicy.mjs +39 -0
  22. package/dist/es/localFiles/security/glob.mjs +28 -0
  23. package/dist/es/localFiles/security/pathPolicy.mjs +59 -0
  24. package/dist/es/localFiles/security/sensitiveFiles.mjs +115 -0
  25. package/dist/es/localFiles/tools/readTools.mjs +333 -0
  26. package/dist/es/localFiles/tools/runtime.mjs +108 -0
  27. package/dist/es/localFiles/tools/transferTools.mjs +228 -0
  28. package/dist/es/localFiles/tools/writeTools.mjs +173 -0
  29. package/dist/es/localFiles/transfer/SessionFileTransfer.mjs +111 -0
  30. package/dist/es/localFiles/validate.mjs +66 -0
  31. package/dist/es/localFiles/workspace/LocalWorkspace.mjs +339 -0
  32. package/dist/es/localFiles/workspace/handleStore.mjs +79 -0
  33. package/dist/es/localFiles/workspace/watchDirectory.mjs +38 -0
  34. package/dist/es/package.json.mjs +7 -4
  35. package/dist/lib/index.js +9 -4
  36. package/dist/src/AgentSession.d.ts +9 -0
  37. package/dist/src/BotClient.d.ts +12 -2
  38. package/dist/src/Config.d.ts +22 -0
  39. package/dist/src/Session.d.ts +5 -1
  40. package/dist/src/api/index.d.ts +3 -1
  41. package/dist/src/index.d.ts +4 -2
  42. package/dist/src/localFiles/adapters/FileSystemAccessAdapter.d.ts +17 -0
  43. package/dist/src/localFiles/adapters/HostBridgeAdapter.d.ts +24 -0
  44. package/dist/src/localFiles/adapters/MemoryWorkspaceAdapter.d.ts +18 -0
  45. package/dist/src/localFiles/adapters/WorkspaceFileAdapter.d.ts +26 -0
  46. package/dist/src/localFiles/adapters/fsaTypes.d.ts +39 -0
  47. package/dist/src/localFiles/constants.d.ts +50 -0
  48. package/dist/src/localFiles/createLocalFilesPlugin.d.ts +11 -0
  49. package/dist/src/localFiles/createLocalPythonPlugin.d.ts +12 -0
  50. package/dist/src/localFiles/errors.d.ts +34 -0
  51. package/dist/src/localFiles/host/connectHostBridge.d.ts +6 -0
  52. package/dist/src/localFiles/host/protocol.d.ts +33 -0
  53. package/dist/src/localFiles/index.d.ts +21 -0
  54. package/dist/src/localFiles/limits.d.ts +3 -0
  55. package/dist/src/localFiles/schemas.d.ts +30 -0
  56. package/dist/src/localFiles/security/downloadUrlPolicy.d.ts +4 -0
  57. package/dist/src/localFiles/security/glob.d.ts +3 -0
  58. package/dist/src/localFiles/security/pathPolicy.d.ts +14 -0
  59. package/dist/src/localFiles/security/sensitiveFiles.d.ts +23 -0
  60. package/dist/src/localFiles/tools/readTools.d.ts +7 -0
  61. package/dist/src/localFiles/tools/runtime.d.ts +43 -0
  62. package/dist/src/localFiles/tools/transferTools.d.ts +4 -0
  63. package/dist/src/localFiles/tools/writeTools.d.ts +4 -0
  64. package/dist/src/localFiles/transfer/SessionFileTransfer.d.ts +40 -0
  65. package/dist/src/localFiles/types.d.ts +306 -0
  66. package/dist/src/localFiles/validate.d.ts +2 -0
  67. package/dist/src/localFiles/workspace/LocalWorkspace.d.ts +99 -0
  68. package/dist/src/localFiles/workspace/handleStore.d.ts +11 -0
  69. package/dist/src/localFiles/workspace/watchDirectory.d.ts +7 -0
  70. package/package.json +7 -4
@@ -0,0 +1,306 @@
1
+ import { LocalFilesFunctionCode, LocalFilesLimits } from './constants';
2
+ import { ToolErrorReason } from './errors';
3
+ import { SensitiveRuleInput } from './security/sensitiveFiles';
4
+ import { SessionFileTransfer } from './transfer/SessionFileTransfer';
5
+ /** 客户端插件被调用时 SDK 传入的第三个参数。 */
6
+ export interface ToolContext {
7
+ requestId: string;
8
+ applicationId: string;
9
+ sessionId: string;
10
+ pluginCode: string;
11
+ functionCode: string;
12
+ signal?: AbortSignal;
13
+ }
14
+ export type ClientPluginContext = ToolContext;
15
+ export interface ToolResult<T = unknown> {
16
+ code: number;
17
+ message: string;
18
+ data?: T;
19
+ truncated?: boolean;
20
+ warnings?: string[];
21
+ }
22
+ export type ClientPluginCallback = (result: ToolResult) => void;
23
+ export type ApprovalFunctionCode = Extract<LocalFilesFunctionCode, 'apply_patch' | 'write_file' | 'upload_file' | 'download_file'>;
24
+ export interface TextChangePreview {
25
+ type: 'text';
26
+ /** 修改前文本;新建文件时为 undefined。 */
27
+ before?: string;
28
+ after: string;
29
+ created: boolean;
30
+ }
31
+ export interface UploadPreview {
32
+ type: 'upload';
33
+ name: string;
34
+ size: number;
35
+ target: 'session';
36
+ }
37
+ export interface DownloadPreview {
38
+ type: 'download';
39
+ source: {
40
+ type: DownloadSource['type'];
41
+ /** 面向用户的来源描述,如「会话文件」或 URL 主机名。 */
42
+ label: string;
43
+ };
44
+ name?: string;
45
+ size?: number;
46
+ overwrite: boolean;
47
+ }
48
+ export type ApprovalPreview = TextChangePreview | UploadPreview | DownloadPreview;
49
+ export interface ApprovalRequest {
50
+ id: string;
51
+ requestId: string;
52
+ sessionId: string;
53
+ functionCode: ApprovalFunctionCode;
54
+ /** 工作区相对路径。 */
55
+ path: string;
56
+ workspaceName: string;
57
+ preview: ApprovalPreview;
58
+ /** 调用被取消(停止回答、会话失活、更换工作区)时中止,确认 UI 应据此关闭。 */
59
+ signal: AbortSignal;
60
+ }
61
+ export type ApprovalHandler = (request: ApprovalRequest) => boolean | Promise<boolean>;
62
+ export interface LocalFilesConfig {
63
+ enabled?: boolean;
64
+ /**
65
+ * `file-system-access`:网页里由用户选择目录。
66
+ * `host-bridge`:目录由宿主通过 `chrome.webview` 设置,页面不弹选择框。
67
+ */
68
+ backend?: 'file-system-access' | 'host-bridge';
69
+ /**
70
+ * 平台上的内置工具插件编码。文件工具和 run_python 使用同一个编码。
71
+ * 未配置时按 env 取 BUILTIN_TOOLS_PLUGIN_CODES。
72
+ */
73
+ pluginCode?: string;
74
+ /** 在默认 `['glodon.com']` 之外追加允许下载的域名后缀。 */
75
+ downloadUrlAllowlistAppend?: string[];
76
+ /** 在 SDK 敏感文件基线之外追加规则。 */
77
+ sensitiveRulesAppend?: SensitiveRuleInput[];
78
+ /** 只能调小;大于默认值的配置按默认值处理。 */
79
+ limits?: Partial<LocalFilesLimits>;
80
+ allowWorkspaceWideTextSearch?: boolean;
81
+ /** 写入与传输前的确认;未配置时这些工具一律拒绝执行。 */
82
+ onApprovalRequired?: ApprovalHandler;
83
+ /** 替换默认的会话文件上传/下载实现。 */
84
+ transfer?: Partial<SessionFileTransfer>;
85
+ }
86
+ export interface PythonApprovalRequest {
87
+ requestId: string;
88
+ sessionId: string;
89
+ path: string;
90
+ args: string[];
91
+ workspaceName: string;
92
+ signal: AbortSignal;
93
+ }
94
+ export type PythonApprovalHandler = (request: PythonApprovalRequest) => boolean | Promise<boolean>;
95
+ export interface LocalPythonConfig {
96
+ enabled?: boolean;
97
+ /**
98
+ * 平台上的内置工具插件编码,须与文件工具相同。
99
+ * 未配置时跟随 localFiles.pluginCode,再按 env 取 BUILTIN_TOOLS_PLUGIN_CODES。
100
+ */
101
+ pluginCode?: string;
102
+ /** 运行脚本前的确认。与文件写入确认分开;未配置时一律拒绝。 */
103
+ onApprovalRequired?: PythonApprovalHandler;
104
+ }
105
+ export interface BuiltinPluginsConfig {
106
+ localFiles?: LocalFilesConfig;
107
+ localPython?: LocalPythonConfig;
108
+ }
109
+ export interface WorkspaceGrantInput {
110
+ grantId: string;
111
+ }
112
+ export interface ListDirectoryInput extends WorkspaceGrantInput {
113
+ path?: string;
114
+ offset?: number;
115
+ limit?: number;
116
+ }
117
+ export interface DirectoryEntry {
118
+ name: string;
119
+ path: string;
120
+ kind: 'file' | 'directory';
121
+ size?: number;
122
+ lastModified?: number;
123
+ sensitive?: boolean;
124
+ }
125
+ export interface ListDirectoryOutput {
126
+ path: string;
127
+ entries: DirectoryEntry[];
128
+ total: number;
129
+ hasMore: boolean;
130
+ }
131
+ export type TextEncodingName = 'utf-8' | 'gbk' | 'gb18030';
132
+ export interface ReadFileInput extends WorkspaceGrantInput {
133
+ path: string;
134
+ startLine?: number;
135
+ endLine?: number;
136
+ maxBytes?: number;
137
+ encoding?: TextEncodingName;
138
+ }
139
+ export interface ReadFileOutput {
140
+ path: string;
141
+ content: string;
142
+ startLine: number;
143
+ endLine: number;
144
+ /** 仅在完整扫描了文件时返回。 */
145
+ totalLines?: number;
146
+ size: number;
147
+ encoding: TextEncodingName;
148
+ lineEnding: 'lf' | 'crlf';
149
+ hash?: string;
150
+ }
151
+ export interface StatFileInput extends WorkspaceGrantInput {
152
+ path: string;
153
+ includeHash?: boolean;
154
+ }
155
+ export interface StatFileOutput {
156
+ path: string;
157
+ kind: 'file' | 'directory';
158
+ size?: number;
159
+ lastModified?: number;
160
+ sensitive: boolean;
161
+ hash?: string;
162
+ }
163
+ export interface SearchFilesInput extends WorkspaceGrantInput {
164
+ pattern: string;
165
+ path?: string;
166
+ maxDepth?: number;
167
+ maxResults?: number;
168
+ }
169
+ export interface SearchFilesMatch {
170
+ path: string;
171
+ size?: number;
172
+ lastModified?: number;
173
+ }
174
+ export interface SearchFilesOutput {
175
+ matches: SearchFilesMatch[];
176
+ }
177
+ export interface SearchTextInput extends WorkspaceGrantInput {
178
+ path: string;
179
+ query: string;
180
+ caseSensitive?: boolean;
181
+ isRegex?: boolean;
182
+ glob?: string;
183
+ maxResults?: number;
184
+ contextLines?: number;
185
+ }
186
+ export interface SearchTextMatch {
187
+ path: string;
188
+ line: number;
189
+ column: number;
190
+ text: string;
191
+ before?: string[];
192
+ after?: string[];
193
+ }
194
+ export interface SearchTextOutput {
195
+ matches: SearchTextMatch[];
196
+ filesScanned: number;
197
+ }
198
+ export interface PatchEdit {
199
+ oldText: string;
200
+ newText: string;
201
+ replaceAll?: boolean;
202
+ }
203
+ export interface ApplyPatchInput extends WorkspaceGrantInput {
204
+ path: string;
205
+ expectedHash: string;
206
+ edits: PatchEdit[];
207
+ }
208
+ export interface WriteResultOutput {
209
+ path: string;
210
+ hash: string;
211
+ size: number;
212
+ }
213
+ export interface WriteFileInput extends WorkspaceGrantInput {
214
+ path: string;
215
+ content: string;
216
+ expectedHash?: string;
217
+ createDirectories?: boolean;
218
+ }
219
+ export interface WriteFileOutput extends WriteResultOutput {
220
+ created: boolean;
221
+ }
222
+ export interface UploadFileInput extends WorkspaceGrantInput {
223
+ path: string;
224
+ target?: string;
225
+ mimeHint?: string;
226
+ }
227
+ export interface UploadFileOutput {
228
+ fileId: string;
229
+ name: string;
230
+ size: number;
231
+ /** 平台预签名访问链接,给模型用于后续推理或对话。 */
232
+ url: string;
233
+ }
234
+ export type DownloadSource = {
235
+ type: 'sessionFile';
236
+ fileId: string;
237
+ } | {
238
+ type: 'platformFile';
239
+ fileId: string;
240
+ } | {
241
+ type: 'url';
242
+ url: string;
243
+ };
244
+ export interface DownloadFileInput extends WorkspaceGrantInput {
245
+ destPath: string;
246
+ source: DownloadSource;
247
+ overwrite?: boolean;
248
+ expectedHash?: string;
249
+ }
250
+ export interface DownloadFileOutput {
251
+ path: string;
252
+ size: number;
253
+ hash: string;
254
+ }
255
+ export type LocalWorkspaceStatus = 'unsupported' | 'none' | 'prompt' | 'granted' | 'denied';
256
+ export interface WorkspaceChangedEvent {
257
+ status: LocalWorkspaceStatus;
258
+ displayName?: string;
259
+ }
260
+ export interface ToolEventBase {
261
+ requestId: string;
262
+ sessionId: string;
263
+ functionCode: LocalFilesFunctionCode;
264
+ path?: string;
265
+ }
266
+ export interface ToolProgressEvent extends ToolEventBase {
267
+ stage: 'reading' | 'uploading' | 'downloading' | 'writing' | 'done';
268
+ loaded: number;
269
+ total?: number;
270
+ }
271
+ export interface ToolFinishEvent extends ToolEventBase {
272
+ code: number;
273
+ }
274
+ export interface ToolErrorEvent extends ToolEventBase {
275
+ code: number;
276
+ message: string;
277
+ reason?: ToolErrorReason;
278
+ }
279
+ export interface ToolApprovalEvent extends ToolEventBase {
280
+ approvalId: string;
281
+ }
282
+ /** 目录树需要重读的范围。`paths` 为空时重读根目录和当前已展开的目录。 */
283
+ export interface FilesChangedEvent {
284
+ paths: string[];
285
+ }
286
+ export interface LocalWorkspaceEventMap {
287
+ 'workspace:changed': WorkspaceChangedEvent;
288
+ /** 本地目录有增删。短时间内的多次变化会合并成一次。 */
289
+ 'files:changed': FilesChangedEvent;
290
+ 'tool:start': ToolEventBase;
291
+ /** 只含摘要;完整预览只交给 onApprovalRequired。 */
292
+ 'tool:approval-required': ToolApprovalEvent;
293
+ 'tool:progress': ToolProgressEvent;
294
+ 'tool:finish': ToolFinishEvent;
295
+ 'tool:error': ToolErrorEvent;
296
+ 'tool:cancelled': ToolEventBase;
297
+ }
298
+ export type LocalWorkspaceEventName = keyof LocalWorkspaceEventMap;
299
+ export interface WorkspaceHandshake {
300
+ protocolVersion: '1.0';
301
+ capabilities: Record<LocalFilesFunctionCode, boolean> & {
302
+ cancellation: boolean;
303
+ atomicWrite: boolean;
304
+ };
305
+ limits: LocalFilesLimits;
306
+ }
@@ -0,0 +1,2 @@
1
+ import { JsonSchema } from './schemas';
2
+ export declare function validateToolInput<T>(params: unknown, schema: JsonSchema): T;
@@ -0,0 +1,99 @@
1
+ import { WorkspaceFileAdapter } from '../adapters/WorkspaceFileAdapter';
2
+ import { ShowDirectoryPicker } from '../adapters/fsaTypes';
3
+ import { LocalFilesLimits } from '../constants';
4
+ import { SensitiveFilePolicy } from '../security/sensitiveFiles';
5
+ import { SessionFileTransfer } from '../transfer/SessionFileTransfer';
6
+ import { ApprovalHandler, LocalFilesConfig, LocalWorkspaceEventMap, LocalWorkspaceEventName, LocalWorkspaceStatus, WorkspaceHandshake } from '../types';
7
+ import { KeyValueStore } from './handleStore';
8
+ export interface LocalWorkspaceOptions {
9
+ applicationId: string;
10
+ config?: LocalFilesConfig;
11
+ /** 句柄与外发提示标记的存储,默认内存存储;BotClient 传入 IndexedDB 存储。 */
12
+ store?: KeyValueStore;
13
+ /** 默认使用 window.showDirectoryPicker;传 null 表示不支持。 */
14
+ picker?: ShowDirectoryPicker | null;
15
+ /** 默认会话文件传输的 API 来源;config.transfer 中的方法优先。 */
16
+ transfer?: SessionFileTransfer;
17
+ fetch?: typeof fetch;
18
+ }
19
+ /**
20
+ * 工作文件夹授权与运行状态。一个 BotClient 对应一个实例;UI 与纯 SDK 集成共用同一实例。
21
+ */
22
+ export declare class LocalWorkspace {
23
+ readonly applicationId: string;
24
+ readonly limits: LocalFilesLimits;
25
+ readonly sensitive: SensitiveFilePolicy;
26
+ readonly downloadUrlAllowlist: string[];
27
+ readonly allowWorkspaceWideTextSearch: boolean;
28
+ readonly transfer: SessionFileTransfer;
29
+ readonly fetch: typeof fetch;
30
+ private readonly store;
31
+ private readonly picker?;
32
+ private readonly event;
33
+ private _status;
34
+ private _displayName?;
35
+ private _adapter;
36
+ private pendingHandle;
37
+ private approvalHandler?;
38
+ private activeCalls;
39
+ private readonly inflight;
40
+ private _ready;
41
+ private stopWatching;
42
+ private readonly pendingChangePaths;
43
+ private changeTimer;
44
+ private refreshAllVisible;
45
+ constructor(options: LocalWorkspaceOptions);
46
+ get status(): LocalWorkspaceStatus;
47
+ /** 当前(或待恢复的)文件夹名,不含绝对路径。 */
48
+ get displayName(): string | undefined;
49
+ get isSupported(): boolean;
50
+ /** 最近一次 restore() 完成前,工具调用会等待它。 */
51
+ get ready(): Promise<void>;
52
+ /** @internal 已授权时可用的 Adapter。 */
53
+ get adapter(): WorkspaceFileAdapter | null;
54
+ private get handleKey();
55
+ private get disclosureKey();
56
+ private setStatus;
57
+ private attachHandle;
58
+ /**
59
+ * 弹出目录选择框。必须在用户点击事件中调用。
60
+ * 用户取消时返回 false 且状态不变。
61
+ */
62
+ pick(): Promise<boolean>;
63
+ /** 读取上次的目录句柄并检查权限,不弹窗。 */
64
+ restore(): Promise<void>;
65
+ private doRestore;
66
+ /** 对已保存的目录重新申请权限。必须在用户点击事件中调用。 */
67
+ requestPermission(): Promise<boolean>;
68
+ /** 断开工作区并删除持久化句柄。状态立即变为未授权,存储删除在其后完成。 */
69
+ clear(): Promise<void>;
70
+ /** 直接挂载一个 Adapter(测试或自定义后端),视为已授权。 */
71
+ attachAdapter(adapter: WorkspaceFileAdapter, displayName?: string): void;
72
+ /**
73
+ * 通知目录树重读。`paths` 是相对工作区根的目录;省略时重读当前展开的全部目录。
74
+ * 短时间内的多次通知会合并成一次。
75
+ */
76
+ notifyFilesChanged(paths?: readonly string[]): void;
77
+ /** @internal 工具执行中遇到权限错误时调用,重新检查并更新状态。 */
78
+ handlePermissionLost(): Promise<void>;
79
+ isDisclosureAcknowledged(): Promise<boolean>;
80
+ acknowledgeDisclosure(): Promise<void>;
81
+ setApprovalHandler(handler?: ApprovalHandler): void;
82
+ get hasApprovalHandler(): boolean;
83
+ /** @internal */
84
+ getApprovalHandler(): ApprovalHandler | undefined;
85
+ /** @internal 占用一个并发名额;已满时返回 null。 */
86
+ acquireSlot(): (() => void) | null;
87
+ /** @internal 登记进行中的调用,更换或断开工作区时统一中止。 */
88
+ track(controller: AbortController): () => boolean;
89
+ /** 中止所有进行中的调用(含等待确认的请求)。 */
90
+ cancelAll(): void;
91
+ handshake(): WorkspaceHandshake;
92
+ on<K extends LocalWorkspaceEventName>(name: K, listener: (payload: LocalWorkspaceEventMap[K]) => void): () => void;
93
+ off<K extends LocalWorkspaceEventName>(name: K, listener: (payload: LocalWorkspaceEventMap[K]) => void): void;
94
+ private unwatchDirectory;
95
+ private cancelFilesChanged;
96
+ private flushFilesChanged;
97
+ /** @internal */
98
+ emit<K extends LocalWorkspaceEventName>(name: K, payload: LocalWorkspaceEventMap[K]): void;
99
+ }
@@ -0,0 +1,11 @@
1
+ export interface KeyValueStore {
2
+ get<T>(key: string): Promise<T | undefined>;
3
+ set(key: string, value: unknown): Promise<void>;
4
+ delete(key: string): Promise<void>;
5
+ }
6
+ export declare function createMemoryStore(): KeyValueStore;
7
+ /**
8
+ * IndexedDB 存储。DirectoryHandle 可被结构化克隆,必须存在 IndexedDB 中才能跨页面恢复。
9
+ * 不支持 IndexedDB 的环境退化为内存存储(刷新后需重新选择目录)。
10
+ */
11
+ export declare function createIndexedDbStore(dbName?: string): KeyValueStore;
@@ -0,0 +1,7 @@
1
+ import { FsaDirectoryHandle } from '../adapters/fsaTypes';
2
+ /**
3
+ * 监听已授权的目录句柄。浏览器没有 FileSystemObserver 时返回空函数,
4
+ * 界面改为在窗口回到前台时重读。
5
+ * 回调收到的 paths 省略时,表示需要重读全部可见目录。
6
+ */
7
+ export declare function watchDirectoryHandle(handle: FsaDirectoryHandle, onChange: (paths?: string[]) => void): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glodon-aiot/bot-client-sdk",
3
- "version": "3.25.1-alpha.6",
3
+ "version": "3.26.0-alpha.4",
4
4
  "author": "glodoncv",
5
5
  "description": "aiot bot client js sdk",
6
6
  "type": "module",
@@ -36,7 +36,9 @@
36
36
  "preview": "vite preview",
37
37
  "check": "yarn prettier --check .",
38
38
  "write": "yarn prettier --write .",
39
- "lint": "eslint --ext .tsx,.ts --fix ./example -c .eslintrc.js"
39
+ "lint": "eslint --ext .tsx,.ts --fix ./example -c .eslintrc.js",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@babel/core": "^7.20.12",
@@ -69,7 +71,8 @@
69
71
  "vite": "^4.1.1",
70
72
  "vite-plugin-dts": "^4.3.0",
71
73
  "vite-plugin-externalize-deps": "^0.9.0",
72
- "vite-tsconfig-paths": "^5.1.4"
74
+ "vite-tsconfig-paths": "^5.1.4",
75
+ "vitest": "^0.34.6"
73
76
  },
74
77
  "lint-staged": {
75
78
  "*.{js,css,md,jsx,less,ts,tsx,json}": "prettier --write"
@@ -79,7 +82,7 @@
79
82
  "registry": "https://registry.npmjs.org/"
80
83
  },
81
84
  "dependencies": {
82
- "@glodon-aiot/apis": "^3.25.1-alpha.6",
85
+ "@glodon-aiot/apis": "^3.26.0-alpha.4",
83
86
  "axios": "0.24.0",
84
87
  "buffer": "^6.0.3",
85
88
  "dayjs": "^1.11.13",