@openagents-org/agent-launcher 0.2.45 → 0.2.47
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/package.json +1 -1
- package/src/adapters/openclaw.js +12 -2
- package/src/installer.js +28 -3
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -247,8 +247,18 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
247
247
|
let spawnBin = binary;
|
|
248
248
|
let spawnArgs = args;
|
|
249
249
|
if (IS_WINDOWS) {
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
// Avoid cmd.exe — it can't handle Unicode paths (Chinese/Japanese/Korean usernames)
|
|
251
|
+
// Find node.exe + openclaw.mjs and spawn directly
|
|
252
|
+
const portableNode = path.join(os.homedir(), '.openagents', 'nodejs', 'node.exe');
|
|
253
|
+
const openclawMjs = path.join(os.homedir(), '.openagents', 'nodejs', 'node_modules', 'openclaw', 'openclaw.mjs');
|
|
254
|
+
if (fs.existsSync(portableNode) && fs.existsSync(openclawMjs)) {
|
|
255
|
+
spawnBin = portableNode;
|
|
256
|
+
spawnArgs = [openclawMjs, ...args];
|
|
257
|
+
} else {
|
|
258
|
+
// Fallback to cmd.exe (works for ASCII-only paths)
|
|
259
|
+
spawnBin = process.env.COMSPEC || 'cmd.exe';
|
|
260
|
+
spawnArgs = ['/C', binary, ...args.map(a => a.includes(' ') ? `"${a}"` : a)];
|
|
261
|
+
}
|
|
252
262
|
}
|
|
253
263
|
const proc = spawn(spawnBin, spawnArgs, {
|
|
254
264
|
stdio: ['ignore', 'pipe', stderrFd],
|
package/src/installer.js
CHANGED
|
@@ -36,10 +36,34 @@ class Installer {
|
|
|
36
36
|
* Checks binary on PATH first, then marker files.
|
|
37
37
|
*/
|
|
38
38
|
isInstalled(agentType) {
|
|
39
|
-
// Fast check: marker file
|
|
39
|
+
// Fast check: marker file
|
|
40
40
|
if (this._hasMarker(agentType)) return true;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
|
|
42
|
+
// Check if binary exists on PATH
|
|
43
|
+
const binaryPath = this._whichBinary(agentType);
|
|
44
|
+
if (!binaryPath) return false;
|
|
45
|
+
|
|
46
|
+
// Verify it's not a stale shim — check the actual package exists
|
|
47
|
+
// npm shims point to node_modules/<pkg>/ — if the package dir is gone, the shim is stale
|
|
48
|
+
const entry = this.registry.getEntry(agentType);
|
|
49
|
+
const npmPkg = entry && entry.install ? entry.install.npm_package : null;
|
|
50
|
+
const binary = entry && entry.install ? entry.install.binary : agentType;
|
|
51
|
+
const portableDir = path.join(os.homedir(), '.openagents', 'nodejs');
|
|
52
|
+
const globalModules = path.join(portableDir, 'node_modules');
|
|
53
|
+
|
|
54
|
+
// If the binary is in our portable dir, verify the package exists
|
|
55
|
+
if (binaryPath.startsWith(portableDir)) {
|
|
56
|
+
const pkgDir = path.join(globalModules, npmPkg || binary);
|
|
57
|
+
if (!fs.existsSync(path.join(pkgDir, 'package.json'))) {
|
|
58
|
+
// Stale shim — clean it up
|
|
59
|
+
for (const ext of ['', '.cmd', '.ps1']) {
|
|
60
|
+
try { const p = path.join(portableDir, binary + ext); if (fs.existsSync(p)) fs.unlinkSync(p); } catch {}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return true;
|
|
43
67
|
}
|
|
44
68
|
|
|
45
69
|
/**
|
|
@@ -295,6 +319,7 @@ class Installer {
|
|
|
295
319
|
proc.on('close', (code) => {
|
|
296
320
|
if (code === 0) {
|
|
297
321
|
this._markUninstalled(agentType);
|
|
322
|
+
this._cleanStaleShims(agentType);
|
|
298
323
|
if (onData) onData(`\nDone! ${agentType} has been uninstalled.\n`);
|
|
299
324
|
resolve({ success: true, command: cmd });
|
|
300
325
|
} else {
|