@openagents-org/agent-launcher 0.2.46 → 0.2.48
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 +27 -2
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],
|
|
@@ -450,6 +460,7 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
450
460
|
// This is the proper way to add custom LLM endpoints to OpenClaw.
|
|
451
461
|
// See: https://docs.openclaw.ai/concepts/model-providers
|
|
452
462
|
try {
|
|
463
|
+
fs.mkdirSync(OPENCLAW_STATE_DIR, { recursive: true });
|
|
453
464
|
let config = {};
|
|
454
465
|
try { config = JSON.parse(fs.readFileSync(configFile, 'utf-8')); } catch {}
|
|
455
466
|
|
|
@@ -468,6 +479,20 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
468
479
|
|
|
469
480
|
fs.writeFileSync(configFile, JSON.stringify(config, null, 2), 'utf-8');
|
|
470
481
|
} catch {}
|
|
482
|
+
|
|
483
|
+
// Also write auth-profiles.json for the custom provider
|
|
484
|
+
try {
|
|
485
|
+
const agentDir = path.join(OPENCLAW_STATE_DIR, 'agents', 'main', 'agent');
|
|
486
|
+
fs.mkdirSync(agentDir, { recursive: true });
|
|
487
|
+
const authFile = path.join(agentDir, 'auth-profiles.json');
|
|
488
|
+
let authData = { version: 1, profiles: {} };
|
|
489
|
+
try { authData = JSON.parse(fs.readFileSync(authFile, 'utf-8')); } catch {}
|
|
490
|
+
authData.profiles = authData.profiles || {};
|
|
491
|
+
authData.profiles['custom:manual'] = { type: 'token', provider: 'custom', token: apiKey };
|
|
492
|
+
authData.lastGood = authData.lastGood || {};
|
|
493
|
+
authData.lastGood.custom = 'custom:manual';
|
|
494
|
+
fs.writeFileSync(authFile, JSON.stringify(authData, null, 2), 'utf-8');
|
|
495
|
+
} catch {}
|
|
471
496
|
}
|
|
472
497
|
}
|
|
473
498
|
}
|