@agentlayer.tech/wallet 0.1.1 → 0.1.4
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.
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
name = "openclaw-agent-wallet"
|
|
7
7
|
version = "0.1.0"
|
|
8
8
|
description = "Plugin-friendly wallet backend for OpenClaw agents"
|
|
9
|
-
requires-python = ">=3.
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
10
|
dependencies = [
|
|
11
11
|
"httpx>=0.27.0",
|
|
12
12
|
"pydantic>=2.0.0",
|
|
@@ -27,5 +27,5 @@ dev = [
|
|
|
27
27
|
packages = ["agent_wallet"]
|
|
28
28
|
|
|
29
29
|
[tool.ruff]
|
|
30
|
-
target-version = "
|
|
30
|
+
target-version = "py310"
|
|
31
31
|
line-length = 100
|
|
@@ -307,12 +307,20 @@ def _ensure_node_runtime(npm_bin: str, project_root: Path) -> dict[str, object]:
|
|
|
307
307
|
raise SystemExit(f"Missing package.json for Node runtime at '{project_root}'.")
|
|
308
308
|
package_lock = project_root / "package-lock.json"
|
|
309
309
|
command = [npm_bin, "ci"] if package_lock.exists() else [npm_bin, "install"]
|
|
310
|
-
|
|
310
|
+
env = dict(os.environ)
|
|
311
|
+
cache_dir = env.get("NPM_CONFIG_CACHE") or env.get("npm_config_cache")
|
|
312
|
+
if not cache_dir:
|
|
313
|
+
cache_dir = str(_resolve_openclaw_home() / "npm-cache")
|
|
314
|
+
env["NPM_CONFIG_CACHE"] = cache_dir
|
|
315
|
+
env["npm_config_cache"] = cache_dir
|
|
316
|
+
Path(cache_dir).expanduser().mkdir(parents=True, exist_ok=True)
|
|
317
|
+
subprocess.run(command, cwd=project_root, check=True, env=env)
|
|
311
318
|
return {
|
|
312
319
|
"project_root": str(project_root),
|
|
313
320
|
"package_json": str(package_json),
|
|
314
321
|
"package_lock": str(package_lock) if package_lock.exists() else None,
|
|
315
322
|
"command": command,
|
|
323
|
+
"cache_dir": cache_dir,
|
|
316
324
|
}
|
|
317
325
|
|
|
318
326
|
|
|
@@ -94,13 +94,6 @@ function commandPath(name) {
|
|
|
94
94
|
return result.stdout.trim();
|
|
95
95
|
}
|
|
96
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
97
|
function pythonVersion(pythonBin) {
|
|
105
98
|
if (!pythonBin) return null;
|
|
106
99
|
const result = spawnSync(
|
|
@@ -117,7 +110,48 @@ function pythonVersion(pythonBin) {
|
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
function pythonOk(version) {
|
|
120
|
-
return Boolean(version && (version.major > 3 || (version.major === 3 && version.minor >=
|
|
113
|
+
return Boolean(version && (version.major > 3 || (version.major === 3 && version.minor >= 10)));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function pythonVenvOk(pythonBin) {
|
|
117
|
+
if (!pythonBin) return false;
|
|
118
|
+
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-python-check-"));
|
|
119
|
+
try {
|
|
120
|
+
const result = spawnSync(pythonBin, ["-m", "venv", path.join(tempRoot, "venv")], {
|
|
121
|
+
stdio: "ignore",
|
|
122
|
+
});
|
|
123
|
+
return result.status === 0;
|
|
124
|
+
} finally {
|
|
125
|
+
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function pythonProbe(pythonBin) {
|
|
130
|
+
const version = pythonVersion(pythonBin);
|
|
131
|
+
const version_ok = pythonOk(version);
|
|
132
|
+
const venv_ok = version_ok ? pythonVenvOk(pythonBin) : false;
|
|
133
|
+
return {
|
|
134
|
+
path: pythonBin || "",
|
|
135
|
+
version: version?.version || null,
|
|
136
|
+
version_ok,
|
|
137
|
+
venv_ok,
|
|
138
|
+
ok: version_ok && venv_ok,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function selectedPythonProbe() {
|
|
143
|
+
const candidates = [];
|
|
144
|
+
if (process.env.OPENCLAW_AGENT_WALLET_PYTHON) {
|
|
145
|
+
candidates.push(process.env.OPENCLAW_AGENT_WALLET_PYTHON);
|
|
146
|
+
} else {
|
|
147
|
+
for (const name of ["python3.14", "python3.13", "python3.12", "python3.11", "python3.10", "python3"]) {
|
|
148
|
+
const found = commandPath(name);
|
|
149
|
+
if (found && !candidates.includes(found)) candidates.push(found);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const probes = candidates.map((candidate) => pythonProbe(candidate));
|
|
154
|
+
return probes.find((probe) => probe.ok) || probes[0] || pythonProbe("");
|
|
121
155
|
}
|
|
122
156
|
|
|
123
157
|
function readLinkOrNull(target) {
|
|
@@ -280,16 +314,17 @@ function runDoctor() {
|
|
|
280
314
|
];
|
|
281
315
|
const commands = ["node", "npm"];
|
|
282
316
|
const missing = [];
|
|
283
|
-
const
|
|
284
|
-
const python = pythonVersion(pythonBin);
|
|
317
|
+
const python = selectedPythonProbe();
|
|
285
318
|
|
|
286
319
|
for (const command of commands) {
|
|
287
320
|
if (!hasCommand(command)) missing.push(`command:${command}`);
|
|
288
321
|
}
|
|
289
|
-
if (!
|
|
290
|
-
missing.push("command:python3.
|
|
291
|
-
} else if (!
|
|
292
|
-
missing.push(`python>=3.
|
|
322
|
+
if (!python.path) {
|
|
323
|
+
missing.push("command:python3.10-or-python3");
|
|
324
|
+
} else if (!python.version_ok) {
|
|
325
|
+
missing.push(`python>=3.10:selected:${python.version || "unknown"}`);
|
|
326
|
+
} else if (!python.venv_ok) {
|
|
327
|
+
missing.push(`python-venv-ensurepip:selected:${python.version || "unknown"}`);
|
|
293
328
|
}
|
|
294
329
|
for (const [label, target] of requiredPaths) {
|
|
295
330
|
if (!fs.existsSync(target)) missing.push(`${label}:${target}`);
|
|
@@ -308,11 +343,7 @@ function runDoctor() {
|
|
|
308
343
|
current_runtime: currentRuntimePath(),
|
|
309
344
|
active_version: activeVersion(),
|
|
310
345
|
releases: listReleases(),
|
|
311
|
-
python
|
|
312
|
-
path: pythonBin,
|
|
313
|
-
version: python?.version || null,
|
|
314
|
-
ok: pythonOk(python),
|
|
315
|
-
},
|
|
346
|
+
python,
|
|
316
347
|
commands: Object.fromEntries(commands.map((command) => [command, hasCommand(command)])),
|
|
317
348
|
missing,
|
|
318
349
|
},
|
package/package.json
CHANGED
package/setup.sh
CHANGED
|
@@ -23,32 +23,50 @@ require_cmd() {
|
|
|
23
23
|
|
|
24
24
|
find_python() {
|
|
25
25
|
if [ -n "${OPENCLAW_AGENT_WALLET_PYTHON:-}" ]; then
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fi
|
|
33
|
-
if command -v python3 >/dev/null 2>&1; then
|
|
34
|
-
command -v python3
|
|
35
|
-
return
|
|
26
|
+
if is_usable_python "$OPENCLAW_AGENT_WALLET_PYTHON"; then
|
|
27
|
+
printf '%s\n' "$OPENCLAW_AGENT_WALLET_PYTHON"
|
|
28
|
+
return
|
|
29
|
+
fi
|
|
30
|
+
printf 'OPENCLAW_AGENT_WALLET_PYTHON is not usable for this installer: %s\n' "$OPENCLAW_AGENT_WALLET_PYTHON" >&2
|
|
31
|
+
exit 1
|
|
36
32
|
fi
|
|
37
|
-
|
|
33
|
+
for candidate in python3.14 python3.13 python3.12 python3.11 python3.10 python3; do
|
|
34
|
+
if command -v "$candidate" >/dev/null 2>&1; then
|
|
35
|
+
candidate_path="$(command -v "$candidate")"
|
|
36
|
+
if is_usable_python "$candidate_path"; then
|
|
37
|
+
printf '%s\n' "$candidate_path"
|
|
38
|
+
return
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
done
|
|
42
|
+
printf 'Required Python not found: need Python >= 3.10 with working venv/ensurepip.\n' >&2
|
|
43
|
+
printf 'Install Python 3.10+ or set OPENCLAW_AGENT_WALLET_PYTHON=/path/to/working/python3.\n' >&2
|
|
38
44
|
exit 1
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
|
|
42
|
-
"$
|
|
47
|
+
is_usable_python() {
|
|
48
|
+
python_bin="$1"
|
|
49
|
+
"$python_bin" - <<'PY' >/dev/null 2>&1
|
|
43
50
|
import sys
|
|
44
51
|
|
|
45
|
-
if sys.version_info < (3,
|
|
52
|
+
if sys.version_info < (3, 10):
|
|
46
53
|
raise SystemExit(
|
|
47
|
-
"OpenClaw Agent Wallet requires Python >= 3.
|
|
54
|
+
"OpenClaw Agent Wallet requires Python >= 3.10. "
|
|
48
55
|
f"Selected interpreter is {sys.version.split()[0]}. "
|
|
49
|
-
"Install Python 3.
|
|
56
|
+
"Install Python 3.10+ or set OPENCLAW_AGENT_WALLET_PYTHON=/path/to/python3."
|
|
50
57
|
)
|
|
51
58
|
PY
|
|
59
|
+
if [ "$?" -ne 0 ]; then
|
|
60
|
+
return 1
|
|
61
|
+
fi
|
|
62
|
+
tmp_dir="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-python-check.XXXXXX")"
|
|
63
|
+
"$python_bin" -m venv "$tmp_dir/venv" >/dev/null 2>&1
|
|
64
|
+
status="$?"
|
|
65
|
+
rm -rf "$tmp_dir"
|
|
66
|
+
return "$status"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
PYTHON_BIN="$(find_python)"
|
|
52
70
|
|
|
53
71
|
require_cmd node
|
|
54
72
|
require_cmd npm
|