@agentlayer.tech/wallet 0.1.0 → 0.1.1

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.
@@ -85,6 +85,41 @@ function hasCommand(name) {
85
85
  return result.status === 0;
86
86
  }
87
87
 
88
+ function commandPath(name) {
89
+ const result = spawnSync("command", ["-v", name], {
90
+ shell: true,
91
+ encoding: "utf8",
92
+ });
93
+ if (result.status !== 0) return "";
94
+ return result.stdout.trim();
95
+ }
96
+
97
+ function selectedPython() {
98
+ if (process.env.OPENCLAW_AGENT_WALLET_PYTHON) {
99
+ return process.env.OPENCLAW_AGENT_WALLET_PYTHON;
100
+ }
101
+ return commandPath("python3.11") || commandPath("python3") || "";
102
+ }
103
+
104
+ function pythonVersion(pythonBin) {
105
+ if (!pythonBin) return null;
106
+ const result = spawnSync(
107
+ pythonBin,
108
+ ["-c", "import sys,json; print(json.dumps({'version': sys.version.split()[0], 'major': sys.version_info[0], 'minor': sys.version_info[1]}))"],
109
+ { encoding: "utf8" },
110
+ );
111
+ if (result.status !== 0) return null;
112
+ try {
113
+ return JSON.parse(result.stdout);
114
+ } catch {
115
+ return null;
116
+ }
117
+ }
118
+
119
+ function pythonOk(version) {
120
+ return Boolean(version && (version.major > 3 || (version.major === 3 && version.minor >= 11)));
121
+ }
122
+
88
123
  function readLinkOrNull(target) {
89
124
  try {
90
125
  const stat = fs.lstatSync(target);
@@ -243,12 +278,19 @@ function runDoctor() {
243
278
  ["wdk-btc-wallet", path.join(packageRoot, "wdk-btc-wallet", "package.json")],
244
279
  ["wdk-evm-wallet", path.join(packageRoot, "wdk-evm-wallet", "package.json")],
245
280
  ];
246
- const commands = ["python3", "node", "npm"];
281
+ const commands = ["node", "npm"];
247
282
  const missing = [];
283
+ const pythonBin = selectedPython();
284
+ const python = pythonVersion(pythonBin);
248
285
 
249
286
  for (const command of commands) {
250
287
  if (!hasCommand(command)) missing.push(`command:${command}`);
251
288
  }
289
+ if (!pythonBin) {
290
+ missing.push("command:python3.11-or-python3");
291
+ } else if (!pythonOk(python)) {
292
+ missing.push(`python>=3.11:selected:${python?.version || "unknown"}`);
293
+ }
252
294
  for (const [label, target] of requiredPaths) {
253
295
  if (!fs.existsSync(target)) missing.push(`${label}:${target}`);
254
296
  }
@@ -266,6 +308,11 @@ function runDoctor() {
266
308
  current_runtime: currentRuntimePath(),
267
309
  active_version: activeVersion(),
268
310
  releases: listReleases(),
311
+ python: {
312
+ path: pythonBin,
313
+ version: python?.version || null,
314
+ ok: pythonOk(python),
315
+ },
269
316
  commands: Object.fromEntries(commands.map((command) => [command, hasCommand(command)])),
270
317
  missing,
271
318
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentlayer.tech/wallet",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "NPM installer for the OpenClaw Agent Wallet local runtime.",
5
5
  "type": "module",
6
6
  "bin": {
package/setup.sh CHANGED
@@ -21,7 +21,35 @@ require_cmd() {
21
21
  fi
22
22
  }
23
23
 
24
- require_cmd python3
24
+ find_python() {
25
+ if [ -n "${OPENCLAW_AGENT_WALLET_PYTHON:-}" ]; then
26
+ printf '%s\n' "$OPENCLAW_AGENT_WALLET_PYTHON"
27
+ return
28
+ fi
29
+ if command -v python3.11 >/dev/null 2>&1; then
30
+ command -v python3.11
31
+ return
32
+ fi
33
+ if command -v python3 >/dev/null 2>&1; then
34
+ command -v python3
35
+ return
36
+ fi
37
+ printf 'Required command not found: python3.11 or python3\n' >&2
38
+ exit 1
39
+ }
40
+
41
+ PYTHON_BIN="$(find_python)"
42
+ "$PYTHON_BIN" - <<'PY'
43
+ import sys
44
+
45
+ if sys.version_info < (3, 11):
46
+ raise SystemExit(
47
+ "OpenClaw Agent Wallet requires Python >= 3.11. "
48
+ f"Selected interpreter is {sys.version.split()[0]}. "
49
+ "Install Python 3.11+ or set OPENCLAW_AGENT_WALLET_PYTHON=/path/to/python3.11."
50
+ )
51
+ PY
52
+
25
53
  require_cmd node
26
54
  require_cmd npm
27
55
 
@@ -31,7 +59,7 @@ require_path "${ROOT_DIR}/.openclaw/extensions/agent-wallet" "OpenClaw extension
31
59
  require_path "${ROOT_DIR}/wdk-btc-wallet/package.json" "wdk-btc-wallet package"
32
60
  require_path "${ROOT_DIR}/wdk-evm-wallet/package.json" "wdk-evm-wallet package"
33
61
 
34
- exec python3 "$INSTALLER" \
62
+ exec "$PYTHON_BIN" "$INSTALLER" \
35
63
  --package-root "${ROOT_DIR}/agent-wallet" \
36
64
  --extension-path "${ROOT_DIR}/.openclaw/extensions/agent-wallet" \
37
65
  --wdk-btc-root "${ROOT_DIR}/wdk-btc-wallet" \