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/dist/index.d.mts
CHANGED
|
@@ -4111,4 +4111,121 @@ declare const FloatCallMethod: {
|
|
|
4111
4111
|
};
|
|
4112
4112
|
type FloatCallMethodType = (typeof FloatCallMethod)[keyof typeof FloatCallMethod];
|
|
4113
4113
|
|
|
4114
|
-
|
|
4114
|
+
/**
|
|
4115
|
+
* 日志桥接方法名(与 tools/log/AssistsLogCallMethod.kt 一致)
|
|
4116
|
+
*/
|
|
4117
|
+
declare const LogCallMethod: {
|
|
4118
|
+
readonly readAllText: "readAllText";
|
|
4119
|
+
readonly clear: "clear";
|
|
4120
|
+
readonly refreshFromFile: "refreshFromFile";
|
|
4121
|
+
readonly appendLine: "appendLine";
|
|
4122
|
+
readonly appendTimestampedEntry: "appendTimestampedEntry";
|
|
4123
|
+
readonly replaceAll: "replaceAll";
|
|
4124
|
+
readonly subscribe: "subscribe";
|
|
4125
|
+
readonly unsubscribe: "unsubscribe";
|
|
4126
|
+
readonly uploadLogs: "uploadLogs";
|
|
4127
|
+
/** 获取日志服务当前域名(origin,无路径;与上传、管理后台同源),对应 AssistsLogDiagnostics.adminWebBaseUrl() */
|
|
4128
|
+
readonly getLogServiceBaseUrl: "getLogServiceBaseUrl";
|
|
4129
|
+
};
|
|
4130
|
+
/** 与 ASWebView / AssistsLogJavascriptInterface companion 对齐 */
|
|
4131
|
+
declare const LogStream: {
|
|
4132
|
+
readonly latestLine: "latestLine";
|
|
4133
|
+
readonly entireLogText: "entireLogText";
|
|
4134
|
+
};
|
|
4135
|
+
type LogStreamType = (typeof LogStream)[keyof typeof LogStream];
|
|
4136
|
+
type LogCallMethodType = (typeof LogCallMethod)[keyof typeof LogCallMethod];
|
|
4137
|
+
|
|
4138
|
+
/**
|
|
4139
|
+
* onAssistsLogUpdate 推送的监听器列表(与 accessibilityEventListeners 风格一致)。
|
|
4140
|
+
* 在页面加载本模块后,向此数组 push,或使用 log.addLogUpdateListener。
|
|
4141
|
+
* 注意:若页面在 import 本模块之前已自定义 `window.onAssistsLogUpdate`,则不会安装默认分发函数,需自行解码并转发到监听器。
|
|
4142
|
+
*/
|
|
4143
|
+
declare const logUpdateListeners: Array<(payload: LogUpdateEvent) => void>;
|
|
4144
|
+
/**
|
|
4145
|
+
* Base64 解码后的 CallResponse,data 含 stream / text
|
|
4146
|
+
*/
|
|
4147
|
+
interface LogUpdateEvent {
|
|
4148
|
+
code: number;
|
|
4149
|
+
data: LogUpdateData | null;
|
|
4150
|
+
message?: string;
|
|
4151
|
+
callbackId?: string | null;
|
|
4152
|
+
}
|
|
4153
|
+
interface LogUpdateData {
|
|
4154
|
+
stream: LogStreamType;
|
|
4155
|
+
text: string;
|
|
4156
|
+
}
|
|
4157
|
+
interface LogSubscribeUpdatePayload {
|
|
4158
|
+
text: string;
|
|
4159
|
+
stream: string;
|
|
4160
|
+
subscriptionId: string;
|
|
4161
|
+
}
|
|
4162
|
+
interface LogUploadOptions {
|
|
4163
|
+
baseUrl?: string;
|
|
4164
|
+
/** PNG(默认)| JPEG | JPG | WEBP */
|
|
4165
|
+
format?: "PNG" | "JPEG" | "JPG" | "WEBP" | string;
|
|
4166
|
+
prettyPrint?: boolean;
|
|
4167
|
+
overlayHiddenDelayMillis?: number;
|
|
4168
|
+
/** 与 Kotlin handleUploadLogs / AssistsLogDiagnostics.uploadLogs 的 uploadKey 一致 */
|
|
4169
|
+
uploadKey?: string;
|
|
4170
|
+
}
|
|
4171
|
+
/** 与 Kotlin assistsLogUploadResultToJson 对齐 */
|
|
4172
|
+
interface LogUploadResult {
|
|
4173
|
+
success: boolean;
|
|
4174
|
+
message: string;
|
|
4175
|
+
httpCode?: number;
|
|
4176
|
+
responseBody?: string;
|
|
4177
|
+
data?: unknown;
|
|
4178
|
+
localLogFilePath?: string;
|
|
4179
|
+
localScreenshotFilePath?: string;
|
|
4180
|
+
localNodeTreeFilePath?: string;
|
|
4181
|
+
causeMessage?: string;
|
|
4182
|
+
}
|
|
4183
|
+
declare class Log {
|
|
4184
|
+
private getBridge;
|
|
4185
|
+
private asyncCall;
|
|
4186
|
+
/** 读取当前日志全文 */
|
|
4187
|
+
readAllText(timeout?: number): Promise<string>;
|
|
4188
|
+
/**
|
|
4189
|
+
* 获取日志服务当前域名(origin,无路径;与上传、管理后台同源)。
|
|
4190
|
+
* 与 Kotlin getLogServiceBaseUrl / adminWebBaseUrl 对齐。
|
|
4191
|
+
*/
|
|
4192
|
+
getLogServiceBaseUrl(timeout?: number): Promise<string>;
|
|
4193
|
+
/** 清空日志 */
|
|
4194
|
+
clear(timeout?: number): Promise<boolean>;
|
|
4195
|
+
/** 从文件重新加载到内存 Flow */
|
|
4196
|
+
refreshFromFile(timeout?: number): Promise<boolean>;
|
|
4197
|
+
/** 追加一行 */
|
|
4198
|
+
appendLine(line: string, maxLength?: number, timeout?: number): Promise<boolean>;
|
|
4199
|
+
/** 追加带时间戳的条目 */
|
|
4200
|
+
appendTimestampedEntry(message: string, timeout?: number): Promise<boolean>;
|
|
4201
|
+
/** 替换全部内容 */
|
|
4202
|
+
replaceAll(content: string, timeout?: number): Promise<boolean>;
|
|
4203
|
+
/**
|
|
4204
|
+
* 订阅 Flow:先收到 subscribed,再多次 update。
|
|
4205
|
+
* resolve 后请保留 dispose 或调用 unsubscribe(subscriptionId) 以释放原生协程与 JS 回调。
|
|
4206
|
+
*/
|
|
4207
|
+
subscribe(stream: LogStreamType, onUpdate: (payload: LogSubscribeUpdatePayload) => void, options?: {
|
|
4208
|
+
timeout?: number;
|
|
4209
|
+
}): Promise<{
|
|
4210
|
+
subscriptionId: string;
|
|
4211
|
+
dispose: () => Promise<void>;
|
|
4212
|
+
}>;
|
|
4213
|
+
/** 取消订阅(与 Kotlin handleUnsubscribe 对齐) */
|
|
4214
|
+
unsubscribe(subscriptionId: string, timeout?: number): Promise<boolean>;
|
|
4215
|
+
/** 截图 + 节点树 + 日志上传(需 Android API 30+) */
|
|
4216
|
+
uploadLogs(options?: LogUploadOptions & {
|
|
4217
|
+
timeout?: number;
|
|
4218
|
+
}): Promise<LogUploadResult>;
|
|
4219
|
+
/**
|
|
4220
|
+
* 注册 onAssistsLogUpdate 推送监听(ASWebView 注入的 Base64 CallResponse,解码后见 LogUpdateEvent)
|
|
4221
|
+
*/
|
|
4222
|
+
addLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void;
|
|
4223
|
+
/**
|
|
4224
|
+
* 移除先前通过 addLogUpdateListener 注册的同一函数引用
|
|
4225
|
+
*/
|
|
4226
|
+
removeLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void;
|
|
4227
|
+
}
|
|
4228
|
+
/** 默认单例,用法与 floatingwindow 模块导出的 float 一致 */
|
|
4229
|
+
declare const log: Log;
|
|
4230
|
+
|
|
4231
|
+
export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, Node, NodeAsync, NodeClassValue, type OpenInputMethodSettingsResponse, Path, type PerformEditorActionResponse, type RecognizeTextInScreenshotPosition, type RecognizeTextInScreenshotResult, type RecognizeTextRegion, type Screen, type ScreenTextJsonResult, type ScreenTextRecognitionResult, Step, StepAsync, StepError, type StepImpl, type StepInterceptor, type StepResult, type StepState, type StepStatus, StepStopError, type TextPosition, type WebFloatingWindowOptions, WindowFlags, accessibilityEventListeners, barUtils, callbacks, decodeBase64UTF8, fileIO, fileUtils, float, gallery, generateUUID, http, imageUtils, ime, log, logUpdateListeners, mlkit, pathUtils, screen, sleep, useStepStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -4111,4 +4111,121 @@ declare const FloatCallMethod: {
|
|
|
4111
4111
|
};
|
|
4112
4112
|
type FloatCallMethodType = (typeof FloatCallMethod)[keyof typeof FloatCallMethod];
|
|
4113
4113
|
|
|
4114
|
-
|
|
4114
|
+
/**
|
|
4115
|
+
* 日志桥接方法名(与 tools/log/AssistsLogCallMethod.kt 一致)
|
|
4116
|
+
*/
|
|
4117
|
+
declare const LogCallMethod: {
|
|
4118
|
+
readonly readAllText: "readAllText";
|
|
4119
|
+
readonly clear: "clear";
|
|
4120
|
+
readonly refreshFromFile: "refreshFromFile";
|
|
4121
|
+
readonly appendLine: "appendLine";
|
|
4122
|
+
readonly appendTimestampedEntry: "appendTimestampedEntry";
|
|
4123
|
+
readonly replaceAll: "replaceAll";
|
|
4124
|
+
readonly subscribe: "subscribe";
|
|
4125
|
+
readonly unsubscribe: "unsubscribe";
|
|
4126
|
+
readonly uploadLogs: "uploadLogs";
|
|
4127
|
+
/** 获取日志服务当前域名(origin,无路径;与上传、管理后台同源),对应 AssistsLogDiagnostics.adminWebBaseUrl() */
|
|
4128
|
+
readonly getLogServiceBaseUrl: "getLogServiceBaseUrl";
|
|
4129
|
+
};
|
|
4130
|
+
/** 与 ASWebView / AssistsLogJavascriptInterface companion 对齐 */
|
|
4131
|
+
declare const LogStream: {
|
|
4132
|
+
readonly latestLine: "latestLine";
|
|
4133
|
+
readonly entireLogText: "entireLogText";
|
|
4134
|
+
};
|
|
4135
|
+
type LogStreamType = (typeof LogStream)[keyof typeof LogStream];
|
|
4136
|
+
type LogCallMethodType = (typeof LogCallMethod)[keyof typeof LogCallMethod];
|
|
4137
|
+
|
|
4138
|
+
/**
|
|
4139
|
+
* onAssistsLogUpdate 推送的监听器列表(与 accessibilityEventListeners 风格一致)。
|
|
4140
|
+
* 在页面加载本模块后,向此数组 push,或使用 log.addLogUpdateListener。
|
|
4141
|
+
* 注意:若页面在 import 本模块之前已自定义 `window.onAssistsLogUpdate`,则不会安装默认分发函数,需自行解码并转发到监听器。
|
|
4142
|
+
*/
|
|
4143
|
+
declare const logUpdateListeners: Array<(payload: LogUpdateEvent) => void>;
|
|
4144
|
+
/**
|
|
4145
|
+
* Base64 解码后的 CallResponse,data 含 stream / text
|
|
4146
|
+
*/
|
|
4147
|
+
interface LogUpdateEvent {
|
|
4148
|
+
code: number;
|
|
4149
|
+
data: LogUpdateData | null;
|
|
4150
|
+
message?: string;
|
|
4151
|
+
callbackId?: string | null;
|
|
4152
|
+
}
|
|
4153
|
+
interface LogUpdateData {
|
|
4154
|
+
stream: LogStreamType;
|
|
4155
|
+
text: string;
|
|
4156
|
+
}
|
|
4157
|
+
interface LogSubscribeUpdatePayload {
|
|
4158
|
+
text: string;
|
|
4159
|
+
stream: string;
|
|
4160
|
+
subscriptionId: string;
|
|
4161
|
+
}
|
|
4162
|
+
interface LogUploadOptions {
|
|
4163
|
+
baseUrl?: string;
|
|
4164
|
+
/** PNG(默认)| JPEG | JPG | WEBP */
|
|
4165
|
+
format?: "PNG" | "JPEG" | "JPG" | "WEBP" | string;
|
|
4166
|
+
prettyPrint?: boolean;
|
|
4167
|
+
overlayHiddenDelayMillis?: number;
|
|
4168
|
+
/** 与 Kotlin handleUploadLogs / AssistsLogDiagnostics.uploadLogs 的 uploadKey 一致 */
|
|
4169
|
+
uploadKey?: string;
|
|
4170
|
+
}
|
|
4171
|
+
/** 与 Kotlin assistsLogUploadResultToJson 对齐 */
|
|
4172
|
+
interface LogUploadResult {
|
|
4173
|
+
success: boolean;
|
|
4174
|
+
message: string;
|
|
4175
|
+
httpCode?: number;
|
|
4176
|
+
responseBody?: string;
|
|
4177
|
+
data?: unknown;
|
|
4178
|
+
localLogFilePath?: string;
|
|
4179
|
+
localScreenshotFilePath?: string;
|
|
4180
|
+
localNodeTreeFilePath?: string;
|
|
4181
|
+
causeMessage?: string;
|
|
4182
|
+
}
|
|
4183
|
+
declare class Log {
|
|
4184
|
+
private getBridge;
|
|
4185
|
+
private asyncCall;
|
|
4186
|
+
/** 读取当前日志全文 */
|
|
4187
|
+
readAllText(timeout?: number): Promise<string>;
|
|
4188
|
+
/**
|
|
4189
|
+
* 获取日志服务当前域名(origin,无路径;与上传、管理后台同源)。
|
|
4190
|
+
* 与 Kotlin getLogServiceBaseUrl / adminWebBaseUrl 对齐。
|
|
4191
|
+
*/
|
|
4192
|
+
getLogServiceBaseUrl(timeout?: number): Promise<string>;
|
|
4193
|
+
/** 清空日志 */
|
|
4194
|
+
clear(timeout?: number): Promise<boolean>;
|
|
4195
|
+
/** 从文件重新加载到内存 Flow */
|
|
4196
|
+
refreshFromFile(timeout?: number): Promise<boolean>;
|
|
4197
|
+
/** 追加一行 */
|
|
4198
|
+
appendLine(line: string, maxLength?: number, timeout?: number): Promise<boolean>;
|
|
4199
|
+
/** 追加带时间戳的条目 */
|
|
4200
|
+
appendTimestampedEntry(message: string, timeout?: number): Promise<boolean>;
|
|
4201
|
+
/** 替换全部内容 */
|
|
4202
|
+
replaceAll(content: string, timeout?: number): Promise<boolean>;
|
|
4203
|
+
/**
|
|
4204
|
+
* 订阅 Flow:先收到 subscribed,再多次 update。
|
|
4205
|
+
* resolve 后请保留 dispose 或调用 unsubscribe(subscriptionId) 以释放原生协程与 JS 回调。
|
|
4206
|
+
*/
|
|
4207
|
+
subscribe(stream: LogStreamType, onUpdate: (payload: LogSubscribeUpdatePayload) => void, options?: {
|
|
4208
|
+
timeout?: number;
|
|
4209
|
+
}): Promise<{
|
|
4210
|
+
subscriptionId: string;
|
|
4211
|
+
dispose: () => Promise<void>;
|
|
4212
|
+
}>;
|
|
4213
|
+
/** 取消订阅(与 Kotlin handleUnsubscribe 对齐) */
|
|
4214
|
+
unsubscribe(subscriptionId: string, timeout?: number): Promise<boolean>;
|
|
4215
|
+
/** 截图 + 节点树 + 日志上传(需 Android API 30+) */
|
|
4216
|
+
uploadLogs(options?: LogUploadOptions & {
|
|
4217
|
+
timeout?: number;
|
|
4218
|
+
}): Promise<LogUploadResult>;
|
|
4219
|
+
/**
|
|
4220
|
+
* 注册 onAssistsLogUpdate 推送监听(ASWebView 注入的 Base64 CallResponse,解码后见 LogUpdateEvent)
|
|
4221
|
+
*/
|
|
4222
|
+
addLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void;
|
|
4223
|
+
/**
|
|
4224
|
+
* 移除先前通过 addLogUpdateListener 注册的同一函数引用
|
|
4225
|
+
*/
|
|
4226
|
+
removeLogUpdateListener(listener: (payload: LogUpdateEvent) => void): void;
|
|
4227
|
+
}
|
|
4228
|
+
/** 默认单例,用法与 floatingwindow 模块导出的 float 一致 */
|
|
4229
|
+
declare const log: Log;
|
|
4230
|
+
|
|
4231
|
+
export { type AccessibilityEvent, type AccessibilityEventData, AccessibilityEventFilter, type AccessibilityEventFilterConfig, type AccessibilityEventListener, AppInfo, AssistsX, AssistsXAsync, BarUtils, BarUtilsCallMethod, type BarUtilsCallMethodType, Bounds, CallMethod, type CallMethodType, CallResponse, type Contact, DeviceInfo, FileIO, type FileInfo, type FileListItem, type FileUploadInfo, FileUtils, Float, FloatCallMethod, type FloatCallMethodType, Gallery, type GalleryDeleteResponse, type GalleryResponse, Http, type HttpConfig, type HttpDownloadResponse, type HttpResponse, type ImageProcessResult, type ImageRotateDegree, type ImageSaveResult, type ImageSize, type ImageType, ImageUtils, Ime, ImeAction, type IsCurrentInputMethodResponse, type IsInputMethodEnabledResponse, Log, LogCallMethod, type LogCallMethodType, LogStream, type LogStreamType, type LogSubscribeUpdatePayload, type LogUpdateData, type LogUpdateEvent, type LogUploadOptions, type LogUploadResult, Mlkit, MlkitCallMethod, type MlkitCallMethodType, type MlkitRegion, Node, NodeAsync, NodeClassValue, type OpenInputMethodSettingsResponse, Path, type PerformEditorActionResponse, type RecognizeTextInScreenshotPosition, type RecognizeTextInScreenshotResult, type RecognizeTextRegion, type Screen, type ScreenTextJsonResult, type ScreenTextRecognitionResult, Step, StepAsync, StepError, type StepImpl, type StepInterceptor, type StepResult, type StepState, type StepStatus, StepStopError, type TextPosition, type WebFloatingWindowOptions, WindowFlags, accessibilityEventListeners, barUtils, callbacks, decodeBase64UTF8, fileIO, fileUtils, float, gallery, generateUUID, http, imageUtils, ime, log, logUpdateListeners, mlkit, pathUtils, screen, sleep, useStepStore };
|