@maaxyz/maa-node 2.4.2 → 3.0.0-beta.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/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_pipeline(entry: string, pipeline_override?: Record<string, unknown>): Promise<{
8
+ run_task(entry: string, pipeline_override?: Record<string, unknown>): Promise<{
9
9
  entry: string;
10
10
  nodes: ({
11
11
  name: string;
package/dist/index.js CHANGED
@@ -427,7 +427,7 @@ var TaskerBase = class {
427
427
  set parsed_notify(cb) {
428
428
  this.notify = (msg, details) => {
429
429
  return cb({
430
- msg: msg.replace(/^Task(?:er)?\./, ""),
430
+ msg: msg.replace(/^(?:Tasker|Node)?\./, ""),
431
431
  ...JSON.parse(details)
432
432
  });
433
433
  };
@@ -453,11 +453,11 @@ var TaskerBase = class {
453
453
  throw "Tasker bind failed";
454
454
  }
455
455
  }
456
- post_pipeline(entry, param = {}) {
456
+ post_task(entry, param = {}) {
457
457
  return new TaskJob(
458
458
  this,
459
459
  this.#source,
460
- import_maa2.default.tasker_post_pipeline(this.handle, entry, JSON.stringify(param))
460
+ import_maa2.default.tasker_post_task(this.handle, entry, JSON.stringify(param))
461
461
  );
462
462
  }
463
463
  get inited() {
@@ -467,11 +467,7 @@ var TaskerBase = class {
467
467
  return import_maa2.default.tasker_running(this.handle);
468
468
  }
469
469
  post_stop() {
470
- return new TaskJob(
471
- this,
472
- this.#source,
473
- import_maa2.default.tasker_post_stop(this.handle)
474
- );
470
+ return new TaskJob(this, this.#source, import_maa2.default.tasker_post_stop(this.handle));
475
471
  }
476
472
  get resource() {
477
473
  const res = import_maa2.default.tasker_get_resource(this.handle);
@@ -537,8 +533,8 @@ var TaskerBase = class {
537
533
  return null;
538
534
  }
539
535
  }
540
- latest_node(task) {
541
- return import_maa2.default.tasker_get_latest_node(this.handle, task);
536
+ latest_node(node) {
537
+ return import_maa2.default.tasker_get_latest_node(this.handle, node);
542
538
  }
543
539
  };
544
540
  var Tasker = class extends TaskerBase {
@@ -563,8 +559,8 @@ var Context = class _Context {
563
559
  this.handle = handle;
564
560
  this.#tasker = new TaskerBase(maa4.context_get_tasker(this.handle));
565
561
  }
566
- async run_pipeline(entry, pipeline_override = {}) {
567
- const id = await maa4.context_run_pipeline(
562
+ async run_task(entry, pipeline_override = {}) {
563
+ const id = await maa4.context_run_task(
568
564
  this.handle,
569
565
  entry,
570
566
  JSON.stringify(pipeline_override)
@@ -715,8 +711,8 @@ var ResourceBase = class {
715
711
  throw "Resource clear_custom_action failed";
716
712
  }
717
713
  }
718
- post_path(path2) {
719
- return new Job(this.#source, import_maa3.default.resource_post_path(this.handle, path2));
714
+ post_bundle(path2) {
715
+ return new Job(this.#source, import_maa3.default.resource_post_bundle(this.handle, path2));
720
716
  }
721
717
  clear() {
722
718
  if (!import_maa3.default.resource_clear(this.handle)) {
package/dist/maa.d.ts CHANGED
@@ -36,7 +36,7 @@ export type NotificationCallback = (message: string, details_json: string) => Ma
36
36
  export type CustomRecognitionCallback = (
37
37
  context: ContextHandle,
38
38
  task_id: TaskId,
39
- current_task_name: string,
39
+ node_name: string,
40
40
  custom_recognition_name: string,
41
41
  custom_recognition_param: string,
42
42
  image: ImageData,
@@ -45,7 +45,7 @@ export type CustomRecognitionCallback = (
45
45
  export type CustomActionCallback = (
46
46
  context: ContextHandle,
47
47
  task_id: TaskId,
48
- current_task_name: string,
48
+ node_name: string,
49
49
  custom_action_name: string,
50
50
  custom_action_param: string,
51
51
  reco_id: RecoId,
@@ -73,7 +73,7 @@ export type CustomControllerCallback = (
73
73
 
74
74
  // context.cpp
75
75
 
76
- export declare function context_run_pipeline(
76
+ export declare function context_run_task(
77
77
  context: ContextHandle,
78
78
  entry: string,
79
79
  pipeline_override: string
@@ -223,7 +223,7 @@ export declare function resource_unregister_custom_action(
223
223
  name: string
224
224
  ): boolean
225
225
  export declare function resource_clear_custom_action(handle: ResourceHandle): boolean
226
- export declare function resource_post_path(handle: ResourceHandle, path: string): ResId
226
+ export declare function resource_post_bundle(handle: ResourceHandle, path: string): ResId
227
227
  export declare function resource_clear(handle: ResourceHandle): boolean
228
228
  export declare function resource_status(handle: ResourceHandle, res_id: ResId): Status
229
229
  export declare function resource_wait(handle: ResourceHandle, res_id: ResId): Promise<Status>
@@ -244,7 +244,7 @@ export declare function tasker_bind_controller(
244
244
  controller: ControllerHandle | null
245
245
  ): boolean
246
246
  export declare function tasker_inited(handle: TaskerHandle): boolean
247
- export declare function tasker_post_pipeline(
247
+ export declare function tasker_post_task(
248
248
  handle: TaskerHandle,
249
249
  entry: string,
250
250
  pipeline_override: string
@@ -280,7 +280,7 @@ export declare function tasker_get_task_detail(
280
280
  ): [entry: string, node_ids: NodeId[], status: Status] | null
281
281
  export declare function tasker_get_latest_node(
282
282
  handle: TaskerHandle,
283
- task_name: string
283
+ node_name: string
284
284
  ): NodeId | null
285
285
 
286
286
  // config.cpp
@@ -25,7 +25,7 @@ export declare class ResourceBase {
25
25
  register_custom_action(name: string, func: CustomActionCallback): void;
26
26
  unregister_custom_action(name: string): void;
27
27
  clear_custom_action(): void;
28
- post_path(path: string): Job<maa.ResId, JobSource<maa.ResId>>;
28
+ post_bundle(path: string): Job<maa.ResId, JobSource<maa.ResId>>;
29
29
  clear(): void;
30
30
  get loaded(): boolean;
31
31
  get hash(): string | null;
package/dist/tasker.d.ts CHANGED
@@ -40,31 +40,20 @@ export type TaskerNotify = {
40
40
  } & ({
41
41
  msg: 'Task.Started' | 'Task.Completed' | 'Task.Failed';
42
42
  } | {
43
- msg: 'Debug.RecognitionResult' | 'Debug.Hit';
44
- current: string;
45
- recognition: {
46
- reco_id: maa.RecoId;
47
- name: string;
48
- /**
49
- * Won't be `null` for msg `Debug.Hit`
50
- */
51
- box: maa.FlatRect | null;
52
- detail: string;
53
- };
43
+ msg: 'NextList.Starting' | 'NextList.Succeeded' | 'NextList.Failed';
44
+ task_id: number;
45
+ name: string;
46
+ list: string[];
54
47
  } | {
55
- msg: 'Focus.ReadyToRun' | 'Focus.Completed' | 'Debug.ReadyToRun' | 'Debug.Completed';
56
- current: string;
57
- node: {
58
- node_id: maa.NodeId;
59
- name: string;
60
- reco_id: maa.RecoId;
61
- times: number;
62
- completed: boolean;
63
- };
48
+ msg: 'Recognition.Starting' | 'Recognition.Succeeded' | 'Recognition.Failed';
49
+ task_id: number;
50
+ reco_id: number;
51
+ name: string;
64
52
  } | {
65
- msg: 'Debug.ListToRecognize' | 'Debug.MissAll';
66
- current: string;
67
- list: string[];
53
+ msg: 'Action.Starting' | 'Action.Succeeded' | 'Action.Failed';
54
+ task_id: number;
55
+ node_id: number;
56
+ name: string;
68
57
  });
69
58
  export declare class TaskerBase {
70
59
  #private;
@@ -74,7 +63,7 @@ export declare class TaskerBase {
74
63
  constructor(handle: maa.TaskerHandle);
75
64
  destroy(): void;
76
65
  bind(slave: ControllerBase | ResourceBase): void;
77
- post_pipeline(entry: string, param?: Record<string, unknown>): TaskJob;
66
+ post_task(entry: string, param?: Record<string, unknown>): TaskJob;
78
67
  get inited(): boolean;
79
68
  get running(): boolean;
80
69
  post_stop(): TaskJob;
@@ -120,7 +109,7 @@ export declare class TaskerBase {
120
109
  } | null)[];
121
110
  status: maa.Status;
122
111
  } | null;
123
- latest_node(task: string): maa.NodeId | null;
112
+ latest_node(node: string): maa.NodeId | null;
124
113
  }
125
114
  export declare class Tasker extends TaskerBase {
126
115
  constructor();
package/package.json CHANGED
@@ -21,13 +21,13 @@
21
21
  "prettier": "^3.3.2",
22
22
  "typescript": "^5.4.5"
23
23
  },
24
- "version": "2.4.2",
24
+ "version": "3.0.0-beta.2",
25
25
  "optionalDependencies": {
26
- "@maaxyz/maa-node-darwin-arm64": "2.4.2",
27
- "@maaxyz/maa-node-darwin-x64": "2.4.2",
28
- "@maaxyz/maa-node-linux-arm64": "2.4.2",
29
- "@maaxyz/maa-node-linux-x64": "2.4.2",
30
- "@maaxyz/maa-node-win32-arm64": "2.4.2",
31
- "@maaxyz/maa-node-win32-x64": "2.4.2"
26
+ "@maaxyz/maa-node-darwin-arm64": "3.0.0-beta.2",
27
+ "@maaxyz/maa-node-darwin-x64": "3.0.0-beta.2",
28
+ "@maaxyz/maa-node-linux-arm64": "3.0.0-beta.2",
29
+ "@maaxyz/maa-node-linux-x64": "3.0.0-beta.2",
30
+ "@maaxyz/maa-node-win32-arm64": "3.0.0-beta.2",
31
+ "@maaxyz/maa-node-win32-x64": "3.0.0-beta.2"
32
32
  }
33
33
  }
package/src/context.ts CHANGED
@@ -10,8 +10,8 @@ export class Context {
10
10
  this.#tasker = new TaskerBase(maa.context_get_tasker(this.handle))
11
11
  }
12
12
 
13
- async run_pipeline(entry: string, pipeline_override: Record<string, unknown> = {}) {
14
- const id = await maa.context_run_pipeline(
13
+ async run_task(entry: string, pipeline_override: Record<string, unknown> = {}) {
14
+ const id = await maa.context_run_task(
15
15
  this.handle,
16
16
  entry,
17
17
  JSON.stringify(pipeline_override)
package/src/maa.d.ts CHANGED
@@ -36,7 +36,7 @@ export type NotificationCallback = (message: string, details_json: string) => Ma
36
36
  export type CustomRecognitionCallback = (
37
37
  context: ContextHandle,
38
38
  task_id: TaskId,
39
- current_task_name: string,
39
+ node_name: string,
40
40
  custom_recognition_name: string,
41
41
  custom_recognition_param: string,
42
42
  image: ImageData,
@@ -45,7 +45,7 @@ export type CustomRecognitionCallback = (
45
45
  export type CustomActionCallback = (
46
46
  context: ContextHandle,
47
47
  task_id: TaskId,
48
- current_task_name: string,
48
+ node_name: string,
49
49
  custom_action_name: string,
50
50
  custom_action_param: string,
51
51
  reco_id: RecoId,
@@ -73,7 +73,7 @@ export type CustomControllerCallback = (
73
73
 
74
74
  // context.cpp
75
75
 
76
- export declare function context_run_pipeline(
76
+ export declare function context_run_task(
77
77
  context: ContextHandle,
78
78
  entry: string,
79
79
  pipeline_override: string
@@ -223,7 +223,7 @@ export declare function resource_unregister_custom_action(
223
223
  name: string
224
224
  ): boolean
225
225
  export declare function resource_clear_custom_action(handle: ResourceHandle): boolean
226
- export declare function resource_post_path(handle: ResourceHandle, path: string): ResId
226
+ export declare function resource_post_bundle(handle: ResourceHandle, path: string): ResId
227
227
  export declare function resource_clear(handle: ResourceHandle): boolean
228
228
  export declare function resource_status(handle: ResourceHandle, res_id: ResId): Status
229
229
  export declare function resource_wait(handle: ResourceHandle, res_id: ResId): Promise<Status>
@@ -244,7 +244,7 @@ export declare function tasker_bind_controller(
244
244
  controller: ControllerHandle | null
245
245
  ): boolean
246
246
  export declare function tasker_inited(handle: TaskerHandle): boolean
247
- export declare function tasker_post_pipeline(
247
+ export declare function tasker_post_task(
248
248
  handle: TaskerHandle,
249
249
  entry: string,
250
250
  pipeline_override: string
@@ -280,7 +280,7 @@ export declare function tasker_get_task_detail(
280
280
  ): [entry: string, node_ids: NodeId[], status: Status] | null
281
281
  export declare function tasker_get_latest_node(
282
282
  handle: TaskerHandle,
283
- task_name: string
283
+ node_name: string
284
284
  ): NodeId | null
285
285
 
286
286
  // config.cpp
package/src/resource.ts CHANGED
@@ -135,8 +135,8 @@ export class ResourceBase {
135
135
  }
136
136
  }
137
137
 
138
- post_path(path: string) {
139
- return new Job(this.#source, maa.resource_post_path(this.handle, path))
138
+ post_bundle(path: string) {
139
+ return new Job(this.#source, maa.resource_post_bundle(this.handle, path))
140
140
  }
141
141
 
142
142
  clear() {
package/src/tasker.ts CHANGED
@@ -48,33 +48,22 @@ export type TaskerNotify = {
48
48
  msg: 'Task.Started' | 'Task.Completed' | 'Task.Failed'
49
49
  }
50
50
  | {
51
- msg: 'Debug.RecognitionResult' | 'Debug.Hit'
52
- current: string
53
- recognition: {
54
- reco_id: maa.RecoId
55
- name: string
56
- /**
57
- * Won't be `null` for msg `Debug.Hit`
58
- */
59
- box: maa.FlatRect | null
60
- detail: string
61
- }
51
+ msg: 'NextList.Starting' | 'NextList.Succeeded' | 'NextList.Failed'
52
+ task_id: number
53
+ name: string
54
+ list: string[]
62
55
  }
63
56
  | {
64
- msg: 'Focus.ReadyToRun' | 'Focus.Completed' | 'Debug.ReadyToRun' | 'Debug.Completed'
65
- current: string
66
- node: {
67
- node_id: maa.NodeId
68
- name: string
69
- reco_id: maa.RecoId
70
- times: number
71
- completed: boolean
72
- }
57
+ msg: 'Recognition.Starting' | 'Recognition.Succeeded' | 'Recognition.Failed'
58
+ task_id: number
59
+ reco_id: number
60
+ name: string
73
61
  }
74
62
  | {
75
- msg: 'Debug.ListToRecognize' | 'Debug.MissAll'
76
- current: string
77
- list: string[]
63
+ msg: 'Action.Starting' | 'Action.Succeeded' | 'Action.Failed'
64
+ task_id: number
65
+ node_id: number
66
+ name: string
78
67
  }
79
68
  )
80
69
 
@@ -87,7 +76,7 @@ export class TaskerBase {
87
76
  set parsed_notify(cb: (msg: TaskerNotify) => maa.MaybePromise<void>) {
88
77
  this.notify = (msg, details) => {
89
78
  return cb({
90
- msg: msg.replace(/^Task(?:er)?\./, '') as any,
79
+ msg: msg.replace(/^(?:Tasker|Node)?\./, '') as any,
91
80
  ...JSON.parse(details)
92
81
  })
93
82
  }
@@ -117,11 +106,11 @@ export class TaskerBase {
117
106
  }
118
107
  }
119
108
 
120
- post_pipeline(entry: string, param: Record<string, unknown> = {}) {
109
+ post_task(entry: string, param: Record<string, unknown> = {}) {
121
110
  return new TaskJob(
122
111
  this,
123
112
  this.#source,
124
- maa.tasker_post_pipeline(this.handle, entry, JSON.stringify(param))
113
+ maa.tasker_post_task(this.handle, entry, JSON.stringify(param))
125
114
  )
126
115
  }
127
116
 
@@ -134,11 +123,7 @@ export class TaskerBase {
134
123
  }
135
124
 
136
125
  post_stop() {
137
- return new TaskJob(
138
- this,
139
- this.#source,
140
- maa.tasker_post_stop(this.handle)
141
- )
126
+ return new TaskJob(this, this.#source, maa.tasker_post_stop(this.handle))
142
127
  }
143
128
 
144
129
  get resource() {
@@ -211,8 +196,8 @@ export class TaskerBase {
211
196
  }
212
197
  }
213
198
 
214
- latest_node(task: string) {
215
- return maa.tasker_get_latest_node(this.handle, task)
199
+ latest_node(node: string) {
200
+ return maa.tasker_get_latest_node(this.handle, node)
216
201
  }
217
202
  }
218
203