@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.
@@ -1,5 +1,7 @@
1
- type RecoType = 'DirectHit' | 'TemplateMatch' | 'FeatureMatch' | 'ColorMatch' | 'OCR' | 'NeuralNetworkClassify' | 'NeuralNetworkDetect' | 'Custom';
2
- type ActType = 'DoNothing' | 'Click' | 'Swipe' | 'Key' | 'Text' | 'StartApp' | 'StopApp' | 'StopTask' | 'Custom';
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 PipelineBuilderState<Json = {}> = {
12
- done: Json;
13
- } & ('recognition' extends keyof Json ? {} : {
14
- recognition<R extends RecoType>(reco: R): PipelineRecognitionBuilderState<Json & {
15
- recognition: R;
16
- }, R>;
17
- }) & ('action' extends keyof Json ? {} : {
18
- action<A extends ActType>(act: A): PipelineActionBuilderState<Json & {
19
- action: A;
20
- }, A>;
21
- }) & ('next' extends keyof Json ? {} : {
22
- next<N extends string[]>(...nxt: [...N]): PipelineBuilderState<Json & {
23
- next: N;
24
- }>;
25
- }) & ('interrupt' extends keyof Json ? {} : {
26
- interrupt<I extends string[]>(...int: [...I]): PipelineBuilderState<Json & {
27
- interrupt: I;
28
- }>;
29
- }) & ('rate_limit' extends keyof Json ? {} : {
30
- rate_limit<R extends number>(rate: R): PipelineBuilderState<Json & {
31
- rate_limit: R;
32
- }>;
33
- }) & ('timeout' extends keyof Json ? {} : {
34
- timeout<R extends number>(time: R): PipelineBuilderState<Json & {
35
- timeout: R;
36
- }>;
37
- }) & ('on_error' extends keyof Json ? {} : {
38
- on_error<O extends string[]>(...err: [...O]): PipelineBuilderState<Json & {
39
- on_error: O;
40
- }>;
41
- }) & ('inverse' extends keyof Json ? {} : {
42
- inverse<I extends boolean>(inv: I): PipelineBuilderState<Json & {
43
- inverse: I;
44
- }>;
45
- }) & ('enabled' extends keyof Json ? {} : {
46
- enabled<E extends boolean>(en: E): PipelineBuilderState<Json & {
47
- enabled: E;
48
- }>;
49
- }) & ('pre_delay' extends keyof Json ? {} : {
50
- pre_delay<P extends number>(pre: P): PipelineBuilderState<Json & {
51
- pre_delay: P;
52
- }>;
53
- }) & ('post_delay' extends keyof Json ? {} : {
54
- post_delay<P extends number>(post: P): PipelineBuilderState<Json & {
55
- post_delay: P;
56
- }>;
57
- }) & ('pre_wait_freezes' extends keyof Json ? {} : {
58
- pre_wait_freezes: PipelineWaitFreezeBuilderState<Json, 'pre_wait_freezes'>;
59
- }) & ('post_wait_freezes' extends keyof Json ? {} : {
60
- post_wait_freezes: PipelineWaitFreezeBuilderState<Json, 'post_wait_freezes'>;
61
- }) & ('focus' extends keyof Json ? {} : {
62
- focus<F extends boolean>(focus: F): PipelineBuilderState<Json & {
63
- focus: F;
64
- }>;
65
- });
66
- type PipelineRecognitionBuilderState<PBJson, Reco extends RecoType, Json = {}> = {
67
- done: PipelineBuilderState<PBJson & Json>;
68
- } & (Reco extends 'DirectHit' ? {} : ('roi' extends keyof Json ? {} : {
69
- roi<R extends [string] | [number, number, number, number]>(...roi: R): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
70
- roi: R extends [number, number, number, number] ? R : R[0];
71
- }>;
72
- }) & ('roi_offset' extends keyof Json ? {} : {
73
- roi_offset<R extends [number, number, number, number]>(...roi: R): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
74
- roi_offset: R;
75
- }>;
76
- })) & (Reco extends 'TemplateMatch' | 'FeatureMatch' ? 'template' extends keyof Json ? {} : {
77
- template<T extends string[]>(...templ: [...T]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
78
- template: T;
79
- }>;
80
- } : {}) & (Reco extends 'TemplateMatch' | 'NeuralNetworkDetect' ? 'threshold' extends keyof Json ? {} : {
81
- threshold<T extends number[]>(...thres: [...T]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
82
- threshold: T;
83
- }>;
84
- threshold$<T extends number>(thres: T): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
85
- threshold: T;
86
- }>;
87
- } : {}) & (Reco extends keyof OrderByMap ? 'order_by' extends keyof Json ? {} : {
88
- order_by<O extends OrderByMap[Reco]>(order: O): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
89
- order_by: O;
90
- }>;
91
- } : {}) & (Reco extends keyof OrderByMap ? 'index' extends keyof Json ? {} : {
92
- index<T extends number>(idx: T): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
93
- index: T;
94
- }>;
95
- } : {}) & (Reco extends 'TemplateMatch' ? 'method' extends keyof Json ? {} : {
96
- method<M extends 1 | 3 | 5>(method: M): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
97
- method: M;
98
- }>;
99
- } : {}) & (Reco extends 'ColorMatch' ? 'method' extends keyof Json ? {} : {
100
- method<M extends 4 | 40 | 6>(method: M): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
101
- method: M;
102
- }>;
103
- } : {}) & (Reco extends 'TemplateMatch' | 'FeatureMatch' ? 'green_mask' extends keyof Json ? {} : {
104
- green_mask<G extends boolean>(mask: G): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
105
- green_mask: G;
106
- }>;
107
- } : {}) & (Reco extends 'FeatureMatch' | 'ColorMatch' ? 'count' extends keyof Json ? {} : {
108
- count<C extends number>(count: C): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
109
- count: C;
110
- }>;
111
- } : {}) & (Reco extends 'FeatureMatch' ? 'detector' extends keyof Json ? {} : {
112
- detector<D extends 'SIFT' | 'KAZE' | 'AKAZE' | 'BRISK' | 'ORB'>(det: D): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
113
- detector: D;
114
- }>;
115
- } : {}) & (Reco extends 'FeatureMatch' ? 'ratio' extends keyof Json ? {} : {
116
- ratio<R extends number>(ratio: R): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
117
- ratio: R;
118
- }>;
119
- } : {}) & (Reco extends 'ColorMatch' ? 'method' extends keyof Json ? ('lower' extends keyof Json ? {} : Json['method'] extends 4 | 40 ? {
120
- lower<L extends [number, number, number][]>(...lower: [...L]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
121
- lower: L;
122
- }>;
123
- } : {
124
- lower<L extends [number][]>(...lower: [...L]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
125
- lower: L;
126
- }>;
127
- }) & ('upper' extends keyof Json ? {} : Json['method'] extends 4 | 40 ? {
128
- upper<L extends [number, number, number][]>(...upper: [...L]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
129
- upper: L;
130
- }>;
131
- } : {
132
- upper<U extends [number][]>(...upper: [...U]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
133
- upper: U;
134
- }>;
135
- }) : {} : {}) & (Reco extends 'ColorMatch' ? 'connected' extends keyof Json ? {} : {
136
- connected<C extends boolean>(conn: C): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
137
- connected: C;
138
- }>;
139
- } : {}) & (Reco extends 'OCR' ? 'expected' extends keyof Json ? {} : {
140
- expected<E extends string[]>(...exp: [...E]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
141
- expected: E;
142
- }>;
143
- } : {}) & (Reco extends 'NeuralNetworkClassify' | 'NeuralNetworkDetect' ? 'expected' extends keyof Json ? {} : {
144
- expected<E extends number[]>(...exp: [...E]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
145
- expected: E;
146
- }>;
147
- } : {}) & (Reco extends 'OCR' ? 'replace' extends keyof Json ? {} : {
148
- replace<R extends [string, string][]>(...exp: [...R]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
149
- replace: R;
150
- }>;
151
- } : {}) & (Reco extends 'OCR' ? 'only_rec' extends keyof Json ? {} : {
152
- only_rec<O extends boolean>(rec: O): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
153
- only_rec: O;
154
- }>;
155
- } : {}) & (Reco extends 'OCR' | 'NeuralNetworkClassify' | 'NeuralNetworkDetect' ? 'model' extends keyof Json ? {} : {
156
- model<M extends string>(model: M): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
157
- model: M;
158
- }>;
159
- } : {}) & (Reco extends 'NeuralNetworkClassify' | 'NeuralNetworkDetect' ? 'labels' extends keyof Json ? {} : {
160
- labels<L extends string[]>(...label: [...L]): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
161
- labels: L;
162
- }>;
163
- } : {}) & (Reco extends 'Custom' ? 'custom_recognition' extends keyof Json ? {} : {
164
- custom_recognition<C extends string>(reco: C): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
165
- custom_recognition: C;
166
- }>;
167
- } : {}) & (Reco extends 'Custom' ? 'custom_recognition_param' extends keyof Json ? {} : {
168
- custom_recognition_param<C extends Record<string, unknown>>(param: C): PipelineRecognitionBuilderState<PBJson, Reco, Json & {
169
- custom_recognition_param: C;
170
- }>;
171
- } : {});
172
- type PipelineActionBuilderState<PBJson, Act extends ActType, Json = {}> = {
173
- done: PipelineBuilderState<PBJson & Json>;
174
- } & (Act extends 'Click' | 'Custom' ? 'target' extends keyof Json ? {} : {
175
- target<T extends [true] | [string] | [number, number, number, number]>(...target: T): PipelineActionBuilderState<PBJson, Act, Json & {
176
- target: T extends [number, number, number, number] ? T : T[0];
177
- }>;
178
- } : {}) & (Act extends 'Click' | 'Custom' ? 'target_offset' extends keyof Json ? {} : {
179
- target_offset<O extends [number, number, number, number]>(...offset: O): PipelineActionBuilderState<PBJson, Act, Json & {
180
- target_offset: O;
181
- }>;
182
- } : {}) & (Act extends 'Swipe' ? 'begin' extends keyof Json ? {} : {
183
- begin<B extends [true] | [string] | [number, number, number, number]>(...begin: B): PipelineActionBuilderState<PBJson, Act, Json & {
184
- begin: B extends [number, number, number, number] ? B : B[0];
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 {};
@@ -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.1",
28
+ "version": "4.4.0-alpha.3",
29
29
  "optionalDependencies": {
30
- "@maaxyz/maa-node-darwin-arm64": "4.4.0-alpha.1",
31
- "@maaxyz/maa-node-darwin-x64": "4.4.0-alpha.1",
32
- "@maaxyz/maa-node-linux-arm64": "4.4.0-alpha.1",
33
- "@maaxyz/maa-node-linux-x64": "4.4.0-alpha.1",
34
- "@maaxyz/maa-node-win32-arm64": "4.4.0-alpha.1",
35
- "@maaxyz/maa-node-win32-x64": "4.4.0-alpha.1"
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(name: string, next: string[]) {
58
- if (!maa.context_override_next(this.handle, name, next)) {
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
- name: string,
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