@maaxyz/maa-node 4.2.0-beta.1 → 4.2.0

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 CHANGED
@@ -2,10 +2,11 @@ import * as maa from './maa';
2
2
  import { Resource } from './resource';
3
3
  export declare class AgentClient {
4
4
  handle: maa.AgentClientHandle;
5
- constructor();
5
+ constructor(identifier?: string);
6
6
  destroy(): void;
7
+ get identifier(): string | null;
7
8
  bind_resource(resource: Resource): void;
8
- create_socket(identifier: string | null): string;
9
9
  connect(): Promise<void>;
10
10
  disconnect(): void;
11
+ get connected(): boolean;
11
12
  }
@@ -1031,8 +1031,8 @@ function pp() {
1031
1031
  var maa8 = __toESM(require_maa());
1032
1032
  var AgentClient = class {
1033
1033
  handle;
1034
- constructor() {
1035
- const h = maa8.agent_client_create();
1034
+ constructor(identifier) {
1035
+ const h = maa8.agent_client_create(identifier);
1036
1036
  if (!h) {
1037
1037
  throw "AgentClient create failed";
1038
1038
  }
@@ -1041,18 +1041,14 @@ var AgentClient = class {
1041
1041
  destroy() {
1042
1042
  maa8.agent_client_destroy(this.handle);
1043
1043
  }
1044
+ get identifier() {
1045
+ return maa8.agent_client_identifier(this.handle);
1046
+ }
1044
1047
  bind_resource(resource) {
1045
1048
  if (!maa8.agent_client_bind_resource(this.handle, resource.handle)) {
1046
1049
  throw "AgentClient bind resource failed";
1047
1050
  }
1048
1051
  }
1049
- create_socket(identifier) {
1050
- const rid = maa8.agent_client_create_socket(this.handle, identifier);
1051
- if (rid === null) {
1052
- throw "AgentClient create socket failed";
1053
- }
1054
- return rid;
1055
- }
1056
1052
  async connect() {
1057
1053
  if (!await maa8.agent_client_connect(this.handle)) {
1058
1054
  throw "AgentClient connect failed";
@@ -1063,6 +1059,9 @@ var AgentClient = class {
1063
1059
  throw "AgentClient disconnect failed";
1064
1060
  }
1065
1061
  }
1062
+ get connected() {
1063
+ return maa8.agent_client_connected(this.handle);
1064
+ }
1066
1065
  };
1067
1066
  // Annotate the CommonJS export names for ESM import in node:
1068
1067
  0 && (module.exports = {
@@ -1071,6 +1071,12 @@ var AgentServer = {
1071
1071
  },
1072
1072
  shut_down() {
1073
1073
  maa8.agent_server_shut_down();
1074
+ },
1075
+ async join() {
1076
+ await maa8.agent_server_join();
1077
+ },
1078
+ detach() {
1079
+ maa8.agent_server_detach();
1074
1080
  }
1075
1081
  };
1076
1082
  // Annotate the CommonJS export names for ESM import in node:
package/dist/maa.d.ts CHANGED
@@ -225,8 +225,15 @@ export declare function resource_unregister_custom_action(
225
225
  ): boolean
226
226
  export declare function resource_clear_custom_action(handle: ResourceHandle): boolean
227
227
  export declare function resource_post_bundle(handle: ResourceHandle, path: string): ResId
228
- export declare function resource_override_pipeline(handle: ResourceHandle, pipeline_override: string): bool
229
- export declare function resource_override_next(handle: ResourceHandle, node_name: string, next_list: string[]): bool
228
+ export declare function resource_override_pipeline(
229
+ handle: ResourceHandle,
230
+ pipeline_override: string
231
+ ): bool
232
+ export declare function resource_override_next(
233
+ handle: ResourceHandle,
234
+ node_name: string,
235
+ next_list: string[]
236
+ ): bool
230
237
  export declare function resource_clear(handle: ResourceHandle): boolean
231
238
  export declare function resource_status(handle: ResourceHandle, res_id: ResId): Status
232
239
  export declare function resource_wait(handle: ResourceHandle, res_id: ResId): Promise<Status>
@@ -380,18 +387,16 @@ export declare const AgentRole: 'client' | 'server'
380
387
 
381
388
  // agent.cpp - client
382
389
 
383
- export declare function agent_client_create(): AgentClientHandle | null
390
+ export declare function agent_client_create(identifier?: string): AgentClientHandle | null
384
391
  export declare function agent_client_destroy(handle: AgentClientHandle): void
392
+ export declare function agent_client_identifier(handle: AgentClientHandle): string | null
385
393
  export declare function agent_client_bind_resource(
386
394
  handle: AgentClientHandle,
387
395
  resource: ResourceHandle
388
396
  ): boolean
389
- export declare function agent_client_create_socket(
390
- handle: AgentClientHandle,
391
- identifier: string | null
392
- ): string | null
393
397
  export declare function agent_client_connect(handle: AgentClientHandle): Promise<boolean>
394
398
  export declare function agent_client_disconnect(handle: AgentClientHandle): boolean
399
+ export declare function agent_client_connected(handle: AgentClientHandle): boolean
395
400
 
396
401
  // agent.cpp - server
397
402
 
@@ -405,5 +410,5 @@ export declare function agent_server_register_custom_action(
405
410
  ): boolean
406
411
  export declare function agent_server_start_up(identifier: string): boolean
407
412
  export declare function agent_server_shut_down(): void
408
- // export declare function agent_server_join(): void
409
- // export declare function agent_server_detach(): void
413
+ export declare function agent_server_join(): Promise<true>
414
+ export declare function agent_server_detach(): void
package/dist/server.d.ts CHANGED
@@ -4,4 +4,6 @@ export declare const AgentServer: {
4
4
  register_custom_action(name: string, func: CustomActionCallback): void;
5
5
  start_up(identifier: string): void;
6
6
  shut_down(): void;
7
+ join(): Promise<void>;
8
+ detach(): void;
7
9
  };
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.2.0-beta.1",
28
+ "version": "4.2.0",
29
29
  "optionalDependencies": {
30
- "@maaxyz/maa-node-darwin-arm64": "4.2.0-beta.1",
31
- "@maaxyz/maa-node-darwin-x64": "4.2.0-beta.1",
32
- "@maaxyz/maa-node-linux-arm64": "4.2.0-beta.1",
33
- "@maaxyz/maa-node-linux-x64": "4.2.0-beta.1",
34
- "@maaxyz/maa-node-win32-arm64": "4.2.0-beta.1",
35
- "@maaxyz/maa-node-win32-x64": "4.2.0-beta.1"
30
+ "@maaxyz/maa-node-darwin-arm64": "4.2.0",
31
+ "@maaxyz/maa-node-darwin-x64": "4.2.0",
32
+ "@maaxyz/maa-node-linux-arm64": "4.2.0",
33
+ "@maaxyz/maa-node-linux-x64": "4.2.0",
34
+ "@maaxyz/maa-node-win32-arm64": "4.2.0",
35
+ "@maaxyz/maa-node-win32-x64": "4.2.0"
36
36
  }
37
37
  }
package/src/client.ts CHANGED
@@ -4,8 +4,8 @@ import { Resource } from './resource'
4
4
  export class AgentClient {
5
5
  handle: maa.AgentClientHandle
6
6
 
7
- constructor() {
8
- const h = maa.agent_client_create()
7
+ constructor(identifier?: string) {
8
+ const h = maa.agent_client_create(identifier)
9
9
  if (!h) {
10
10
  throw 'AgentClient create failed'
11
11
  }
@@ -16,20 +16,16 @@ export class AgentClient {
16
16
  maa.agent_client_destroy(this.handle)
17
17
  }
18
18
 
19
+ get identifier() {
20
+ return maa.agent_client_identifier(this.handle)
21
+ }
22
+
19
23
  bind_resource(resource: Resource) {
20
24
  if (!maa.agent_client_bind_resource(this.handle, resource.handle)) {
21
25
  throw 'AgentClient bind resource failed'
22
26
  }
23
27
  }
24
28
 
25
- create_socket(identifier: string | null) {
26
- const rid = maa.agent_client_create_socket(this.handle, identifier)
27
- if (rid === null) {
28
- throw 'AgentClient create socket failed'
29
- }
30
- return rid
31
- }
32
-
33
29
  async connect() {
34
30
  if (!(await maa.agent_client_connect(this.handle))) {
35
31
  throw 'AgentClient connect failed'
@@ -41,4 +37,8 @@ export class AgentClient {
41
37
  throw 'AgentClient disconnect failed'
42
38
  }
43
39
  }
40
+
41
+ get connected() {
42
+ return maa.agent_client_connected(this.handle)
43
+ }
44
44
  }
package/src/maa.d.ts CHANGED
@@ -225,8 +225,15 @@ export declare function resource_unregister_custom_action(
225
225
  ): boolean
226
226
  export declare function resource_clear_custom_action(handle: ResourceHandle): boolean
227
227
  export declare function resource_post_bundle(handle: ResourceHandle, path: string): ResId
228
- export declare function resource_override_pipeline(handle: ResourceHandle, pipeline_override: string): bool
229
- export declare function resource_override_next(handle: ResourceHandle, node_name: string, next_list: string[]): bool
228
+ export declare function resource_override_pipeline(
229
+ handle: ResourceHandle,
230
+ pipeline_override: string
231
+ ): bool
232
+ export declare function resource_override_next(
233
+ handle: ResourceHandle,
234
+ node_name: string,
235
+ next_list: string[]
236
+ ): bool
230
237
  export declare function resource_clear(handle: ResourceHandle): boolean
231
238
  export declare function resource_status(handle: ResourceHandle, res_id: ResId): Status
232
239
  export declare function resource_wait(handle: ResourceHandle, res_id: ResId): Promise<Status>
@@ -380,18 +387,16 @@ export declare const AgentRole: 'client' | 'server'
380
387
 
381
388
  // agent.cpp - client
382
389
 
383
- export declare function agent_client_create(): AgentClientHandle | null
390
+ export declare function agent_client_create(identifier?: string): AgentClientHandle | null
384
391
  export declare function agent_client_destroy(handle: AgentClientHandle): void
392
+ export declare function agent_client_identifier(handle: AgentClientHandle): string | null
385
393
  export declare function agent_client_bind_resource(
386
394
  handle: AgentClientHandle,
387
395
  resource: ResourceHandle
388
396
  ): boolean
389
- export declare function agent_client_create_socket(
390
- handle: AgentClientHandle,
391
- identifier: string | null
392
- ): string | null
393
397
  export declare function agent_client_connect(handle: AgentClientHandle): Promise<boolean>
394
398
  export declare function agent_client_disconnect(handle: AgentClientHandle): boolean
399
+ export declare function agent_client_connected(handle: AgentClientHandle): boolean
395
400
 
396
401
  // agent.cpp - server
397
402
 
@@ -405,5 +410,5 @@ export declare function agent_server_register_custom_action(
405
410
  ): boolean
406
411
  export declare function agent_server_start_up(identifier: string): boolean
407
412
  export declare function agent_server_shut_down(): void
408
- // export declare function agent_server_join(): void
409
- // export declare function agent_server_detach(): void
413
+ export declare function agent_server_join(): Promise<true>
414
+ export declare function agent_server_detach(): void
package/src/server.ts CHANGED
@@ -52,5 +52,13 @@ export const AgentServer = {
52
52
 
53
53
  shut_down() {
54
54
  maa.agent_server_shut_down()
55
+ },
56
+
57
+ async join() {
58
+ await maa.agent_server_join()
59
+ },
60
+
61
+ detach() {
62
+ maa.agent_server_detach()
55
63
  }
56
64
  }