@maaxyz/maa-node 4.4.0-alpha.1 → 4.4.0-alpha.3
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 +2 -0
- package/dist/context.d.ts +7 -1
- package/dist/index-client.js +34 -171
- package/dist/index-server.js +26 -171
- package/dist/maa.d.ts +11 -1
- package/dist/pipeline.d.ts +179 -240
- package/dist/resource.d.ts +6 -0
- package/package.json +7 -7
- package/src/client.ts +10 -0
- package/src/context.ts +16 -2
- package/src/maa.d.ts +11 -1
- package/src/pipeline.ts +228 -674
- package/src/resource.ts +14 -0
package/dist/pipeline.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
type
|
|
2
|
-
type
|
|
1
|
+
import type { FlatRect } from './maa';
|
|
2
|
+
type NodeName = string;
|
|
3
|
+
type MaybeArray<T> = T | T[];
|
|
4
|
+
type FixedArray<T, K extends number, A extends T[] = []> = A['length'] extends K ? A : FixedArray<T, K, [...A, T]>;
|
|
3
5
|
type OrderByMap = {
|
|
4
6
|
TemplateMatch: 'Horizontal' | 'Vertical' | 'Score' | 'Random';
|
|
5
7
|
FeatureMatch: 'Horizontal' | 'Vertical' | 'Score' | 'Area' | 'Random';
|
|
@@ -8,242 +10,179 @@ type OrderByMap = {
|
|
|
8
10
|
NeuralNetworkClassify: 'Horizontal' | 'Vertical' | 'Score' | 'Random';
|
|
9
11
|
NeuralNetworkDetect: 'Horizontal' | 'Vertical' | 'Score' | 'Area' | 'Random';
|
|
10
12
|
};
|
|
11
|
-
type
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
} : {}) & (Act extends 'Swipe' ? 'begin_offset' extends keyof Json ? {} : {
|
|
187
|
-
begin_offset<B extends [number, number, number, number]>(...offset: B): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
188
|
-
begin_offset: B;
|
|
189
|
-
}>;
|
|
190
|
-
} : {}) & (Act extends 'Swipe' ? 'end' extends keyof Json ? {} : {
|
|
191
|
-
end<E extends [true] | [string] | [number, number, number, number]>(...end: E): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
192
|
-
end: E extends [number, number, number, number] ? E : E[0];
|
|
193
|
-
}>;
|
|
194
|
-
} : {}) & (Act extends 'Swipe' ? 'end_offset' extends keyof Json ? {} : {
|
|
195
|
-
end_offset<E extends [number, number, number, number]>(...offset: E): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
196
|
-
end_offset: E;
|
|
197
|
-
}>;
|
|
198
|
-
} : {}) & (Act extends 'Key' ? 'key' extends keyof Json ? {} : {
|
|
199
|
-
key<K extends number[]>(...key: [...K]): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
200
|
-
key: K;
|
|
201
|
-
}>;
|
|
202
|
-
} : {}) & (Act extends 'InputText' ? 'input_text' extends keyof Json ? {} : {
|
|
203
|
-
input_text<T extends string>(text: T): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
204
|
-
input_text: T;
|
|
205
|
-
}>;
|
|
206
|
-
} : {}) & (Act extends 'StartApp' | 'StopApp' ? 'package' extends keyof Json ? {} : {
|
|
207
|
-
package<P extends string>(pkg: P): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
208
|
-
package: P;
|
|
209
|
-
}>;
|
|
210
|
-
} : {}) & (Act extends 'Custom' ? 'custom_action' extends keyof Json ? {} : {
|
|
211
|
-
custom_action<C extends string>(act: C): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
212
|
-
custom_action: C;
|
|
213
|
-
}>;
|
|
214
|
-
} : {}) & (Act extends 'Custom' ? 'custom_action_param' extends keyof Json ? {} : {
|
|
215
|
-
custom_action_param<C extends Record<string, unknown>>(param: C): PipelineActionBuilderState<PBJson, Act, Json & {
|
|
216
|
-
custom_action_param: C;
|
|
217
|
-
}>;
|
|
218
|
-
} : {});
|
|
219
|
-
type PipelineWaitFreezeBuilderState<PBJson, Key extends 'pre_wait_freezes' | 'post_wait_freezes', Json = {}> = {
|
|
220
|
-
done: PipelineBuilderState<PBJson & {
|
|
221
|
-
[key in Key]: Json;
|
|
222
|
-
}>;
|
|
223
|
-
} & ('time' extends keyof Json ? {} : {
|
|
224
|
-
time<T extends number>(time: T): PipelineWaitFreezeBuilderState<PBJson, Key, Json & {
|
|
225
|
-
time: T;
|
|
226
|
-
}>;
|
|
227
|
-
}) & ('target' extends keyof Json ? {} : {
|
|
228
|
-
target<T extends [true] | [string] | [number, number, number, number]>(...target: T): PipelineWaitFreezeBuilderState<PBJson, Key, Json & {
|
|
229
|
-
target: T extends [number, number, number, number] ? T : T[0];
|
|
230
|
-
}>;
|
|
231
|
-
}) & ('target_offset' extends keyof Json ? {} : {
|
|
232
|
-
target_offset<O extends [number, number, number, number]>(...offset: O): PipelineWaitFreezeBuilderState<PBJson, Key, Json & {
|
|
233
|
-
target_offset: O;
|
|
234
|
-
}>;
|
|
235
|
-
}) & ('threshold' extends keyof Json ? {} : {
|
|
236
|
-
threshold<T extends number>(thres: T): PipelineWaitFreezeBuilderState<PBJson, Key, Json & {
|
|
237
|
-
threshold: T;
|
|
238
|
-
}>;
|
|
239
|
-
}) & ('method' extends keyof Json ? {} : {
|
|
240
|
-
method<M extends 1 | 3 | 5>(met: M): PipelineWaitFreezeBuilderState<PBJson, Key, Json & {
|
|
241
|
-
method: M;
|
|
242
|
-
}>;
|
|
243
|
-
}) & ('rate_limit' extends keyof Json ? {} : {
|
|
244
|
-
rate_limit<R extends number>(rate: R): PipelineWaitFreezeBuilderState<PBJson, Key, Json & {
|
|
245
|
-
rate_limit: R;
|
|
246
|
-
}>;
|
|
247
|
-
});
|
|
248
|
-
export declare function pp(): PipelineBuilderState;
|
|
13
|
+
export type RecognitionDirectHit = {};
|
|
14
|
+
export type RecognitionTemplateMatch = {
|
|
15
|
+
roi?: FlatRect | NodeName;
|
|
16
|
+
roi_offset?: FlatRect;
|
|
17
|
+
template?: MaybeArray<string>;
|
|
18
|
+
template_?: MaybeArray<string>;
|
|
19
|
+
threshold?: MaybeArray<number>;
|
|
20
|
+
order_by?: OrderByMap['TemplateMatch'];
|
|
21
|
+
index?: number;
|
|
22
|
+
method?: 1 | 3 | 5;
|
|
23
|
+
green_mask?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type RecognitionFeatureMatch = {
|
|
26
|
+
roi?: FlatRect | NodeName;
|
|
27
|
+
roi_offset?: FlatRect;
|
|
28
|
+
template?: MaybeArray<string>;
|
|
29
|
+
template_?: MaybeArray<string>;
|
|
30
|
+
count?: number;
|
|
31
|
+
order_by?: OrderByMap['FeatureMatch'];
|
|
32
|
+
index?: number;
|
|
33
|
+
green_mask?: boolean;
|
|
34
|
+
detector?: 'SIFT' | 'KAZE' | 'AKAZE' | 'BRISK' | 'ORB';
|
|
35
|
+
ratio?: number;
|
|
36
|
+
};
|
|
37
|
+
export type RecognitionColorMatch = {
|
|
38
|
+
roi?: FlatRect | NodeName;
|
|
39
|
+
roi_offset?: FlatRect;
|
|
40
|
+
} & ({
|
|
41
|
+
method?: 4 | 40;
|
|
42
|
+
lower?: MaybeArray<FixedArray<number, 3>>;
|
|
43
|
+
upper?: MaybeArray<FixedArray<number, 3>>;
|
|
44
|
+
} | {
|
|
45
|
+
method: 6;
|
|
46
|
+
lower?: MaybeArray<FixedArray<number, 1>>;
|
|
47
|
+
upper?: MaybeArray<FixedArray<number, 1>>;
|
|
48
|
+
}) & {
|
|
49
|
+
count?: number;
|
|
50
|
+
order_by?: OrderByMap['ColorMatch'];
|
|
51
|
+
index?: number;
|
|
52
|
+
connected?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export type RecognitionOCR = {
|
|
55
|
+
roi?: FlatRect | NodeName;
|
|
56
|
+
roi_offset?: FlatRect;
|
|
57
|
+
expected?: MaybeArray<string>;
|
|
58
|
+
threshold?: MaybeArray<number>;
|
|
59
|
+
replace?: MaybeArray<FixedArray<string, 2>>;
|
|
60
|
+
order_by?: OrderByMap['OCR'];
|
|
61
|
+
index?: number;
|
|
62
|
+
only_rec?: boolean;
|
|
63
|
+
model?: string;
|
|
64
|
+
};
|
|
65
|
+
export type RecognitionNeuralNetworkClassify = {
|
|
66
|
+
roi?: FlatRect | NodeName;
|
|
67
|
+
roi_offset?: FlatRect;
|
|
68
|
+
labels?: string[];
|
|
69
|
+
model?: string;
|
|
70
|
+
expected?: MaybeArray<number>;
|
|
71
|
+
order_by?: OrderByMap['NeuralNetworkClassify'];
|
|
72
|
+
index?: number;
|
|
73
|
+
};
|
|
74
|
+
export type RecognitionNeuralNetworkDetect = {
|
|
75
|
+
roi?: FlatRect | NodeName;
|
|
76
|
+
roi_offset?: FlatRect;
|
|
77
|
+
labels?: string[];
|
|
78
|
+
model?: string;
|
|
79
|
+
expected?: MaybeArray<number>;
|
|
80
|
+
threshold?: number;
|
|
81
|
+
order_by?: OrderByMap['NeuralNetworkDetect'];
|
|
82
|
+
index?: number;
|
|
83
|
+
};
|
|
84
|
+
export type RecognitionCustom = {
|
|
85
|
+
roi?: FlatRect | NodeName;
|
|
86
|
+
roi_offset?: FlatRect;
|
|
87
|
+
custom_recognition?: string;
|
|
88
|
+
custom_recognition_param?: unknown;
|
|
89
|
+
};
|
|
90
|
+
type MixReco<Type extends string, Param> = ({
|
|
91
|
+
recognition: Type;
|
|
92
|
+
} & Param) | {
|
|
93
|
+
recognition: {
|
|
94
|
+
type: Type;
|
|
95
|
+
param?: Param;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type Recognition = {
|
|
99
|
+
recognition?: {};
|
|
100
|
+
} | MixReco<'DirectHit', RecognitionDirectHit> | MixReco<'TemplateMatch', RecognitionTemplateMatch> | MixReco<'FeatureMatch', RecognitionFeatureMatch> | MixReco<'ColorMatch', RecognitionColorMatch> | MixReco<'OCR', RecognitionOCR> | MixReco<'NeuralNetworkClassify', RecognitionNeuralNetworkClassify> | MixReco<'NeuralNetworkDetect', RecognitionNeuralNetworkDetect> | MixReco<'Custom', RecognitionCustom>;
|
|
101
|
+
export type ActionDoNothing = {};
|
|
102
|
+
export type ActionClick = {
|
|
103
|
+
target?: true | NodeName | FlatRect;
|
|
104
|
+
target_offset?: FlatRect;
|
|
105
|
+
};
|
|
106
|
+
export type ActionLongPress = {
|
|
107
|
+
target?: true | NodeName | FlatRect;
|
|
108
|
+
target_offset?: FlatRect;
|
|
109
|
+
duration?: number;
|
|
110
|
+
};
|
|
111
|
+
export type ActionSwipe = {
|
|
112
|
+
begin?: true | NodeName | FlatRect;
|
|
113
|
+
begin_offset?: FlatRect;
|
|
114
|
+
end?: true | NodeName | FlatRect;
|
|
115
|
+
end_offset?: FlatRect;
|
|
116
|
+
duration?: number;
|
|
117
|
+
};
|
|
118
|
+
export type ActionMultiSwipe = {
|
|
119
|
+
swipes?: {
|
|
120
|
+
starting?: number;
|
|
121
|
+
begin?: true | NodeName | FlatRect;
|
|
122
|
+
begin_offset?: FlatRect;
|
|
123
|
+
end?: true | NodeName | FlatRect;
|
|
124
|
+
end_offset?: FlatRect;
|
|
125
|
+
duration?: number;
|
|
126
|
+
}[];
|
|
127
|
+
};
|
|
128
|
+
export type ActionKey = {
|
|
129
|
+
key?: MaybeArray<number>;
|
|
130
|
+
};
|
|
131
|
+
export type ActionInputText = {
|
|
132
|
+
input_text?: string;
|
|
133
|
+
};
|
|
134
|
+
export type ActionStartApp = {
|
|
135
|
+
package?: string;
|
|
136
|
+
};
|
|
137
|
+
export type ActionStopApp = {
|
|
138
|
+
package?: string;
|
|
139
|
+
};
|
|
140
|
+
export type ActionStopTask = {};
|
|
141
|
+
export type ActionCommand = {
|
|
142
|
+
exec?: string;
|
|
143
|
+
args?: string[];
|
|
144
|
+
detach?: boolean;
|
|
145
|
+
};
|
|
146
|
+
export type ActionCustom = {
|
|
147
|
+
target?: true | NodeName | FlatRect;
|
|
148
|
+
target_offset?: FlatRect;
|
|
149
|
+
custom_action?: string;
|
|
150
|
+
custom_action_param?: unknown;
|
|
151
|
+
};
|
|
152
|
+
type MixAct<Type extends string, Param> = ({
|
|
153
|
+
action: Type;
|
|
154
|
+
} & Param) | {
|
|
155
|
+
action: {
|
|
156
|
+
type: Type;
|
|
157
|
+
param?: Param;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
export type Action = {
|
|
161
|
+
action?: {};
|
|
162
|
+
} | MixAct<'DoNothing', ActionDoNothing> | MixAct<'Click', ActionClick> | MixAct<'LongPress', ActionLongPress> | MixAct<'Swipe', ActionSwipe> | MixAct<'MultiSwipe', ActionMultiSwipe> | MixAct<'Key', ActionKey> | MixAct<'InputText', ActionInputText> | MixAct<'StartApp', ActionStartApp> | MixAct<'StopApp', ActionStopApp> | MixAct<'StopTask', ActionStopTask> | MixAct<'Command', ActionCommand> | MixAct<'Custom', ActionCustom>;
|
|
163
|
+
export type WaitFreeze = {
|
|
164
|
+
time?: number;
|
|
165
|
+
target?: true | NodeName | FlatRect;
|
|
166
|
+
target_offset?: FlatRect;
|
|
167
|
+
threshold?: number;
|
|
168
|
+
method?: 1 | 3 | 5;
|
|
169
|
+
rate_limit?: number;
|
|
170
|
+
timeout?: number;
|
|
171
|
+
};
|
|
172
|
+
export type General = {
|
|
173
|
+
next?: MaybeArray<NodeName>;
|
|
174
|
+
interrupt?: MaybeArray<NodeName>;
|
|
175
|
+
is_sub?: boolean;
|
|
176
|
+
rate_limit?: number;
|
|
177
|
+
timeout?: number;
|
|
178
|
+
on_error?: MaybeArray<string>;
|
|
179
|
+
inverse?: boolean;
|
|
180
|
+
enabled?: boolean;
|
|
181
|
+
pre_delay?: boolean;
|
|
182
|
+
post_delay?: boolean;
|
|
183
|
+
pre_wait_freezes?: number | WaitFreeze;
|
|
184
|
+
post_wait_freezes?: number | WaitFreeze;
|
|
185
|
+
focus?: unknown;
|
|
186
|
+
};
|
|
187
|
+
export type Task = Recognition & Action & General;
|
|
249
188
|
export {};
|
package/dist/resource.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ export declare class ResourceBase {
|
|
|
28
28
|
post_bundle(path: string): Job<maa.ResId, JobSource<maa.ResId>>;
|
|
29
29
|
override_pipeline(pipeline_override: string): void;
|
|
30
30
|
override_next(node_name: string, next_list: string[]): void;
|
|
31
|
+
get_node_data(node_name: string): string | null;
|
|
32
|
+
get_node_data_parsed(node_name: string): ({
|
|
33
|
+
recognition?: {};
|
|
34
|
+
} & {
|
|
35
|
+
action?: {};
|
|
36
|
+
} & import("./pipeline").General) | null;
|
|
31
37
|
clear(): void;
|
|
32
38
|
get loaded(): boolean;
|
|
33
39
|
get hash(): string | null;
|
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.4.0-alpha.
|
|
28
|
+
"version": "4.4.0-alpha.3",
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@maaxyz/maa-node-darwin-arm64": "4.4.0-alpha.
|
|
31
|
-
"@maaxyz/maa-node-darwin-x64": "4.4.0-alpha.
|
|
32
|
-
"@maaxyz/maa-node-linux-arm64": "4.4.0-alpha.
|
|
33
|
-
"@maaxyz/maa-node-linux-x64": "4.4.0-alpha.
|
|
34
|
-
"@maaxyz/maa-node-win32-arm64": "4.4.0-alpha.
|
|
35
|
-
"@maaxyz/maa-node-win32-x64": "4.4.0-alpha.
|
|
30
|
+
"@maaxyz/maa-node-darwin-arm64": "4.4.0-alpha.3",
|
|
31
|
+
"@maaxyz/maa-node-darwin-x64": "4.4.0-alpha.3",
|
|
32
|
+
"@maaxyz/maa-node-linux-arm64": "4.4.0-alpha.3",
|
|
33
|
+
"@maaxyz/maa-node-linux-x64": "4.4.0-alpha.3",
|
|
34
|
+
"@maaxyz/maa-node-win32-arm64": "4.4.0-alpha.3",
|
|
35
|
+
"@maaxyz/maa-node-win32-x64": "4.4.0-alpha.3"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/client.ts
CHANGED
|
@@ -41,4 +41,14 @@ export class AgentClient {
|
|
|
41
41
|
get connected() {
|
|
42
42
|
return maa.agent_client_connected(this.handle)
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
get alive() {
|
|
46
|
+
return maa.agent_client_alive(this.handle)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
set timeout(ms: maa.Uint64) {
|
|
50
|
+
if (!maa.agent_client_set_timeout(this.handle, ms)) {
|
|
51
|
+
throw 'AgentClient set timeout failed'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
44
54
|
}
|
package/src/context.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as maa from './maa'
|
|
2
|
+
import { Task } from './pipeline'
|
|
2
3
|
import { TaskerBase } from './tasker'
|
|
3
4
|
|
|
4
5
|
export class Context {
|
|
@@ -54,12 +55,25 @@ export class Context {
|
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
override_next(
|
|
58
|
-
if (!maa.context_override_next(this.handle,
|
|
58
|
+
override_next(node_name: string, next: string[]) {
|
|
59
|
+
if (!maa.context_override_next(this.handle, node_name, next)) {
|
|
59
60
|
throw 'Context override_next failed'
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
get_node_data(node_name: string) {
|
|
65
|
+
return maa.context_get_node_data(this.handle, node_name)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
get_node_data_parsed(node_name: string) {
|
|
69
|
+
const content = this.get_node_data(node_name)
|
|
70
|
+
if (content) {
|
|
71
|
+
return JSON.parse(content) as Task
|
|
72
|
+
} else {
|
|
73
|
+
return null
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
get task_id() {
|
|
64
78
|
return maa.context_get_task_id(this.handle)
|
|
65
79
|
}
|
package/src/maa.d.ts
CHANGED
|
@@ -98,9 +98,13 @@ export declare function context_override_pipeline(
|
|
|
98
98
|
): boolean
|
|
99
99
|
export declare function context_override_next(
|
|
100
100
|
context: ContextHandle,
|
|
101
|
-
|
|
101
|
+
node_name: string,
|
|
102
102
|
next: string[]
|
|
103
103
|
): boolean
|
|
104
|
+
export declare function context_get_node_data(
|
|
105
|
+
context: ContextHandle,
|
|
106
|
+
node_name: string
|
|
107
|
+
): string | null
|
|
104
108
|
export declare function context_get_task_id(context: ContextHandle): TaskId
|
|
105
109
|
export declare function context_get_tasker(context: ContextHandle): TaskerHandle
|
|
106
110
|
export declare function context_clone(context: ContextHandle): ContextHandle
|
|
@@ -234,6 +238,10 @@ export declare function resource_override_next(
|
|
|
234
238
|
node_name: string,
|
|
235
239
|
next_list: string[]
|
|
236
240
|
): bool
|
|
241
|
+
export declare function resource_get_node_data(
|
|
242
|
+
handle: ResourceHandle,
|
|
243
|
+
node_name: string
|
|
244
|
+
): string | null
|
|
237
245
|
export declare function resource_clear(handle: ResourceHandle): boolean
|
|
238
246
|
export declare function resource_status(handle: ResourceHandle, res_id: ResId): Status
|
|
239
247
|
export declare function resource_wait(handle: ResourceHandle, res_id: ResId): Promise<Status>
|
|
@@ -397,6 +405,8 @@ export declare function agent_client_bind_resource(
|
|
|
397
405
|
export declare function agent_client_connect(handle: AgentClientHandle): Promise<boolean>
|
|
398
406
|
export declare function agent_client_disconnect(handle: AgentClientHandle): boolean
|
|
399
407
|
export declare function agent_client_connected(handle: AgentClientHandle): boolean
|
|
408
|
+
export declare function agent_client_alive(handle: AgentClientHandle): boolean
|
|
409
|
+
export declare function agent_client_set_timeout(handle: AgentClientHandle, ms: Uint64): boolean
|
|
400
410
|
|
|
401
411
|
// agent.cpp - server
|
|
402
412
|
|