@maaxyz/maa-node 4.4.1 → 4.5.0-beta.1
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/context.d.ts +4 -4
- package/dist/controller.d.ts +10 -5
- package/dist/global.d.ts +0 -1
- package/dist/index-client.js +17 -15
- package/dist/index-server.js +17 -15
- package/dist/maa.d.ts +6 -7
- package/dist/pipeline.d.ts +6 -2
- package/dist/resource.d.ts +1 -1
- package/dist/tasker.d.ts +1 -1
- package/package.json +7 -7
- package/src/context.ts +7 -4
- package/src/controller.ts +23 -11
- package/src/global.ts +0 -6
- package/src/maa.d.ts +6 -7
- package/src/pipeline.ts +13 -2
- package/src/resource.ts +2 -2
- package/src/tasker.ts +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class Context {
|
|
|
5
5
|
#private;
|
|
6
6
|
handle: maa.ContextHandle;
|
|
7
7
|
constructor(handle: maa.ContextHandle);
|
|
8
|
-
run_task(entry: string, pipeline_override?: Record<string, unknown>): Promise<{
|
|
8
|
+
run_task(entry: string, pipeline_override?: Record<string, unknown> | Record<string, unknown>[]): Promise<{
|
|
9
9
|
entry: string;
|
|
10
10
|
nodes: ({
|
|
11
11
|
name: string;
|
|
@@ -22,7 +22,7 @@ export declare class Context {
|
|
|
22
22
|
} | null)[];
|
|
23
23
|
status: maa.Status;
|
|
24
24
|
} | null>;
|
|
25
|
-
run_recognition(entry: string, image: ArrayBuffer | Buffer, pipeline_override?: Record<string, unknown>): Promise<{
|
|
25
|
+
run_recognition(entry: string, image: ArrayBuffer | Buffer, pipeline_override?: Record<string, unknown> | Record<string, unknown>[]): Promise<{
|
|
26
26
|
name: string;
|
|
27
27
|
algorithm: string;
|
|
28
28
|
hit: boolean;
|
|
@@ -31,7 +31,7 @@ export declare class Context {
|
|
|
31
31
|
raw: ArrayBuffer;
|
|
32
32
|
draws: ArrayBuffer[];
|
|
33
33
|
} | null>;
|
|
34
|
-
run_action(entry: string, box: maa.Rect, reco_detail: string, pipeline_override?: Record<string, unknown>): Promise<{
|
|
34
|
+
run_action(entry: string, box: maa.Rect, reco_detail: string, pipeline_override?: Record<string, unknown> | Record<string, unknown>[]): Promise<{
|
|
35
35
|
name: string;
|
|
36
36
|
reco: {
|
|
37
37
|
name: string;
|
|
@@ -44,7 +44,7 @@ export declare class Context {
|
|
|
44
44
|
} | null;
|
|
45
45
|
completed: boolean;
|
|
46
46
|
} | null>;
|
|
47
|
-
override_pipeline(pipeline_override: Record<string, unknown>): void;
|
|
47
|
+
override_pipeline(pipeline_override: Record<string, unknown> | Record<string, unknown>[]): void;
|
|
48
48
|
override_next(node_name: string, next: string[]): void;
|
|
49
49
|
get_node_data(node_name: string): string | null;
|
|
50
50
|
get_node_data_parsed(node_name: string): DumpTask | null;
|
package/dist/controller.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare class ImageJob extends Job<maa.CtrlId, JobSource<maa.CtrlId>> {
|
|
|
17
17
|
}
|
|
18
18
|
export type ControllerNotify = {
|
|
19
19
|
msg: 'Action.Starting' | 'Action.Succeeded' | 'Action.Failed';
|
|
20
|
-
action: 'connect' | 'click' | 'swipe' | 'touch_down' | 'touch_move' | 'touch_up' | '
|
|
20
|
+
action: 'connect' | 'click' | 'swipe' | 'touch_down' | 'touch_move' | 'touch_up' | 'click_key' | 'input_text' | 'screencap' | 'start_app' | 'stop_app' | 'key_down' | 'key_up';
|
|
21
21
|
ctrl_id: maa.CtrlId;
|
|
22
22
|
uuid: string;
|
|
23
23
|
};
|
|
@@ -32,11 +32,12 @@ export declare class ControllerBase {
|
|
|
32
32
|
set screenshot_target_long_side(value: number);
|
|
33
33
|
set screenshot_target_short_side(value: number);
|
|
34
34
|
set screenshot_use_raw_size(value: boolean);
|
|
35
|
-
set recording(value: boolean);
|
|
36
35
|
post_connection(): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
37
36
|
post_click(x: number, y: number): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
38
37
|
post_swipe(x1: number, y1: number, x2: number, y2: number, duration: number): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
39
|
-
|
|
38
|
+
post_click_key(keycode: number): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
39
|
+
post_key_down(keycode: number): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
40
|
+
post_key_up(keycode: number): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
40
41
|
post_input_text(text: string): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
41
42
|
post_start_app(intent: string): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
42
43
|
post_stop_app(intent: string): Job<maa.CtrlId, JobSource<maa.CtrlId>>;
|
|
@@ -71,8 +72,10 @@ export declare abstract class CustomControllerActor {
|
|
|
71
72
|
abstract touch_down(contact: number, x: number, y: number, pressure: number): maa.MaybePromise<boolean>;
|
|
72
73
|
abstract touch_move(contact: number, x: number, y: number, pressure: number): maa.MaybePromise<boolean>;
|
|
73
74
|
abstract touch_up(contact: number): maa.MaybePromise<boolean>;
|
|
74
|
-
abstract
|
|
75
|
+
abstract click_key(keycode: number): maa.MaybePromise<boolean>;
|
|
75
76
|
abstract input_text(text: string): maa.MaybePromise<boolean>;
|
|
77
|
+
abstract key_down(keycode: number): maa.MaybePromise<boolean>;
|
|
78
|
+
abstract key_up(keycode: number): maa.MaybePromise<boolean>;
|
|
76
79
|
}
|
|
77
80
|
export declare class CustomControllerActorDefaultImpl extends CustomControllerActor {
|
|
78
81
|
connect(): maa.MaybePromise<boolean>;
|
|
@@ -85,8 +88,10 @@ export declare class CustomControllerActorDefaultImpl extends CustomControllerAc
|
|
|
85
88
|
touch_down(contact: number, x: number, y: number, pressure: number): maa.MaybePromise<boolean>;
|
|
86
89
|
touch_move(contact: number, x: number, y: number, pressure: number): maa.MaybePromise<boolean>;
|
|
87
90
|
touch_up(contact: number): maa.MaybePromise<boolean>;
|
|
88
|
-
|
|
91
|
+
click_key(keycode: number): maa.MaybePromise<boolean>;
|
|
89
92
|
input_text(text: string): maa.MaybePromise<boolean>;
|
|
93
|
+
key_down(keycode: number): maa.MaybePromise<boolean>;
|
|
94
|
+
key_up(keycode: number): maa.MaybePromise<boolean>;
|
|
90
95
|
}
|
|
91
96
|
export declare class CustomController extends ControllerBase {
|
|
92
97
|
constructor(actor: CustomControllerActor);
|
package/dist/global.d.ts
CHANGED
package/dist/index-client.js
CHANGED
|
@@ -251,11 +251,6 @@ var ControllerBase = class {
|
|
|
251
251
|
throw "Controller set screenshot_use_raw_size failed";
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
set recording(value) {
|
|
255
|
-
if (!import_maa.default.controller_set_option_recording(this.handle, value)) {
|
|
256
|
-
throw "Controller set recording failed";
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
254
|
post_connection() {
|
|
260
255
|
return new Job(this.#source, import_maa.default.controller_post_connection(this.handle));
|
|
261
256
|
}
|
|
@@ -268,8 +263,14 @@ var ControllerBase = class {
|
|
|
268
263
|
import_maa.default.controller_post_swipe(this.handle, x1, y1, x2, y2, duration)
|
|
269
264
|
);
|
|
270
265
|
}
|
|
271
|
-
|
|
272
|
-
return new Job(this.#source, import_maa.default.
|
|
266
|
+
post_click_key(keycode) {
|
|
267
|
+
return new Job(this.#source, import_maa.default.controller_post_click_key(this.handle, keycode));
|
|
268
|
+
}
|
|
269
|
+
post_key_down(keycode) {
|
|
270
|
+
return new Job(this.#source, import_maa.default.controller_post_key_down(this.handle, keycode));
|
|
271
|
+
}
|
|
272
|
+
post_key_up(keycode) {
|
|
273
|
+
return new Job(this.#source, import_maa.default.controller_post_key_up(this.handle, keycode));
|
|
273
274
|
}
|
|
274
275
|
post_input_text(text) {
|
|
275
276
|
return new Job(this.#source, import_maa.default.controller_post_input_text(this.handle, text));
|
|
@@ -408,12 +409,18 @@ var CustomControllerActorDefaultImpl = class extends CustomControllerActor {
|
|
|
408
409
|
touch_up(contact) {
|
|
409
410
|
return false;
|
|
410
411
|
}
|
|
411
|
-
|
|
412
|
+
click_key(keycode) {
|
|
412
413
|
return false;
|
|
413
414
|
}
|
|
414
415
|
input_text(text) {
|
|
415
416
|
return false;
|
|
416
417
|
}
|
|
418
|
+
key_down(keycode) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
key_up(keycode) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
417
424
|
};
|
|
418
425
|
var CustomController = class extends ControllerBase {
|
|
419
426
|
constructor(actor) {
|
|
@@ -772,8 +779,8 @@ var ResourceBase = class {
|
|
|
772
779
|
post_bundle(path2) {
|
|
773
780
|
return new Job(this.#source, import_maa3.default.resource_post_bundle(this.handle, path2));
|
|
774
781
|
}
|
|
775
|
-
override_pipeline(pipeline_override) {
|
|
776
|
-
if (!import_maa3.default.resource_override_pipeline(this.handle, pipeline_override)) {
|
|
782
|
+
override_pipeline(pipeline_override = {}) {
|
|
783
|
+
if (!import_maa3.default.resource_override_pipeline(this.handle, JSON.stringify(pipeline_override))) {
|
|
777
784
|
throw "Resource override_pipeline failed";
|
|
778
785
|
}
|
|
779
786
|
}
|
|
@@ -838,11 +845,6 @@ var Global = {
|
|
|
838
845
|
throw "Global set save_draw failed";
|
|
839
846
|
}
|
|
840
847
|
},
|
|
841
|
-
set recording(value) {
|
|
842
|
-
if (!maa6.set_global_option_recording(value)) {
|
|
843
|
-
throw "Global set recording failed";
|
|
844
|
-
}
|
|
845
|
-
},
|
|
846
848
|
set stdout_level(value) {
|
|
847
849
|
if (!maa6.set_global_option_stdout_level(maa6.LoggingLevel[value])) {
|
|
848
850
|
throw "Global set stdout_level failed";
|
package/dist/index-server.js
CHANGED
|
@@ -251,11 +251,6 @@ var ControllerBase = class {
|
|
|
251
251
|
throw "Controller set screenshot_use_raw_size failed";
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
-
set recording(value) {
|
|
255
|
-
if (!import_maa.default.controller_set_option_recording(this.handle, value)) {
|
|
256
|
-
throw "Controller set recording failed";
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
254
|
post_connection() {
|
|
260
255
|
return new Job(this.#source, import_maa.default.controller_post_connection(this.handle));
|
|
261
256
|
}
|
|
@@ -268,8 +263,14 @@ var ControllerBase = class {
|
|
|
268
263
|
import_maa.default.controller_post_swipe(this.handle, x1, y1, x2, y2, duration)
|
|
269
264
|
);
|
|
270
265
|
}
|
|
271
|
-
|
|
272
|
-
return new Job(this.#source, import_maa.default.
|
|
266
|
+
post_click_key(keycode) {
|
|
267
|
+
return new Job(this.#source, import_maa.default.controller_post_click_key(this.handle, keycode));
|
|
268
|
+
}
|
|
269
|
+
post_key_down(keycode) {
|
|
270
|
+
return new Job(this.#source, import_maa.default.controller_post_key_down(this.handle, keycode));
|
|
271
|
+
}
|
|
272
|
+
post_key_up(keycode) {
|
|
273
|
+
return new Job(this.#source, import_maa.default.controller_post_key_up(this.handle, keycode));
|
|
273
274
|
}
|
|
274
275
|
post_input_text(text) {
|
|
275
276
|
return new Job(this.#source, import_maa.default.controller_post_input_text(this.handle, text));
|
|
@@ -408,12 +409,18 @@ var CustomControllerActorDefaultImpl = class extends CustomControllerActor {
|
|
|
408
409
|
touch_up(contact) {
|
|
409
410
|
return false;
|
|
410
411
|
}
|
|
411
|
-
|
|
412
|
+
click_key(keycode) {
|
|
412
413
|
return false;
|
|
413
414
|
}
|
|
414
415
|
input_text(text) {
|
|
415
416
|
return false;
|
|
416
417
|
}
|
|
418
|
+
key_down(keycode) {
|
|
419
|
+
return false;
|
|
420
|
+
}
|
|
421
|
+
key_up(keycode) {
|
|
422
|
+
return false;
|
|
423
|
+
}
|
|
417
424
|
};
|
|
418
425
|
var CustomController = class extends ControllerBase {
|
|
419
426
|
constructor(actor) {
|
|
@@ -772,8 +779,8 @@ var ResourceBase = class {
|
|
|
772
779
|
post_bundle(path2) {
|
|
773
780
|
return new Job(this.#source, import_maa3.default.resource_post_bundle(this.handle, path2));
|
|
774
781
|
}
|
|
775
|
-
override_pipeline(pipeline_override) {
|
|
776
|
-
if (!import_maa3.default.resource_override_pipeline(this.handle, pipeline_override)) {
|
|
782
|
+
override_pipeline(pipeline_override = {}) {
|
|
783
|
+
if (!import_maa3.default.resource_override_pipeline(this.handle, JSON.stringify(pipeline_override))) {
|
|
777
784
|
throw "Resource override_pipeline failed";
|
|
778
785
|
}
|
|
779
786
|
}
|
|
@@ -838,11 +845,6 @@ var Global = {
|
|
|
838
845
|
throw "Global set save_draw failed";
|
|
839
846
|
}
|
|
840
847
|
},
|
|
841
|
-
set recording(value) {
|
|
842
|
-
if (!maa6.set_global_option_recording(value)) {
|
|
843
|
-
throw "Global set recording failed";
|
|
844
|
-
}
|
|
845
|
-
},
|
|
846
848
|
set stdout_level(value) {
|
|
847
849
|
if (!maa6.set_global_option_stdout_level(maa6.LoggingLevel[value])) {
|
|
848
850
|
throw "Global set stdout_level failed";
|
package/dist/maa.d.ts
CHANGED
|
@@ -64,8 +64,10 @@ export type CustomControllerParamResultMap = {
|
|
|
64
64
|
touch_down: [[contact: number, x: number, y: number, pressure: number], boolean]
|
|
65
65
|
touch_move: [[contact: number, x: number, y: number, pressure: number], boolean]
|
|
66
66
|
touch_up: [[contact: number], boolean]
|
|
67
|
-
|
|
67
|
+
click_key: [[keycode: number], boolean]
|
|
68
68
|
input_text: [[text: string], boolean]
|
|
69
|
+
key_down: [[keycode: number], boolean]
|
|
70
|
+
key_up: [[keycode: number], boolean]
|
|
69
71
|
}
|
|
70
72
|
export type CustomControllerCallback = (
|
|
71
73
|
action: keyof CustomControllerParamResultMap,
|
|
@@ -150,10 +152,6 @@ export declare function controller_set_option_screenshot_use_raw_size(
|
|
|
150
152
|
handle: ControllerHandle,
|
|
151
153
|
value: boolean
|
|
152
154
|
): boolean
|
|
153
|
-
export declare function controller_set_option_recording(
|
|
154
|
-
handle: ControllerHandle,
|
|
155
|
-
value: boolean
|
|
156
|
-
): boolean
|
|
157
155
|
export declare function controller_post_connection(handle: ControllerHandle): CtrlId
|
|
158
156
|
export declare function controller_post_click(
|
|
159
157
|
handle: ControllerHandle,
|
|
@@ -168,7 +166,9 @@ export declare function controller_post_swipe(
|
|
|
168
166
|
y2: number,
|
|
169
167
|
duration: number
|
|
170
168
|
): CtrlId
|
|
171
|
-
export declare function
|
|
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
172
|
export declare function controller_post_input_text(handle: ControllerHandle, text: string): CtrlId
|
|
173
173
|
export declare function controller_post_start_app(handle: ControllerHandle, intent: string): CtrlId
|
|
174
174
|
export declare function controller_post_stop_app(handle: ControllerHandle, intent: string): CtrlId
|
|
@@ -330,7 +330,6 @@ export declare function find_desktop(): Promise<
|
|
|
330
330
|
export declare function version(): string
|
|
331
331
|
export declare function set_global_option_log_dir(value: string): boolean
|
|
332
332
|
export declare function set_global_option_save_draw(value: boolean): boolean
|
|
333
|
-
export declare function set_global_option_recording(value: boolean): boolean
|
|
334
333
|
export declare function set_global_option_stdout_level(value: LoggingLevel): boolean
|
|
335
334
|
export declare function set_global_option_debug_mode(value: boolean): boolean
|
|
336
335
|
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -136,9 +136,13 @@ export type ActionMultiSwipe<Mode> = RequiredIfStrict<{
|
|
|
136
136
|
duration?: number;
|
|
137
137
|
}[];
|
|
138
138
|
}, 'swipes', Mode>;
|
|
139
|
-
export type
|
|
139
|
+
export type ActionClickKey<Mode> = RequiredIfStrict<{
|
|
140
140
|
key?: MaybeArray<number, Mode>;
|
|
141
141
|
}, 'key', Mode>;
|
|
142
|
+
export type ActionLongPressKey<Mode> = RequiredIfStrict<{
|
|
143
|
+
key?: number;
|
|
144
|
+
duration?: number;
|
|
145
|
+
}, 'key', Mode>;
|
|
142
146
|
export type ActionInputText<Mode> = RequiredIfStrict<{
|
|
143
147
|
input_text?: string;
|
|
144
148
|
}, 'input_text', Mode>;
|
|
@@ -173,7 +177,7 @@ export type Action<Mode> = RemoveIfDump<{
|
|
|
173
177
|
type?: never;
|
|
174
178
|
param?: never;
|
|
175
179
|
};
|
|
176
|
-
}, Mode> | MixAct<'DoNothing', ActionDoNothing, Mode> | MixAct<'Click', ActionClick, Mode> | MixAct<'LongPress', ActionLongPress, Mode> | MixAct<'Swipe', ActionSwipe, Mode> | MixAct<'MultiSwipe', ActionMultiSwipe<Mode>, Mode> | MixAct<'Key',
|
|
180
|
+
}, Mode> | MixAct<'DoNothing', ActionDoNothing, Mode> | MixAct<'Click', ActionClick, Mode> | MixAct<'LongPress', ActionLongPress, Mode> | MixAct<'Swipe', ActionSwipe, Mode> | MixAct<'MultiSwipe', ActionMultiSwipe<Mode>, Mode> | MixAct<'Key', ActionClickKey<Mode>, Mode> | MixAct<'ClickKey', ActionClickKey<Mode>, Mode> | MixAct<'LongPressKey', ActionLongPressKey<Mode>, Mode> | MixAct<'InputText', ActionInputText<Mode>, Mode> | MixAct<'StartApp', ActionStartApp<Mode>, Mode> | MixAct<'StopApp', ActionStopApp<Mode>, Mode> | MixAct<'StopTask', ActionStopTask, Mode> | MixAct<'Command', ActionCommand<Mode>, Mode> | MixAct<'Custom', ActionCustom<Mode>, Mode>;
|
|
177
181
|
export type WaitFreeze = {
|
|
178
182
|
time?: number;
|
|
179
183
|
target?: true | NodeName | FlatRect;
|
package/dist/resource.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class ResourceBase {
|
|
|
26
26
|
unregister_custom_action(name: string): void;
|
|
27
27
|
clear_custom_action(): void;
|
|
28
28
|
post_bundle(path: string): Job<maa.ResId, JobSource<maa.ResId>>;
|
|
29
|
-
override_pipeline(pipeline_override
|
|
29
|
+
override_pipeline(pipeline_override?: Record<string, unknown> | Record<string, unknown>[]): void;
|
|
30
30
|
override_next(node_name: string, next_list: string[]): void;
|
|
31
31
|
get_node_data(node_name: string): string | null;
|
|
32
32
|
get_node_data_parsed(node_name: string): DumpTask | null;
|
package/dist/tasker.d.ts
CHANGED
|
@@ -82,7 +82,7 @@ export declare class TaskerBase {
|
|
|
82
82
|
constructor(handle: maa.TaskerHandle);
|
|
83
83
|
destroy(): void;
|
|
84
84
|
bind(slave: ControllerBase | ResourceBase): void;
|
|
85
|
-
post_task(entry: string, param?: Record<string, unknown>): TaskJob;
|
|
85
|
+
post_task(entry: string, param?: Record<string, unknown> | Record<string, unknown>[]): TaskJob;
|
|
86
86
|
get inited(): boolean;
|
|
87
87
|
get running(): boolean;
|
|
88
88
|
post_stop(): TaskJob;
|
package/package.json
CHANGED
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"prettier": "^3.5.2",
|
|
26
26
|
"typescript": "^5.8.2"
|
|
27
27
|
},
|
|
28
|
-
"version": "4.
|
|
28
|
+
"version": "4.5.0-beta.1",
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@maaxyz/maa-node-darwin-arm64": "4.
|
|
31
|
-
"@maaxyz/maa-node-darwin-x64": "4.
|
|
32
|
-
"@maaxyz/maa-node-linux-arm64": "4.
|
|
33
|
-
"@maaxyz/maa-node-linux-x64": "4.
|
|
34
|
-
"@maaxyz/maa-node-win32-arm64": "4.
|
|
35
|
-
"@maaxyz/maa-node-win32-x64": "4.
|
|
30
|
+
"@maaxyz/maa-node-darwin-arm64": "4.5.0-beta.1",
|
|
31
|
+
"@maaxyz/maa-node-darwin-x64": "4.5.0-beta.1",
|
|
32
|
+
"@maaxyz/maa-node-linux-arm64": "4.5.0-beta.1",
|
|
33
|
+
"@maaxyz/maa-node-linux-x64": "4.5.0-beta.1",
|
|
34
|
+
"@maaxyz/maa-node-win32-arm64": "4.5.0-beta.1",
|
|
35
|
+
"@maaxyz/maa-node-win32-x64": "4.5.0-beta.1"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/context.ts
CHANGED
|
@@ -11,7 +11,10 @@ export class Context {
|
|
|
11
11
|
this.#tasker = new TaskerBase(maa.context_get_tasker(this.handle))
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
async run_task(
|
|
14
|
+
async run_task(
|
|
15
|
+
entry: string,
|
|
16
|
+
pipeline_override: Record<string, unknown> | Record<string, unknown>[] = {}
|
|
17
|
+
) {
|
|
15
18
|
const id = await maa.context_run_task(this.handle, entry, JSON.stringify(pipeline_override))
|
|
16
19
|
return this.#tasker.task_detail(id)
|
|
17
20
|
}
|
|
@@ -19,7 +22,7 @@ export class Context {
|
|
|
19
22
|
async run_recognition(
|
|
20
23
|
entry: string,
|
|
21
24
|
image: ArrayBuffer | Buffer,
|
|
22
|
-
pipeline_override: Record<string, unknown> = {}
|
|
25
|
+
pipeline_override: Record<string, unknown> | Record<string, unknown>[] = {}
|
|
23
26
|
) {
|
|
24
27
|
if (image instanceof Buffer) {
|
|
25
28
|
image = image.buffer
|
|
@@ -37,7 +40,7 @@ export class Context {
|
|
|
37
40
|
entry: string,
|
|
38
41
|
box: maa.Rect,
|
|
39
42
|
reco_detail: string,
|
|
40
|
-
pipeline_override: Record<string, unknown> = {}
|
|
43
|
+
pipeline_override: Record<string, unknown> | Record<string, unknown>[] = {}
|
|
41
44
|
) {
|
|
42
45
|
const id = await maa.context_run_action(
|
|
43
46
|
this.handle,
|
|
@@ -49,7 +52,7 @@ export class Context {
|
|
|
49
52
|
return this.#tasker.node_detail(id)
|
|
50
53
|
}
|
|
51
54
|
|
|
52
|
-
override_pipeline(pipeline_override: Record<string, unknown>) {
|
|
55
|
+
override_pipeline(pipeline_override: Record<string, unknown> | Record<string, unknown>[]) {
|
|
53
56
|
if (!maa.context_override_pipeline(this.handle, JSON.stringify(pipeline_override))) {
|
|
54
57
|
throw 'Context override_pipeline failed'
|
|
55
58
|
}
|
package/src/controller.ts
CHANGED
|
@@ -47,11 +47,13 @@ export type ControllerNotify = {
|
|
|
47
47
|
| 'touch_down'
|
|
48
48
|
| 'touch_move'
|
|
49
49
|
| 'touch_up'
|
|
50
|
-
| '
|
|
50
|
+
| 'click_key'
|
|
51
51
|
| 'input_text'
|
|
52
52
|
| 'screencap'
|
|
53
53
|
| 'start_app'
|
|
54
54
|
| 'stop_app'
|
|
55
|
+
| 'key_down'
|
|
56
|
+
| 'key_up'
|
|
55
57
|
ctrl_id: maa.CtrlId
|
|
56
58
|
uuid: string
|
|
57
59
|
}
|
|
@@ -106,12 +108,6 @@ export class ControllerBase {
|
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
set recording(value: boolean) {
|
|
110
|
-
if (!maa.controller_set_option_recording(this.handle, value)) {
|
|
111
|
-
throw 'Controller set recording failed'
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
111
|
post_connection() {
|
|
116
112
|
return new Job(this.#source, maa.controller_post_connection(this.handle))
|
|
117
113
|
}
|
|
@@ -127,8 +123,16 @@ export class ControllerBase {
|
|
|
127
123
|
)
|
|
128
124
|
}
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
return new Job(this.#source, maa.
|
|
126
|
+
post_click_key(keycode: number) {
|
|
127
|
+
return new Job(this.#source, maa.controller_post_click_key(this.handle, keycode))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
post_key_down(keycode: number) {
|
|
131
|
+
return new Job(this.#source, maa.controller_post_key_down(this.handle, keycode))
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
post_key_up(keycode: number) {
|
|
135
|
+
return new Job(this.#source, maa.controller_post_key_up(this.handle, keycode))
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
post_input_text(text: string) {
|
|
@@ -289,8 +293,10 @@ export abstract class CustomControllerActor {
|
|
|
289
293
|
pressure: number
|
|
290
294
|
): maa.MaybePromise<boolean>
|
|
291
295
|
abstract touch_up(contact: number): maa.MaybePromise<boolean>
|
|
292
|
-
abstract
|
|
296
|
+
abstract click_key(keycode: number): maa.MaybePromise<boolean>
|
|
293
297
|
abstract input_text(text: string): maa.MaybePromise<boolean>
|
|
298
|
+
abstract key_down(keycode: number): maa.MaybePromise<boolean>
|
|
299
|
+
abstract key_up(keycode: number): maa.MaybePromise<boolean>
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
export class CustomControllerActorDefaultImpl extends CustomControllerActor {
|
|
@@ -330,12 +336,18 @@ export class CustomControllerActorDefaultImpl extends CustomControllerActor {
|
|
|
330
336
|
touch_up(contact: number): maa.MaybePromise<boolean> {
|
|
331
337
|
return false
|
|
332
338
|
}
|
|
333
|
-
|
|
339
|
+
click_key(keycode: number): maa.MaybePromise<boolean> {
|
|
334
340
|
return false
|
|
335
341
|
}
|
|
336
342
|
input_text(text: string): maa.MaybePromise<boolean> {
|
|
337
343
|
return false
|
|
338
344
|
}
|
|
345
|
+
key_down(keycode: number): maa.MaybePromise<boolean> {
|
|
346
|
+
return false
|
|
347
|
+
}
|
|
348
|
+
key_up(keycode: number): maa.MaybePromise<boolean> {
|
|
349
|
+
return false
|
|
350
|
+
}
|
|
339
351
|
}
|
|
340
352
|
|
|
341
353
|
export class CustomController extends ControllerBase {
|
package/src/global.ts
CHANGED
|
@@ -17,12 +17,6 @@ export const Global = {
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
|
|
20
|
-
set recording(value: boolean) {
|
|
21
|
-
if (!maa.set_global_option_recording(value)) {
|
|
22
|
-
throw 'Global set recording failed'
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
|
|
26
20
|
set stdout_level(value: keyof typeof maa.LoggingLevel) {
|
|
27
21
|
if (!maa.set_global_option_stdout_level(maa.LoggingLevel[value])) {
|
|
28
22
|
throw 'Global set stdout_level failed'
|
package/src/maa.d.ts
CHANGED
|
@@ -64,8 +64,10 @@ export type CustomControllerParamResultMap = {
|
|
|
64
64
|
touch_down: [[contact: number, x: number, y: number, pressure: number], boolean]
|
|
65
65
|
touch_move: [[contact: number, x: number, y: number, pressure: number], boolean]
|
|
66
66
|
touch_up: [[contact: number], boolean]
|
|
67
|
-
|
|
67
|
+
click_key: [[keycode: number], boolean]
|
|
68
68
|
input_text: [[text: string], boolean]
|
|
69
|
+
key_down: [[keycode: number], boolean]
|
|
70
|
+
key_up: [[keycode: number], boolean]
|
|
69
71
|
}
|
|
70
72
|
export type CustomControllerCallback = (
|
|
71
73
|
action: keyof CustomControllerParamResultMap,
|
|
@@ -150,10 +152,6 @@ export declare function controller_set_option_screenshot_use_raw_size(
|
|
|
150
152
|
handle: ControllerHandle,
|
|
151
153
|
value: boolean
|
|
152
154
|
): boolean
|
|
153
|
-
export declare function controller_set_option_recording(
|
|
154
|
-
handle: ControllerHandle,
|
|
155
|
-
value: boolean
|
|
156
|
-
): boolean
|
|
157
155
|
export declare function controller_post_connection(handle: ControllerHandle): CtrlId
|
|
158
156
|
export declare function controller_post_click(
|
|
159
157
|
handle: ControllerHandle,
|
|
@@ -168,7 +166,9 @@ export declare function controller_post_swipe(
|
|
|
168
166
|
y2: number,
|
|
169
167
|
duration: number
|
|
170
168
|
): CtrlId
|
|
171
|
-
export declare function
|
|
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
172
|
export declare function controller_post_input_text(handle: ControllerHandle, text: string): CtrlId
|
|
173
173
|
export declare function controller_post_start_app(handle: ControllerHandle, intent: string): CtrlId
|
|
174
174
|
export declare function controller_post_stop_app(handle: ControllerHandle, intent: string): CtrlId
|
|
@@ -330,7 +330,6 @@ export declare function find_desktop(): Promise<
|
|
|
330
330
|
export declare function version(): string
|
|
331
331
|
export declare function set_global_option_log_dir(value: string): boolean
|
|
332
332
|
export declare function set_global_option_save_draw(value: boolean): boolean
|
|
333
|
-
export declare function set_global_option_recording(value: boolean): boolean
|
|
334
333
|
export declare function set_global_option_stdout_level(value: LoggingLevel): boolean
|
|
335
334
|
export declare function set_global_option_debug_mode(value: boolean): boolean
|
|
336
335
|
|
package/src/pipeline.ts
CHANGED
|
@@ -208,7 +208,7 @@ export type ActionMultiSwipe<Mode> = RequiredIfStrict<
|
|
|
208
208
|
Mode
|
|
209
209
|
>
|
|
210
210
|
|
|
211
|
-
export type
|
|
211
|
+
export type ActionClickKey<Mode> = RequiredIfStrict<
|
|
212
212
|
{
|
|
213
213
|
key?: MaybeArray<number, Mode>
|
|
214
214
|
},
|
|
@@ -216,6 +216,15 @@ export type ActionKey<Mode> = RequiredIfStrict<
|
|
|
216
216
|
Mode
|
|
217
217
|
>
|
|
218
218
|
|
|
219
|
+
export type ActionLongPressKey<Mode> = RequiredIfStrict<
|
|
220
|
+
{
|
|
221
|
+
key?: number
|
|
222
|
+
duration?: number
|
|
223
|
+
},
|
|
224
|
+
'key',
|
|
225
|
+
Mode
|
|
226
|
+
>
|
|
227
|
+
|
|
219
228
|
export type ActionInputText<Mode> = RequiredIfStrict<
|
|
220
229
|
{
|
|
221
230
|
input_text?: string
|
|
@@ -292,7 +301,9 @@ export type Action<Mode> =
|
|
|
292
301
|
| MixAct<'LongPress', ActionLongPress, Mode>
|
|
293
302
|
| MixAct<'Swipe', ActionSwipe, Mode>
|
|
294
303
|
| MixAct<'MultiSwipe', ActionMultiSwipe<Mode>, Mode>
|
|
295
|
-
| MixAct<'Key',
|
|
304
|
+
| MixAct<'Key', ActionClickKey<Mode>, Mode>
|
|
305
|
+
| MixAct<'ClickKey', ActionClickKey<Mode>, Mode>
|
|
306
|
+
| MixAct<'LongPressKey', ActionLongPressKey<Mode>, Mode>
|
|
296
307
|
| MixAct<'InputText', ActionInputText<Mode>, Mode>
|
|
297
308
|
| MixAct<'StartApp', ActionStartApp<Mode>, Mode>
|
|
298
309
|
| MixAct<'StopApp', ActionStopApp<Mode>, Mode>
|
package/src/resource.ts
CHANGED
|
@@ -144,8 +144,8 @@ export class ResourceBase {
|
|
|
144
144
|
return new Job(this.#source, maa.resource_post_bundle(this.handle, path))
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
override_pipeline(pipeline_override: string) {
|
|
148
|
-
if (!maa.resource_override_pipeline(this.handle, pipeline_override)) {
|
|
147
|
+
override_pipeline(pipeline_override: Record<string, unknown> | Record<string, unknown>[] = {}) {
|
|
148
|
+
if (!maa.resource_override_pipeline(this.handle, JSON.stringify(pipeline_override))) {
|
|
149
149
|
throw 'Resource override_pipeline failed'
|
|
150
150
|
}
|
|
151
151
|
}
|
package/src/tasker.ts
CHANGED
|
@@ -130,7 +130,7 @@ export class TaskerBase {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
post_task(entry: string, param: Record<string, unknown> = {}) {
|
|
133
|
+
post_task(entry: string, param: Record<string, unknown> | Record<string, unknown>[] = {}) {
|
|
134
134
|
return new TaskJob(
|
|
135
135
|
this,
|
|
136
136
|
this.#source,
|