@maaxyz/maa-node 4.5.6 → 5.0.0-alpha.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/dist/client.d.ts +18 -13
- package/dist/constant.d.ts +28 -0
- package/dist/context.d.ts +33 -53
- package/dist/controller.d.ts +225 -157
- package/dist/global.d.ts +17 -9
- package/dist/index-client.d.ts +12 -12
- package/dist/index-client.js +23 -982
- package/dist/index-server.d.ts +12 -12
- package/dist/index-server.js +23 -990
- package/dist/job.d.ts +30 -22
- package/dist/pipeline.d.ts +355 -211
- package/dist/plugin.d.ts +16 -0
- package/dist/resource.d.ts +47 -39
- package/dist/server.d.ts +24 -9
- package/dist/tasker.d.ts +97 -136
- package/dist/types.d.ts +61 -27
- package/package.json +9 -12
- package/src/index-client.js +27 -0
- package/src/index-server.js +27 -0
- package/dist/maa.d.ts +0 -422
- package/dist/pi.d.ts +0 -9
- package/dist/utils.d.ts +0 -5
- package/scripts/build.mjs +0 -20
- package/src/client.ts +0 -54
- package/src/context.ts +0 -91
- package/src/controller.ts +0 -430
- package/src/global.ts +0 -37
- package/src/index-client.ts +0 -14
- package/src/index-server.ts +0 -14
- package/src/job.ts +0 -68
- package/src/maa-client.js +0 -27
- package/src/maa-server.js +0 -27
- package/src/maa.d.ts +0 -422
- package/src/maa.js +0 -1
- package/src/pi.ts +0 -66
- package/src/pipeline.ts +0 -352
- package/src/resource.ts +0 -203
- package/src/server.ts +0 -64
- package/src/tasker.ts +0 -244
- package/src/types.ts +0 -33
- package/src/utils.ts +0 -40
- package/tsconfig.json +0 -9
package/src/maa.d.ts
DELETED
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
export type AgentClientHandle = { __brand: 'AgentClientHandle' }
|
|
2
|
-
export type ResourceHandle = { __brand: 'ResourceHandle' }
|
|
3
|
-
export type ControllerHandle = { __brand: 'ControllerHandle' }
|
|
4
|
-
export type TaskerHandle = { __brand: 'TaskerHandle' }
|
|
5
|
-
export type ContextHandle = { __brand: 'ContextHandle' }
|
|
6
|
-
export type DesktopHandle = string & { __brand: 'DesktopHandle' }
|
|
7
|
-
|
|
8
|
-
type Uint64 = number | string
|
|
9
|
-
type Id = Uint64
|
|
10
|
-
type ScreencapOrInputMethods = Uint64
|
|
11
|
-
|
|
12
|
-
export type ResId = Id & { __brand: 'ResId' }
|
|
13
|
-
export type CtrlId = Id & { __brand: 'CtrlId' }
|
|
14
|
-
export type TaskId = Id & { __brand: 'TaskId' }
|
|
15
|
-
export type RecoId = Id & { __brand: 'RecoId' }
|
|
16
|
-
export type NodeId = Id & { __brand: 'NodeId' }
|
|
17
|
-
|
|
18
|
-
export type Status = number & { __brand: 'Status' }
|
|
19
|
-
export type LoggingLevel = number & { __brand: 'LoggingLevel' }
|
|
20
|
-
export type InferenceDevice = number & { __brand: 'InferenceDevice' }
|
|
21
|
-
export type InferenceExecutionProvider = number & { __brand: 'InferenceExecutionProvider' }
|
|
22
|
-
|
|
23
|
-
export type ImageData = ArrayBuffer
|
|
24
|
-
|
|
25
|
-
export type Rect = {
|
|
26
|
-
x: number
|
|
27
|
-
y: number
|
|
28
|
-
width: number
|
|
29
|
-
height: number
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type FlatRect = [x: number, y: number, width: number, height: number]
|
|
33
|
-
|
|
34
|
-
type MaybePromise<T> = T | Promise<T>
|
|
35
|
-
|
|
36
|
-
export type NotificationCallback = (message: string, details_json: string) => MaybePromise<void>
|
|
37
|
-
export type CustomRecognitionCallback = (
|
|
38
|
-
context: ContextHandle,
|
|
39
|
-
task_id: TaskId,
|
|
40
|
-
node_name: string,
|
|
41
|
-
custom_recognition_name: string,
|
|
42
|
-
custom_recognition_param: string,
|
|
43
|
-
image: ImageData,
|
|
44
|
-
roi: Rect
|
|
45
|
-
) => MaybePromise<[out_box: Rect, out_detail: string] | null>
|
|
46
|
-
export type CustomActionCallback = (
|
|
47
|
-
context: ContextHandle,
|
|
48
|
-
task_id: TaskId,
|
|
49
|
-
node_name: string,
|
|
50
|
-
custom_action_name: string,
|
|
51
|
-
custom_action_param: string,
|
|
52
|
-
reco_id: RecoId,
|
|
53
|
-
box: Rect
|
|
54
|
-
) => MaybePromise<boolean>
|
|
55
|
-
|
|
56
|
-
export type CustomControllerParamResultMap = {
|
|
57
|
-
connect: [[], boolean]
|
|
58
|
-
request_uuid: [[], string | null]
|
|
59
|
-
start_app: [[intent: string], boolean]
|
|
60
|
-
stop_app: [[intent: string], boolean]
|
|
61
|
-
screencap: [[], ImageData | null]
|
|
62
|
-
click: [[x: number, y: number], boolean]
|
|
63
|
-
swipe: [[x1: number, y1: number, x2: number, y2: number, duration: number], boolean]
|
|
64
|
-
touch_down: [[contact: number, x: number, y: number, pressure: number], boolean]
|
|
65
|
-
touch_move: [[contact: number, x: number, y: number, pressure: number], boolean]
|
|
66
|
-
touch_up: [[contact: number], boolean]
|
|
67
|
-
click_key: [[keycode: number], boolean]
|
|
68
|
-
input_text: [[text: string], boolean]
|
|
69
|
-
key_down: [[keycode: number], boolean]
|
|
70
|
-
key_up: [[keycode: number], boolean]
|
|
71
|
-
}
|
|
72
|
-
export type CustomControllerCallback = (
|
|
73
|
-
action: keyof CustomControllerParamResultMap,
|
|
74
|
-
...param: any[]
|
|
75
|
-
) => MaybePromise<any>
|
|
76
|
-
|
|
77
|
-
// context.cpp
|
|
78
|
-
|
|
79
|
-
export declare function context_run_task(
|
|
80
|
-
context: ContextHandle,
|
|
81
|
-
entry: string,
|
|
82
|
-
pipeline_override: string
|
|
83
|
-
): Promise<TaskId>
|
|
84
|
-
export declare function context_run_recognition(
|
|
85
|
-
context: ContextHandle,
|
|
86
|
-
entry: string,
|
|
87
|
-
pipeline_override: string,
|
|
88
|
-
image: ImageData
|
|
89
|
-
): Promise<RecoId>
|
|
90
|
-
export declare function context_run_action(
|
|
91
|
-
context: ContextHandle,
|
|
92
|
-
entry: string,
|
|
93
|
-
pipeline_override: string,
|
|
94
|
-
box: Rect,
|
|
95
|
-
reco_detail: string
|
|
96
|
-
): Promise<NodeId>
|
|
97
|
-
export declare function context_override_pipeline(
|
|
98
|
-
context: ContextHandle,
|
|
99
|
-
pipeline_override: string
|
|
100
|
-
): boolean
|
|
101
|
-
export declare function context_override_next(
|
|
102
|
-
context: ContextHandle,
|
|
103
|
-
node_name: string,
|
|
104
|
-
next: string[]
|
|
105
|
-
): boolean
|
|
106
|
-
export declare function context_get_node_data(
|
|
107
|
-
context: ContextHandle,
|
|
108
|
-
node_name: string
|
|
109
|
-
): string | null
|
|
110
|
-
export declare function context_get_task_id(context: ContextHandle): TaskId
|
|
111
|
-
export declare function context_get_tasker(context: ContextHandle): TaskerHandle
|
|
112
|
-
export declare function context_clone(context: ContextHandle): ContextHandle
|
|
113
|
-
|
|
114
|
-
// controller.cpp
|
|
115
|
-
|
|
116
|
-
export declare function adb_controller_create(
|
|
117
|
-
adb_path: string,
|
|
118
|
-
address: string,
|
|
119
|
-
screencap_methods: ScreencapOrInputMethods,
|
|
120
|
-
input_methods: ScreencapOrInputMethods,
|
|
121
|
-
config: string,
|
|
122
|
-
agent_path: string,
|
|
123
|
-
callback: NotificationCallback | null
|
|
124
|
-
): ControllerHandle | null
|
|
125
|
-
export declare function win32_controller_create(
|
|
126
|
-
handle: DesktopHandle,
|
|
127
|
-
screencap_methods: ScreencapOrInputMethods,
|
|
128
|
-
input_methods: ScreencapOrInputMethods,
|
|
129
|
-
callback: NotificationCallback | null
|
|
130
|
-
): ControllerHandle | null
|
|
131
|
-
export declare function custom_controller_create(
|
|
132
|
-
custom_callback: CustomControllerCallback,
|
|
133
|
-
callback: NotificationCallback | null
|
|
134
|
-
): ControllerHandle | null
|
|
135
|
-
export declare function dbg_controller_create(
|
|
136
|
-
read_path: string,
|
|
137
|
-
write_path: string,
|
|
138
|
-
type: Uint64,
|
|
139
|
-
config: string,
|
|
140
|
-
callback: NotificationCallback | null
|
|
141
|
-
): ControllerHandle | null
|
|
142
|
-
export declare function controller_destroy(handle: ControllerHandle): void
|
|
143
|
-
export declare function controller_set_option_screenshot_target_long_side(
|
|
144
|
-
handle: ControllerHandle,
|
|
145
|
-
value: number
|
|
146
|
-
): boolean
|
|
147
|
-
export declare function controller_set_option_screenshot_target_short_side(
|
|
148
|
-
handle: ControllerHandle,
|
|
149
|
-
value: number
|
|
150
|
-
): boolean
|
|
151
|
-
export declare function controller_set_option_screenshot_use_raw_size(
|
|
152
|
-
handle: ControllerHandle,
|
|
153
|
-
value: boolean
|
|
154
|
-
): boolean
|
|
155
|
-
export declare function controller_post_connection(handle: ControllerHandle): CtrlId
|
|
156
|
-
export declare function controller_post_click(
|
|
157
|
-
handle: ControllerHandle,
|
|
158
|
-
x: number,
|
|
159
|
-
y: number
|
|
160
|
-
): CtrlId
|
|
161
|
-
export declare function controller_post_swipe(
|
|
162
|
-
handle: ControllerHandle,
|
|
163
|
-
x1: number,
|
|
164
|
-
y1: number,
|
|
165
|
-
x2: number,
|
|
166
|
-
y2: number,
|
|
167
|
-
duration: number
|
|
168
|
-
): CtrlId
|
|
169
|
-
export declare function controller_post_click_key(handle: ControllerHandle, keycode: number): CtrlId
|
|
170
|
-
export declare function controller_post_key_down(handle: ControllerHandle, keycode: number): CtrlId
|
|
171
|
-
export declare function controller_post_key_up(handle: ControllerHandle, keycode: number): CtrlId
|
|
172
|
-
export declare function controller_post_input_text(handle: ControllerHandle, text: string): CtrlId
|
|
173
|
-
export declare function controller_post_start_app(handle: ControllerHandle, intent: string): CtrlId
|
|
174
|
-
export declare function controller_post_stop_app(handle: ControllerHandle, intent: string): CtrlId
|
|
175
|
-
export declare function controller_post_touch_down(
|
|
176
|
-
handle: ControllerHandle,
|
|
177
|
-
contact: number,
|
|
178
|
-
x: number,
|
|
179
|
-
y: number,
|
|
180
|
-
pressure: number
|
|
181
|
-
): CtrlId
|
|
182
|
-
export declare function controller_post_touch_move(
|
|
183
|
-
handle: ControllerHandle,
|
|
184
|
-
contact: number,
|
|
185
|
-
x: number,
|
|
186
|
-
y: number,
|
|
187
|
-
pressure: number
|
|
188
|
-
): CtrlId
|
|
189
|
-
export declare function controller_post_touch_up(handle: ControllerHandle, contact: number): CtrlId
|
|
190
|
-
export declare function controller_post_screencap(handle: ControllerHandle): CtrlId
|
|
191
|
-
export declare function controller_status(handle: ControllerHandle, ctrl_id: CtrlId): Status
|
|
192
|
-
export declare function controller_wait(handle: ControllerHandle, ctrl_id: CtrlId): Promise<Status>
|
|
193
|
-
export declare function controller_connected(handle: ControllerHandle): boolean
|
|
194
|
-
export declare function controller_cached_image(handle: ControllerHandle): ImageData | null
|
|
195
|
-
export declare function controller_get_uuid(handle: ControllerHandle): string | null
|
|
196
|
-
|
|
197
|
-
// resource.cpp
|
|
198
|
-
|
|
199
|
-
export declare function resource_create(
|
|
200
|
-
callback: NotificationCallback | null
|
|
201
|
-
): ResourceHandle | null
|
|
202
|
-
export declare function resource_destroy(handle: ResourceHandle): void
|
|
203
|
-
export declare function resource_set_option_inference_device(
|
|
204
|
-
handle: ResourceHandle,
|
|
205
|
-
id: InferenceDevice | number
|
|
206
|
-
): boolean
|
|
207
|
-
export declare function resource_set_option_inference_execution_provider(
|
|
208
|
-
handle: ResourceHandle,
|
|
209
|
-
provider: InferenceExecutionProvider
|
|
210
|
-
): boolean
|
|
211
|
-
export declare function resource_register_custom_recognition(
|
|
212
|
-
handle: ResourceHandle,
|
|
213
|
-
name: string,
|
|
214
|
-
recognizer: CustomRecognitionCallback
|
|
215
|
-
): boolean
|
|
216
|
-
export declare function resource_unregister_custom_recognition(
|
|
217
|
-
handle: ResourceHandle,
|
|
218
|
-
name: string
|
|
219
|
-
): boolean
|
|
220
|
-
export declare function resource_clear_custom_recognition(handle: ResourceHandle): boolean
|
|
221
|
-
export declare function resource_register_custom_action(
|
|
222
|
-
handle: ResourceHandle,
|
|
223
|
-
name: string,
|
|
224
|
-
action: CustomActionCallback
|
|
225
|
-
): boolean
|
|
226
|
-
export declare function resource_unregister_custom_action(
|
|
227
|
-
handle: ResourceHandle,
|
|
228
|
-
name: string
|
|
229
|
-
): boolean
|
|
230
|
-
export declare function resource_clear_custom_action(handle: ResourceHandle): boolean
|
|
231
|
-
export declare function resource_post_bundle(handle: ResourceHandle, path: string): ResId
|
|
232
|
-
export declare function resource_override_pipeline(
|
|
233
|
-
handle: ResourceHandle,
|
|
234
|
-
pipeline_override: string
|
|
235
|
-
): boolean
|
|
236
|
-
export declare function resource_override_next(
|
|
237
|
-
handle: ResourceHandle,
|
|
238
|
-
node_name: string,
|
|
239
|
-
next_list: string[]
|
|
240
|
-
): boolean
|
|
241
|
-
export declare function resource_get_node_data(
|
|
242
|
-
handle: ResourceHandle,
|
|
243
|
-
node_name: string
|
|
244
|
-
): string | null
|
|
245
|
-
export declare function resource_clear(handle: ResourceHandle): boolean
|
|
246
|
-
export declare function resource_status(handle: ResourceHandle, res_id: ResId): Status
|
|
247
|
-
export declare function resource_wait(handle: ResourceHandle, res_id: ResId): Promise<Status>
|
|
248
|
-
export declare function resource_loaded(handle: ResourceHandle): boolean
|
|
249
|
-
export declare function resource_get_hash(handle: ResourceHandle): string | null
|
|
250
|
-
export declare function resource_get_node_list(handle: ResourceHandle): string[] | null
|
|
251
|
-
|
|
252
|
-
// tasker.cpp
|
|
253
|
-
|
|
254
|
-
export declare function tasker_create(callback: NotificationCallback | null): TaskerHandle | null
|
|
255
|
-
export declare function tasker_destroy(handle: TaskerHandle): void
|
|
256
|
-
export declare function tasker_bind_resource(
|
|
257
|
-
handle: TaskerHandle,
|
|
258
|
-
resource: ResourceHandle | null
|
|
259
|
-
): boolean
|
|
260
|
-
export declare function tasker_bind_controller(
|
|
261
|
-
handle: TaskerHandle,
|
|
262
|
-
controller: ControllerHandle | null
|
|
263
|
-
): boolean
|
|
264
|
-
export declare function tasker_inited(handle: TaskerHandle): boolean
|
|
265
|
-
export declare function tasker_post_task(
|
|
266
|
-
handle: TaskerHandle,
|
|
267
|
-
entry: string,
|
|
268
|
-
pipeline_override: string
|
|
269
|
-
): TaskId
|
|
270
|
-
export declare function tasker_status(handle: TaskerHandle, task_id: TaskId): Status
|
|
271
|
-
export declare function tasker_wait(handle: TaskerHandle, task_id: TaskId): Promise<Status>
|
|
272
|
-
export declare function tasker_running(handle: TaskerHandle): boolean
|
|
273
|
-
export declare function tasker_post_stop(handle: TaskerHandle): TaskId
|
|
274
|
-
export declare function tasker_stopping(handle: TaskerHandle): boolean
|
|
275
|
-
export declare function tasker_get_resource(handle: TaskerHandle): ResourceHandle | null
|
|
276
|
-
export declare function tasker_get_controller(handle: TaskerHandle): ControllerHandle | null
|
|
277
|
-
export declare function tasker_clear_cache(handle: TaskerHandle): boolean
|
|
278
|
-
export declare function tasker_get_recognition_detail(
|
|
279
|
-
handle: TaskerHandle,
|
|
280
|
-
reco_id: RecoId
|
|
281
|
-
):
|
|
282
|
-
| [
|
|
283
|
-
name: string,
|
|
284
|
-
algorithm: string,
|
|
285
|
-
hit: boolean,
|
|
286
|
-
box: Rect,
|
|
287
|
-
detail: string,
|
|
288
|
-
raw: ImageData,
|
|
289
|
-
draws: ImageData[]
|
|
290
|
-
]
|
|
291
|
-
| null
|
|
292
|
-
export declare function tasker_get_node_detail(
|
|
293
|
-
handle: TaskerHandle,
|
|
294
|
-
node_id: NodeId
|
|
295
|
-
): [name: string, reco_id: RecoId, completed: boolean] | null
|
|
296
|
-
export declare function tasker_get_task_detail(
|
|
297
|
-
handle: TaskerHandle,
|
|
298
|
-
task_id: TaskId
|
|
299
|
-
): [entry: string, node_ids: NodeId[], status: Status] | null
|
|
300
|
-
export declare function tasker_get_latest_node(
|
|
301
|
-
handle: TaskerHandle,
|
|
302
|
-
node_name: string
|
|
303
|
-
): NodeId | null
|
|
304
|
-
|
|
305
|
-
// config.cpp
|
|
306
|
-
|
|
307
|
-
export declare function config_init_option(user_path: string, default_json: string): boolean
|
|
308
|
-
|
|
309
|
-
// find.cpp
|
|
310
|
-
|
|
311
|
-
export declare function find_adb(
|
|
312
|
-
adb_path: string | null
|
|
313
|
-
): Promise<
|
|
314
|
-
| [
|
|
315
|
-
name: string,
|
|
316
|
-
adb_path: string,
|
|
317
|
-
address: string,
|
|
318
|
-
screencap_methods: ScreencapOrInputMethods,
|
|
319
|
-
input_methods: ScreencapOrInputMethods,
|
|
320
|
-
config: string
|
|
321
|
-
][]
|
|
322
|
-
| null
|
|
323
|
-
>
|
|
324
|
-
export declare function find_desktop(): Promise<
|
|
325
|
-
[handle: DesktopHandle, class_name: string, window_name: string][] | null
|
|
326
|
-
>
|
|
327
|
-
|
|
328
|
-
// utility.cpp
|
|
329
|
-
|
|
330
|
-
export declare function version(): string
|
|
331
|
-
export declare function set_global_option_log_dir(value: string): boolean
|
|
332
|
-
export declare function set_global_option_save_draw(value: boolean): boolean
|
|
333
|
-
export declare function set_global_option_stdout_level(value: LoggingLevel): boolean
|
|
334
|
-
export declare function set_global_option_debug_mode(value: boolean): boolean
|
|
335
|
-
|
|
336
|
-
// pi.cpp
|
|
337
|
-
|
|
338
|
-
export declare function pi_register_custom_recognizer(
|
|
339
|
-
id: Id,
|
|
340
|
-
name: string,
|
|
341
|
-
recognizer: CustomRecognitionCallback
|
|
342
|
-
): void
|
|
343
|
-
export declare function pi_register_custom_action(
|
|
344
|
-
id: Id,
|
|
345
|
-
name: string,
|
|
346
|
-
action: CustomActionCallback
|
|
347
|
-
): void
|
|
348
|
-
export declare function pi_run_cli(
|
|
349
|
-
id: Id,
|
|
350
|
-
resource_path: string,
|
|
351
|
-
user_path: string,
|
|
352
|
-
directly: boolean,
|
|
353
|
-
callback: NotificationCallback | null
|
|
354
|
-
): Promise<boolean>
|
|
355
|
-
|
|
356
|
-
export declare const Status: Record<
|
|
357
|
-
'Invalid' | 'Pending' | 'Running' | 'Succeeded' | 'Failed',
|
|
358
|
-
Status
|
|
359
|
-
>
|
|
360
|
-
export declare const LoggingLevel: Record<
|
|
361
|
-
'Off' | 'Fatal' | 'Error' | 'Warn' | 'Info' | 'Debug' | 'Trace' | 'All',
|
|
362
|
-
LoggingLevel
|
|
363
|
-
>
|
|
364
|
-
export declare const AdbScreencapMethod: Record<
|
|
365
|
-
| 'EncodeToFileAndPull'
|
|
366
|
-
| 'Encode'
|
|
367
|
-
| 'RawWithGzip'
|
|
368
|
-
| 'RawByNetcat'
|
|
369
|
-
| 'MinicapDirect'
|
|
370
|
-
| 'MinicapStream'
|
|
371
|
-
| 'EmulatorExtras'
|
|
372
|
-
| 'All'
|
|
373
|
-
| 'Default',
|
|
374
|
-
ScreencapOrInputMethods
|
|
375
|
-
>
|
|
376
|
-
export declare const AdbInputMethod: Record<
|
|
377
|
-
'AdbShell' | 'MinitouchAndAdbKey' | 'Maatouch' | 'EmulatorExtras' | 'All' | 'Default',
|
|
378
|
-
ScreencapOrInputMethods
|
|
379
|
-
>
|
|
380
|
-
export declare const Win32ScreencapMethod: Record<
|
|
381
|
-
'GDI' | 'FramePool' | 'DXGI_DesktopDup',
|
|
382
|
-
ScreencapOrInputMethods
|
|
383
|
-
>
|
|
384
|
-
export declare const Win32InputMethod: Record<'Seize' | 'SendMessage', ScreencapOrInputMethods>
|
|
385
|
-
export declare const DbgControllerType: Record<'CarouselImage' | 'ReplayRecording', Uint64>
|
|
386
|
-
export declare const InferenceDevice: Record<'CPU' | 'Auto', InferenceDevice>
|
|
387
|
-
export declare const InferenceExecutionProvider: Record<
|
|
388
|
-
'Auto' | 'CPU' | 'DirectML' | 'CoreML' | 'CUDA',
|
|
389
|
-
InferenceExecutionProvider
|
|
390
|
-
>
|
|
391
|
-
|
|
392
|
-
export declare const AgentRole: 'client' | 'server'
|
|
393
|
-
|
|
394
|
-
// agent.cpp - client
|
|
395
|
-
|
|
396
|
-
export declare function agent_client_create(identifier: string | null): AgentClientHandle | null
|
|
397
|
-
export declare function agent_client_destroy(handle: AgentClientHandle): void
|
|
398
|
-
export declare function agent_client_identifier(handle: AgentClientHandle): string | null
|
|
399
|
-
export declare function agent_client_bind_resource(
|
|
400
|
-
handle: AgentClientHandle,
|
|
401
|
-
resource: ResourceHandle
|
|
402
|
-
): boolean
|
|
403
|
-
export declare function agent_client_connect(handle: AgentClientHandle): Promise<boolean>
|
|
404
|
-
export declare function agent_client_disconnect(handle: AgentClientHandle): boolean
|
|
405
|
-
export declare function agent_client_connected(handle: AgentClientHandle): boolean
|
|
406
|
-
export declare function agent_client_alive(handle: AgentClientHandle): boolean
|
|
407
|
-
export declare function agent_client_set_timeout(handle: AgentClientHandle, ms: Uint64): boolean
|
|
408
|
-
|
|
409
|
-
// agent.cpp - server
|
|
410
|
-
|
|
411
|
-
export declare function agent_server_register_custom_recognition(
|
|
412
|
-
name: string,
|
|
413
|
-
recognizer: CustomRecognitionCallback
|
|
414
|
-
): boolean
|
|
415
|
-
export declare function agent_server_register_custom_action(
|
|
416
|
-
name: string,
|
|
417
|
-
action: CustomActionCallback
|
|
418
|
-
): boolean
|
|
419
|
-
export declare function agent_server_start_up(identifier: string): boolean
|
|
420
|
-
export declare function agent_server_shut_down(): void
|
|
421
|
-
export declare function agent_server_join(): Promise<true>
|
|
422
|
-
export declare function agent_server_detach(): void
|
package/src/maa.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = globalThis.MaaAPI
|
package/src/pi.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Context } from './context'
|
|
2
|
-
import * as maa from './maa'
|
|
3
|
-
import {
|
|
4
|
-
CustomActionCallback,
|
|
5
|
-
CustomActionSelf,
|
|
6
|
-
CustomRecognizerCallback,
|
|
7
|
-
CustomRecognizerSelf
|
|
8
|
-
} from './types'
|
|
9
|
-
|
|
10
|
-
export const Pi = {
|
|
11
|
-
__running: false,
|
|
12
|
-
|
|
13
|
-
notify(message: string, details_json: string): maa.MaybePromise<void> {},
|
|
14
|
-
|
|
15
|
-
register_custom_recognizer(id: maa.Id, name: string, func: CustomRecognizerCallback) {
|
|
16
|
-
maa.pi_register_custom_recognizer(
|
|
17
|
-
id,
|
|
18
|
-
name,
|
|
19
|
-
(context, id, task, name, param, image, roi) => {
|
|
20
|
-
const self: CustomRecognizerSelf = {
|
|
21
|
-
context: new Context(context),
|
|
22
|
-
id,
|
|
23
|
-
task,
|
|
24
|
-
name,
|
|
25
|
-
param: JSON.parse(param),
|
|
26
|
-
image,
|
|
27
|
-
roi
|
|
28
|
-
}
|
|
29
|
-
return func.apply(self, [self])
|
|
30
|
-
}
|
|
31
|
-
)
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
register_custom_action(id: maa.Id, name: string, func: CustomActionCallback) {
|
|
35
|
-
maa.pi_register_custom_action(id, name, (context, id, task, name, param, recoId, box) => {
|
|
36
|
-
const self: CustomActionSelf = {
|
|
37
|
-
context: new Context(context),
|
|
38
|
-
id,
|
|
39
|
-
task,
|
|
40
|
-
name,
|
|
41
|
-
param: JSON.parse(param),
|
|
42
|
-
recoId,
|
|
43
|
-
box
|
|
44
|
-
}
|
|
45
|
-
return func.apply(self, [self])
|
|
46
|
-
})
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
async run_cli(id: maa.Id, resource_path: string, user_path: string, directly: boolean) {
|
|
50
|
-
if (Pi.__running) {
|
|
51
|
-
return false
|
|
52
|
-
}
|
|
53
|
-
Pi.__running = true
|
|
54
|
-
const res = await maa.pi_run_cli(
|
|
55
|
-
id,
|
|
56
|
-
resource_path,
|
|
57
|
-
user_path,
|
|
58
|
-
directly,
|
|
59
|
-
(message, details) => {
|
|
60
|
-
return Pi.notify(message, details)
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
Pi.__running = false
|
|
64
|
-
return res
|
|
65
|
-
}
|
|
66
|
-
}
|