@okxweb3/a2a-node 0.1.7 → 0.1.8-beta-57790b2f70-260708151055

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.
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { existsSync } = require("node:fs");
5
+ const { dirname, join, resolve } = require("node:path");
6
+ const { spawnSync } = require("node:child_process");
7
+
8
+ function run(command, args) {
9
+ return spawnSync(command, args, {
10
+ encoding: "utf8",
11
+ stdio: ["ignore", "pipe", "pipe"],
12
+ });
13
+ }
14
+
15
+ function candidatePackageRoots() {
16
+ const roots = new Set();
17
+ roots.add(resolve(__dirname, ".."));
18
+ roots.add(process.cwd());
19
+ return [...roots];
20
+ }
21
+
22
+ function findBindingPath() {
23
+ for (const root of candidatePackageRoots()) {
24
+ const candidate = join(
25
+ root,
26
+ "node_modules",
27
+ "@xmtp",
28
+ "node-bindings",
29
+ "dist",
30
+ "bindings_node.darwin-arm64.node",
31
+ );
32
+ if (existsSync(candidate)) {
33
+ return candidate;
34
+ }
35
+ }
36
+ return null;
37
+ }
38
+
39
+ function main() {
40
+ if (process.platform !== "darwin" || process.arch !== "arm64") {
41
+ return;
42
+ }
43
+
44
+ const bindingPath = findBindingPath();
45
+ if (!bindingPath) {
46
+ return;
47
+ }
48
+
49
+ const otool = run("otool", ["-L", bindingPath]);
50
+ if (otool.status !== 0) {
51
+ console.warn(
52
+ `[patch-xmtp-node-bindings] unable to inspect ${bindingPath}: ${otool.stderr.trim()}`,
53
+ );
54
+ return;
55
+ }
56
+
57
+ const badLibiconv = otool.stdout
58
+ .split(/\r?\n/)
59
+ .map((line) => line.trim().split(/\s+/)[0])
60
+ .find(
61
+ (path) =>
62
+ path.startsWith("/nix/store/") && path.endsWith("/lib/libiconv.2.dylib"),
63
+ );
64
+
65
+ if (!badLibiconv) {
66
+ return;
67
+ }
68
+
69
+ const patch = run("install_name_tool", [
70
+ "-change",
71
+ badLibiconv,
72
+ "/usr/lib/libiconv.2.dylib",
73
+ bindingPath,
74
+ ]);
75
+ if (patch.status !== 0) {
76
+ console.warn(
77
+ `[patch-xmtp-node-bindings] unable to patch ${bindingPath}: ${patch.stderr.trim()}`,
78
+ );
79
+ return;
80
+ }
81
+
82
+ const sign = run("codesign", ["--force", "--sign", "-", bindingPath]);
83
+ if (sign.status !== 0) {
84
+ console.warn(
85
+ `[patch-xmtp-node-bindings] patched ${bindingPath}, but unable to re-sign it: ${sign.stderr.trim()}`,
86
+ );
87
+ return;
88
+ }
89
+
90
+ console.log(
91
+ `[patch-xmtp-node-bindings] patched libiconv install name in ${bindingPath}`,
92
+ );
93
+ }
94
+
95
+ main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okxweb3/a2a-node",
3
- "version": "0.1.7",
3
+ "version": "0.1.8-beta-57790b2f70-260708151055",
4
4
  "description": "Host-agnostic Node CLI for E2E encrypted agent-to-agent communication via XMTP",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -14,6 +14,7 @@
14
14
  },
15
15
  "scripts": {
16
16
  "preinstall": "node dist/check-node-version.js",
17
+ "postinstall": "node dist/patch-xmtp-node-bindings-libiconv.js",
17
18
  "build": "node scripts/build.mjs",
18
19
  "pack": "node scripts/pack.mjs",
19
20
  "typecheck": "tsc --noEmit",
@@ -30,10 +31,10 @@
30
31
  "access": "public"
31
32
  },
32
33
  "dependencies": {
33
- "@xmtp/agent-sdk": "0.0.7",
34
+ "@xmtp/agent-sdk": "2.3.0",
34
35
  "@xmtp/content-type-remote-attachment": "2.0.4",
35
- "@xmtp/node-bindings": "1.6.8",
36
- "@xmtp/node-sdk": "4.6.0",
36
+ "@xmtp/node-bindings": "1.10.0",
37
+ "@xmtp/node-sdk": "6.0.0",
37
38
  "@xmtp/proto": "3.78.0",
38
39
  "viem": "2.48.4",
39
40
  "ws": "8.20.0"