assistsx-js 0.1.42 → 0.2.0
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.cjs +358 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/index.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +353 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/{AssistsXAsync.ts → assistsx-async.ts} +8 -8
- package/src/{AssistsX.ts → assistsx.ts} +8 -8
- package/src/barutils/bar-utils.ts +3 -3
- package/src/filesystem/fileio/file-io.ts +2 -2
- package/src/filesystem/fileutils/file-utils.ts +2 -2
- package/src/filesystem/path.ts +2 -2
- package/src/floatingwindow/float.ts +4 -4
- package/src/gallery/gallery.ts +2 -2
- package/src/global.d.ts +6 -1
- package/src/imageutils/image-utils.ts +2 -2
- package/src/ime/ime.ts +2 -2
- package/src/index.ts +21 -20
- package/src/log/log-call-method.ts +28 -0
- package/src/log/log.ts +445 -0
- package/src/mlkit/mlkit.ts +3 -3
- package/src/network/http.ts +2 -2
- package/src/{NodeAsync.ts → node-async.ts} +5 -5
- package/src/{Node.ts → node.ts} +5 -5
- package/src/{StepAsync.ts → step-async.ts} +8 -8
- package/src/{Step.ts → step.ts} +7 -7
- /package/src/{AccessibilityEventFilter.ts → accessibility-event-filter.ts} +0 -0
- /package/src/{AppInfo.ts → app-info.ts} +0 -0
- /package/src/barutils/{BarUtilsCallMethod.ts → bar-utils-call-method.ts} +0 -0
- /package/src/{Bounds.ts → bounds.ts} +0 -0
- /package/src/{CallMethod.ts → call-method.ts} +0 -0
- /package/src/{CallResponse.ts → call-response.ts} +0 -0
- /package/src/{DeviceInfo.ts → device-info.ts} +0 -0
- /package/src/floatingwindow/{FloatCallMethod.ts → float-call-method.ts} +0 -0
- /package/src/mlkit/{MlkitCallMethod.ts → mlkit-call-method.ts} +0 -0
- /package/src/{NodeClassValue.ts → node-class-value.ts} +0 -0
- /package/src/{StepError.ts → step-error.ts} +0 -0
- /package/src/{StepStateStore.ts → step-state-store.ts} +0 -0
- /package/src/{Utils.ts → utils.ts} +0 -0
- /package/src/{WindowFlags.ts → window-flags.ts} +0 -0
package/src/log/log.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 日志桥接:与 tools/log/AssistsLogJavascriptInterface.kt、ASWebView.kt 对齐。
|
|
3
|
+
* 使用 assistsxLog.call + assistsxLogCallback;页面级推送 onAssistsLogUpdate。
|
|
4
|
+
*/
|
|
5
|
+
import { CallResponse } from "../call-response";
|
|
6
|
+
import { decodeBase64UTF8, generateUUID } from "../utils";
|
|
7
|
+
import { LogCallMethod, type LogStreamType } from "./log-call-method";
|
|
8
|
+
|
|
9
|
+
const pendingCallbacks: Map<string, (data: string) => void> = new Map();
|
|
10
|
+
const streamHandlers: Map<string, (data: string) => void> = new Map();
|
|
11
|
+
const subscriptionIdToCallbackId: Map<string, string> = new Map();
|
|
12
|
+
|
|
13
|
+
if (typeof window !== "undefined" && !window.assistsxLogCallback) {
|
|
14
|
+
window.assistsxLogCallback = (data: string) => {
|
|
15
|
+
try {
|
|
16
|
+
const json = decodeBase64UTF8(data);
|
|
17
|
+
const response = JSON.parse(json) as {
|
|
18
|
+
callbackId?: string;
|
|
19
|
+
code?: number;
|
|
20
|
+
message?: string;
|
|
21
|
+
data?: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
const callbackId = response.callbackId;
|
|
24
|
+
if (!callbackId) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (streamHandlers.has(callbackId)) {
|
|
28
|
+
streamHandlers.get(callbackId)!(json);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const pending = pendingCallbacks.get(callbackId);
|
|
32
|
+
if (pending) {
|
|
33
|
+
pending(json);
|
|
34
|
+
pendingCallbacks.delete(callbackId);
|
|
35
|
+
}
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error("Log bridge callback error:", e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* onAssistsLogUpdate 推送的监听器列表(与 accessibilityEventListeners 风格一致)。
|
|
44
|
+
* 在页面加载本模块后,向此数组 push,或使用 log.addLogUpdateListener。
|
|
45
|
+
* 注意:若页面在 import 本模块之前已自定义 `window.onAssistsLogUpdate`,则不会安装默认分发函数,需自行解码并转发到监听器。
|
|
46
|
+
*/
|
|
47
|
+
export const logUpdateListeners: Array<
|
|
48
|
+
(payload: LogUpdateEvent) => void
|
|
49
|
+
> = [];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Base64 解码后的 CallResponse,data 含 stream / text
|
|
53
|
+
*/
|
|
54
|
+
export interface LogUpdateEvent {
|
|
55
|
+
code: number;
|
|
56
|
+
data: LogUpdateData | null;
|
|
57
|
+
message?: string;
|
|
58
|
+
callbackId?: string | null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface LogUpdateData {
|
|
62
|
+
stream: LogStreamType;
|
|
63
|
+
text: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface LogSubscribeUpdatePayload {
|
|
67
|
+
text: string;
|
|
68
|
+
stream: string;
|
|
69
|
+
subscriptionId: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface LogUploadOptions {
|
|
73
|
+
baseUrl?: string;
|
|
74
|
+
/** PNG(默认)| JPEG | JPG | WEBP */
|
|
75
|
+
format?: "PNG" | "JPEG" | "JPG" | "WEBP" | string;
|
|
76
|
+
prettyPrint?: boolean;
|
|
77
|
+
overlayHiddenDelayMillis?: number;
|
|
78
|
+
/** 与 Kotlin handleUploadLogs / AssistsLogDiagnostics.uploadLogs 的 uploadKey 一致 */
|
|
79
|
+
uploadKey?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** 与 Kotlin assistsLogUploadResultToJson 对齐 */
|
|
83
|
+
export interface LogUploadResult {
|
|
84
|
+
success: boolean;
|
|
85
|
+
message: string;
|
|
86
|
+
httpCode?: number;
|
|
87
|
+
responseBody?: string;
|
|
88
|
+
data?: unknown;
|
|
89
|
+
localLogFilePath?: string;
|
|
90
|
+
localScreenshotFilePath?: string;
|
|
91
|
+
localNodeTreeFilePath?: string;
|
|
92
|
+
causeMessage?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (typeof window !== "undefined" && !window.onAssistsLogUpdate) {
|
|
96
|
+
window.onAssistsLogUpdate = (encoded: string) => {
|
|
97
|
+
logUpdateListeners.forEach((listener) => {
|
|
98
|
+
try {
|
|
99
|
+
const decoded = decodeBase64UTF8(encoded);
|
|
100
|
+
const parsed = JSON.parse(decoded) as LogUpdateEvent;
|
|
101
|
+
listener(parsed);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.error("Log update listener error:", error);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export class Log {
|
|
110
|
+
private getBridge(): NonNullable<Window["assistsxLog"]> {
|
|
111
|
+
if (typeof window === "undefined" || !window.assistsxLog) {
|
|
112
|
+
throw new Error("assistsxLog bridge is not available");
|
|
113
|
+
}
|
|
114
|
+
return window.assistsxLog;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
private async asyncCall(
|
|
118
|
+
method: string,
|
|
119
|
+
args?: Record<string, unknown>,
|
|
120
|
+
timeout: number = 30
|
|
121
|
+
): Promise<CallResponse> {
|
|
122
|
+
const uuid = generateUUID();
|
|
123
|
+
const params = {
|
|
124
|
+
method,
|
|
125
|
+
arguments: args ?? undefined,
|
|
126
|
+
callbackId: uuid,
|
|
127
|
+
};
|
|
128
|
+
const promise = new Promise<string>((resolve) => {
|
|
129
|
+
pendingCallbacks.set(uuid, (data: string) => {
|
|
130
|
+
resolve(data);
|
|
131
|
+
});
|
|
132
|
+
setTimeout(() => {
|
|
133
|
+
pendingCallbacks.delete(uuid);
|
|
134
|
+
resolve(
|
|
135
|
+
JSON.stringify(new CallResponse(-1, null, uuid))
|
|
136
|
+
);
|
|
137
|
+
}, timeout * 1000);
|
|
138
|
+
});
|
|
139
|
+
this.getBridge().call(JSON.stringify(params));
|
|
140
|
+
const promiseResult = await promise;
|
|
141
|
+
if (typeof promiseResult === "string") {
|
|
142
|
+
const responseData = JSON.parse(promiseResult);
|
|
143
|
+
return new CallResponse(
|
|
144
|
+
responseData.code,
|
|
145
|
+
responseData.data,
|
|
146
|
+
responseData.callbackId
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
throw new Error("Log bridge call failed");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** 读取当前日志全文 */
|
|
153
|
+
async readAllText(timeout?: number): Promise<string> {
|
|
154
|
+
const res = await this.asyncCall(
|
|
155
|
+
LogCallMethod.readAllText,
|
|
156
|
+
undefined,
|
|
157
|
+
timeout
|
|
158
|
+
);
|
|
159
|
+
const d = res.getDataOrNull() as { text?: string } | null;
|
|
160
|
+
return d?.text ?? "";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 获取日志服务当前域名(origin,无路径;与上传、管理后台同源)。
|
|
165
|
+
* 与 Kotlin getLogServiceBaseUrl / adminWebBaseUrl 对齐。
|
|
166
|
+
*/
|
|
167
|
+
async getLogServiceBaseUrl(timeout?: number): Promise<string> {
|
|
168
|
+
const res = await this.asyncCall(
|
|
169
|
+
LogCallMethod.getLogServiceBaseUrl,
|
|
170
|
+
undefined,
|
|
171
|
+
timeout
|
|
172
|
+
);
|
|
173
|
+
const d = res.getDataOrNull() as { baseUrl?: string } | null;
|
|
174
|
+
return d?.baseUrl ?? "";
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** 清空日志 */
|
|
178
|
+
async clear(timeout?: number): Promise<boolean> {
|
|
179
|
+
const res = await this.asyncCall(
|
|
180
|
+
LogCallMethod.clear,
|
|
181
|
+
undefined,
|
|
182
|
+
timeout
|
|
183
|
+
);
|
|
184
|
+
return res.isSuccess();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** 从文件重新加载到内存 Flow */
|
|
188
|
+
async refreshFromFile(timeout?: number): Promise<boolean> {
|
|
189
|
+
const res = await this.asyncCall(
|
|
190
|
+
LogCallMethod.refreshFromFile,
|
|
191
|
+
undefined,
|
|
192
|
+
timeout
|
|
193
|
+
);
|
|
194
|
+
return res.isSuccess();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** 追加一行 */
|
|
198
|
+
async appendLine(
|
|
199
|
+
line: string,
|
|
200
|
+
maxLength?: number,
|
|
201
|
+
timeout?: number
|
|
202
|
+
): Promise<boolean> {
|
|
203
|
+
const args: Record<string, unknown> = { line };
|
|
204
|
+
if (maxLength !== undefined) {
|
|
205
|
+
args.maxLength = maxLength;
|
|
206
|
+
}
|
|
207
|
+
const res = await this.asyncCall(
|
|
208
|
+
LogCallMethod.appendLine,
|
|
209
|
+
args,
|
|
210
|
+
timeout
|
|
211
|
+
);
|
|
212
|
+
return res.isSuccess();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** 追加带时间戳的条目 */
|
|
216
|
+
async appendTimestampedEntry(
|
|
217
|
+
message: string,
|
|
218
|
+
timeout?: number
|
|
219
|
+
): Promise<boolean> {
|
|
220
|
+
const res = await this.asyncCall(
|
|
221
|
+
LogCallMethod.appendTimestampedEntry,
|
|
222
|
+
{ message },
|
|
223
|
+
timeout
|
|
224
|
+
);
|
|
225
|
+
return res.isSuccess();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** 替换全部内容 */
|
|
229
|
+
async replaceAll(
|
|
230
|
+
content: string,
|
|
231
|
+
timeout?: number
|
|
232
|
+
): Promise<boolean> {
|
|
233
|
+
const res = await this.asyncCall(
|
|
234
|
+
LogCallMethod.replaceAll,
|
|
235
|
+
{ content },
|
|
236
|
+
timeout
|
|
237
|
+
);
|
|
238
|
+
return res.isSuccess();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* 订阅 Flow:先收到 subscribed,再多次 update。
|
|
243
|
+
* resolve 后请保留 dispose 或调用 unsubscribe(subscriptionId) 以释放原生协程与 JS 回调。
|
|
244
|
+
*/
|
|
245
|
+
async subscribe(
|
|
246
|
+
stream: LogStreamType,
|
|
247
|
+
onUpdate: (payload: LogSubscribeUpdatePayload) => void,
|
|
248
|
+
options?: { timeout?: number }
|
|
249
|
+
): Promise<{
|
|
250
|
+
subscriptionId: string;
|
|
251
|
+
dispose: () => Promise<void>;
|
|
252
|
+
}> {
|
|
253
|
+
const self = this;
|
|
254
|
+
const callbackId = generateUUID();
|
|
255
|
+
const timeoutSec = options?.timeout ?? 30;
|
|
256
|
+
|
|
257
|
+
return new Promise((resolve, reject) => {
|
|
258
|
+
let settled = false;
|
|
259
|
+
const timer = setTimeout(() => {
|
|
260
|
+
if (!settled) {
|
|
261
|
+
settled = true;
|
|
262
|
+
streamHandlers.delete(callbackId);
|
|
263
|
+
reject(new Error("Log subscribe timeout"));
|
|
264
|
+
}
|
|
265
|
+
}, timeoutSec * 1000);
|
|
266
|
+
|
|
267
|
+
streamHandlers.set(callbackId, (raw: string) => {
|
|
268
|
+
let response: {
|
|
269
|
+
code?: number;
|
|
270
|
+
message?: string;
|
|
271
|
+
data?: {
|
|
272
|
+
event?: string;
|
|
273
|
+
subscriptionId?: string;
|
|
274
|
+
stream?: string;
|
|
275
|
+
text?: string;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
try {
|
|
279
|
+
response = JSON.parse(raw);
|
|
280
|
+
} catch {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const data = response.data;
|
|
284
|
+
const code = response.code;
|
|
285
|
+
|
|
286
|
+
if (typeof code === "number" && code !== 0) {
|
|
287
|
+
if (!settled) {
|
|
288
|
+
settled = true;
|
|
289
|
+
clearTimeout(timer);
|
|
290
|
+
streamHandlers.delete(callbackId);
|
|
291
|
+
reject(
|
|
292
|
+
new Error(
|
|
293
|
+
response.message ?? "Log subscribe failed"
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (data?.event === "subscribed" && data.subscriptionId) {
|
|
301
|
+
if (!settled) {
|
|
302
|
+
settled = true;
|
|
303
|
+
clearTimeout(timer);
|
|
304
|
+
const sid = data.subscriptionId;
|
|
305
|
+
subscriptionIdToCallbackId.set(sid, callbackId);
|
|
306
|
+
resolve({
|
|
307
|
+
subscriptionId: sid,
|
|
308
|
+
dispose: async () => {
|
|
309
|
+
await self.unsubscribe(sid);
|
|
310
|
+
},
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (data?.event === "update" && data.subscriptionId) {
|
|
317
|
+
onUpdate({
|
|
318
|
+
text: data.text ?? "",
|
|
319
|
+
stream: data.stream ?? stream,
|
|
320
|
+
subscriptionId: data.subscriptionId,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
try {
|
|
326
|
+
this.getBridge().call(
|
|
327
|
+
JSON.stringify({
|
|
328
|
+
method: LogCallMethod.subscribe,
|
|
329
|
+
arguments: { stream },
|
|
330
|
+
callbackId,
|
|
331
|
+
})
|
|
332
|
+
);
|
|
333
|
+
} catch (e) {
|
|
334
|
+
clearTimeout(timer);
|
|
335
|
+
streamHandlers.delete(callbackId);
|
|
336
|
+
reject(e);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** 取消订阅(与 Kotlin handleUnsubscribe 对齐) */
|
|
342
|
+
async unsubscribe(
|
|
343
|
+
subscriptionId: string,
|
|
344
|
+
timeout?: number
|
|
345
|
+
): Promise<boolean> {
|
|
346
|
+
const cbId = subscriptionIdToCallbackId.get(subscriptionId);
|
|
347
|
+
const res = await this.asyncCall(
|
|
348
|
+
LogCallMethod.unsubscribe,
|
|
349
|
+
{ subscriptionId },
|
|
350
|
+
timeout
|
|
351
|
+
);
|
|
352
|
+
if (res.isSuccess() && cbId) {
|
|
353
|
+
streamHandlers.delete(cbId);
|
|
354
|
+
subscriptionIdToCallbackId.delete(subscriptionId);
|
|
355
|
+
}
|
|
356
|
+
return res.isSuccess();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/** 截图 + 节点树 + 日志上传(需 Android API 30+) */
|
|
360
|
+
async uploadLogs(
|
|
361
|
+
options?: LogUploadOptions & { timeout?: number }
|
|
362
|
+
): Promise<LogUploadResult> {
|
|
363
|
+
const { timeout = 60, ...args } = options ?? {};
|
|
364
|
+
const payload: Record<string, unknown> = {};
|
|
365
|
+
if (args.baseUrl !== undefined) {
|
|
366
|
+
payload.baseUrl = args.baseUrl;
|
|
367
|
+
}
|
|
368
|
+
if (args.format !== undefined) {
|
|
369
|
+
payload.format = args.format;
|
|
370
|
+
}
|
|
371
|
+
if (args.prettyPrint !== undefined) {
|
|
372
|
+
payload.prettyPrint = args.prettyPrint;
|
|
373
|
+
}
|
|
374
|
+
if (args.overlayHiddenDelayMillis !== undefined) {
|
|
375
|
+
payload.overlayHiddenDelayMillis = args.overlayHiddenDelayMillis;
|
|
376
|
+
}
|
|
377
|
+
if (args.uploadKey !== undefined) {
|
|
378
|
+
payload.uploadKey = args.uploadKey;
|
|
379
|
+
}
|
|
380
|
+
const uuid = generateUUID();
|
|
381
|
+
const params = {
|
|
382
|
+
method: LogCallMethod.uploadLogs,
|
|
383
|
+
arguments:
|
|
384
|
+
Object.keys(payload).length > 0 ? payload : undefined,
|
|
385
|
+
callbackId: uuid,
|
|
386
|
+
};
|
|
387
|
+
const promise = new Promise<string>((resolve) => {
|
|
388
|
+
pendingCallbacks.set(uuid, (data: string) => {
|
|
389
|
+
resolve(data);
|
|
390
|
+
});
|
|
391
|
+
setTimeout(() => {
|
|
392
|
+
pendingCallbacks.delete(uuid);
|
|
393
|
+
resolve(JSON.stringify({ code: -1, data: null, callbackId: uuid }));
|
|
394
|
+
}, timeout * 1000);
|
|
395
|
+
});
|
|
396
|
+
this.getBridge().call(JSON.stringify(params));
|
|
397
|
+
const rawStr = await promise;
|
|
398
|
+
const raw = JSON.parse(rawStr) as {
|
|
399
|
+
code: number;
|
|
400
|
+
data?: LogUploadResult | null;
|
|
401
|
+
message?: string;
|
|
402
|
+
callbackId?: string | null;
|
|
403
|
+
};
|
|
404
|
+
const d = raw.data;
|
|
405
|
+
if (d && typeof d === "object" && "success" in d) {
|
|
406
|
+
return d;
|
|
407
|
+
}
|
|
408
|
+
return {
|
|
409
|
+
success: raw.code === 0,
|
|
410
|
+
message:
|
|
411
|
+
typeof raw.message === "string"
|
|
412
|
+
? raw.message
|
|
413
|
+
: raw.code !== 0
|
|
414
|
+
? "uploadLogs failed"
|
|
415
|
+
: "",
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 注册 onAssistsLogUpdate 推送监听(ASWebView 注入的 Base64 CallResponse,解码后见 LogUpdateEvent)
|
|
421
|
+
*/
|
|
422
|
+
addLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void {
|
|
423
|
+
logUpdateListeners.push(listener);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* 移除先前通过 addLogUpdateListener 注册的同一函数引用
|
|
428
|
+
*/
|
|
429
|
+
removeLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void {
|
|
430
|
+
const i = logUpdateListeners.indexOf(listener);
|
|
431
|
+
if (i !== -1) {
|
|
432
|
+
logUpdateListeners.splice(i, 1);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** 默认单例,用法与 floatingwindow 模块导出的 float 一致 */
|
|
438
|
+
export const log = new Log();
|
|
439
|
+
|
|
440
|
+
export {
|
|
441
|
+
LogCallMethod,
|
|
442
|
+
LogStream,
|
|
443
|
+
type LogCallMethodType,
|
|
444
|
+
type LogStreamType,
|
|
445
|
+
} from "./log-call-method";
|
package/src/mlkit/mlkit.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* ML Kit 文字识别相关功能
|
|
3
3
|
* 提供识别屏幕中指定词组位置、识别屏幕文字内容位置的能力
|
|
4
4
|
*/
|
|
5
|
-
import { CallResponse } from "../
|
|
6
|
-
import { decodeBase64UTF8, generateUUID } from "../
|
|
7
|
-
import { MlkitCallMethod } from "./
|
|
5
|
+
import { CallResponse } from "../call-response";
|
|
6
|
+
import { decodeBase64UTF8, generateUUID } from "../utils";
|
|
7
|
+
import { MlkitCallMethod } from "./mlkit-call-method";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* 识别区域接口,用于限定识别范围
|
package/src/network/http.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* HTTP 请求相关功能
|
|
3
3
|
* 提供 HTTP 请求相关的功能,包括 GET、POST、文件上传和下载
|
|
4
4
|
*/
|
|
5
|
-
import { CallResponse } from "../
|
|
6
|
-
import { decodeBase64UTF8, generateUUID } from "../
|
|
5
|
+
import { CallResponse } from "../call-response";
|
|
6
|
+
import { decodeBase64UTF8, generateUUID } from "../utils";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* HTTP 响应数据接口定义
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* 节点类
|
|
3
3
|
* 表示界面上的一个可交互元素,包含元素的属性和可执行的操作
|
|
4
4
|
*/
|
|
5
|
-
import { Bounds } from "./
|
|
6
|
-
import { AssistsX } from "./
|
|
7
|
-
import { Step } from "./
|
|
8
|
-
import { AssistsXAsync } from "./
|
|
9
|
-
import { Node } from "./
|
|
5
|
+
import { Bounds } from "./bounds";
|
|
6
|
+
import { AssistsX } from "./assistsx";
|
|
7
|
+
import { Step } from "./step";
|
|
8
|
+
import { AssistsXAsync } from "./assistsx-async";
|
|
9
|
+
import { Node } from "./node";
|
|
10
10
|
|
|
11
11
|
export class NodeAsync {
|
|
12
12
|
private node: Node;
|
package/src/{Node.ts → node.ts}
RENAMED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* 节点类
|
|
3
3
|
* 表示界面上的一个可交互元素,包含元素的属性和可执行的操作
|
|
4
4
|
*/
|
|
5
|
-
import { Bounds } from "./
|
|
6
|
-
import { AssistsX } from "./
|
|
7
|
-
import { AssistsXAsync } from "./
|
|
8
|
-
import { Step } from "./
|
|
9
|
-
import { NodeAsync } from "./
|
|
5
|
+
import { Bounds } from "./bounds";
|
|
6
|
+
import { AssistsX } from "./assistsx";
|
|
7
|
+
import { AssistsXAsync } from "./assistsx-async";
|
|
8
|
+
import { Step } from "./step";
|
|
9
|
+
import { NodeAsync } from "./node-async";
|
|
10
10
|
|
|
11
11
|
// 将接口改造为类
|
|
12
12
|
export class Node {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* 步骤执行控制类
|
|
3
3
|
* 用于管理和执行自动化步骤,提供步骤的生命周期管理、状态控制和界面操作功能
|
|
4
4
|
*/
|
|
5
|
-
import { AssistsX } from "./
|
|
6
|
-
import { Node } from "./
|
|
7
|
-
import { CallMethod } from "./
|
|
8
|
-
import { useStepStore } from "./
|
|
9
|
-
import { generateUUID } from "./
|
|
10
|
-
import { StepError } from "./
|
|
11
|
-
import { AssistsXAsync } from "./
|
|
12
|
-
import { Step } from "./
|
|
5
|
+
import { AssistsX } from "./assistsx";
|
|
6
|
+
import { Node } from "./node";
|
|
7
|
+
import { CallMethod } from "./call-method";
|
|
8
|
+
import { useStepStore } from "./step-state-store";
|
|
9
|
+
import { generateUUID } from "./utils";
|
|
10
|
+
import { StepError } from "./step-error";
|
|
11
|
+
import { AssistsXAsync } from "./assistsx-async";
|
|
12
|
+
import { Step } from "./step";
|
|
13
13
|
|
|
14
14
|
export class StepAsync {
|
|
15
15
|
private step: Step;
|
package/src/{Step.ts → step.ts}
RENAMED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* 步骤执行控制类
|
|
3
3
|
* 用于管理和执行自动化步骤,提供步骤的生命周期管理、状态控制和界面操作功能
|
|
4
4
|
*/
|
|
5
|
-
import { AssistsX } from "./
|
|
6
|
-
import { Node } from "./
|
|
7
|
-
import { CallMethod } from "./
|
|
8
|
-
import { useStepStore } from "./
|
|
9
|
-
import { generateUUID } from "./
|
|
10
|
-
import { StepError, StepStopError } from "./
|
|
11
|
-
import { StepAsync } from "./
|
|
5
|
+
import { AssistsX } from "./assistsx";
|
|
6
|
+
import { Node } from "./node";
|
|
7
|
+
import { CallMethod } from "./call-method";
|
|
8
|
+
import { useStepStore } from "./step-state-store";
|
|
9
|
+
import { generateUUID } from "./utils";
|
|
10
|
+
import { StepError, StepStopError } from "./step-error";
|
|
11
|
+
import { StepAsync } from "./step-async";
|
|
12
12
|
|
|
13
13
|
// 步骤结果类型,可以是Step实例或undefined
|
|
14
14
|
export type StepResult = Step | undefined;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|