@openagents-org/agent-launcher 0.2.51 → 0.2.52

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openagents-org/agent-launcher",
3
- "version": "0.2.51",
3
+ "version": "0.2.52",
4
4
  "description": "OpenAgents Launcher — install, configure, and run AI coding agents from your terminal",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -55,33 +55,19 @@ class OpenClawAdapter extends BaseAdapter {
55
55
  // ------------------------------------------------------------------
56
56
 
57
57
  _findOpenclawBinary() {
58
+ // We know exactly where openclaw is — installed via --prefix ~/.openagents/nodejs
59
+ const home = process.env.USERPROFILE || process.env.HOME || '';
60
+ const portableDir = path.join(home, '.openagents', 'nodejs');
61
+ const mjs = path.join(portableDir, 'node_modules', 'openclaw', 'openclaw.mjs');
62
+ if (fs.existsSync(mjs)) return mjs;
63
+
64
+ // Fallback: check if openclaw is on PATH (system install)
58
65
  try {
59
66
  const cmd = IS_WINDOWS ? 'where openclaw' : 'which openclaw';
60
- const { getEnhancedEnv } = require('../paths');
61
- const result = execSync(cmd, { encoding: 'utf-8', timeout: 5000, env: getEnhancedEnv() })
67
+ const result = execSync(cmd, { encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] })
62
68
  .split(/\r?\n/)[0].trim();
63
69
  if (result) return result;
64
70
  } catch {}
65
-
66
- // Check common npm global directories
67
- const dirs = [];
68
- const home = process.env.USERPROFILE || process.env.HOME || '';
69
- // --prefix installs put .bin shims in node_modules/.bin/
70
- if (home) dirs.push(path.join(home, '.openagents', 'nodejs', 'node_modules', '.bin'));
71
- if (IS_WINDOWS) {
72
- if (home) dirs.push(path.join(home, '.openagents', 'nodejs'));
73
- const appdata = process.env.APPDATA || '';
74
- if (appdata) dirs.push(path.join(appdata, 'npm'));
75
- } else {
76
- if (home) dirs.push(path.join(home, '.openagents', 'nodejs', 'bin'));
77
- dirs.push('/usr/local/bin');
78
- }
79
- for (const d of dirs) {
80
- for (const name of ['openclaw.cmd', 'openclaw']) {
81
- const candidate = path.join(d, name);
82
- if (fs.existsSync(candidate)) return candidate;
83
- }
84
- }
85
71
  return null;
86
72
  }
87
73
 
@@ -245,21 +231,21 @@ class OpenClawAdapter extends BaseAdapter {
245
231
  const stderrFd = fs.openSync(stderrFile, 'w');
246
232
  this._log('Spawn: stderr → ' + stderrFile);
247
233
 
248
- let spawnBin = binary;
249
- let spawnArgs = args;
250
- if (IS_WINDOWS) {
251
- // Avoid cmd.exe — it can't handle Unicode paths (Chinese/Japanese/Korean usernames)
252
- // Find node.exe + openclaw.mjs and spawn directly
253
- const portableNode = path.join(os.homedir(), '.openagents', 'nodejs', 'node.exe');
254
- const openclawMjs = path.join(os.homedir(), '.openagents', 'nodejs', 'node_modules', 'openclaw', 'openclaw.mjs');
255
- if (fs.existsSync(portableNode) && fs.existsSync(openclawMjs)) {
256
- spawnBin = portableNode;
257
- spawnArgs = [openclawMjs, ...args];
258
- } else {
259
- // Fallback to cmd.exe (works for ASCII-only paths)
260
- spawnBin = process.env.COMSPEC || 'cmd.exe';
261
- spawnArgs = ['/C', binary, ...args.map(a => a.includes(' ') ? `"${a}"` : a)];
262
- }
234
+ // Always spawn node + openclaw.mjs directly (no shims, no cmd.exe, cross-platform)
235
+ const portableDir = path.join(os.homedir(), '.openagents', 'nodejs');
236
+ const nodeBin = IS_WINDOWS
237
+ ? path.join(portableDir, 'node.exe')
238
+ : path.join(portableDir, 'bin', 'node');
239
+ const openclawMjs = path.join(portableDir, 'node_modules', 'openclaw', 'openclaw.mjs');
240
+
241
+ let spawnBin, spawnArgs;
242
+ if (fs.existsSync(nodeBin) && fs.existsSync(openclawMjs)) {
243
+ spawnBin = nodeBin;
244
+ spawnArgs = [openclawMjs, ...args];
245
+ } else {
246
+ // Fallback: try the binary path directly (system install)
247
+ spawnBin = binary;
248
+ spawnArgs = args;
263
249
  }
264
250
  const proc = spawn(spawnBin, spawnArgs, {
265
251
  stdio: ['ignore', 'pipe', stderrFd],