@openagents-org/agent-launcher 0.2.88 → 0.2.89
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 +14 -4
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -19,6 +19,7 @@ const { spawn, execSync } = require('child_process');
|
|
|
19
19
|
const BaseAdapter = require('./base');
|
|
20
20
|
const { formatAttachmentsForPrompt } = require('./utils');
|
|
21
21
|
const { buildOpenclawSkillMd, buildOpenclawSystemPrompt } = require('./workspace-prompt');
|
|
22
|
+
const { getRuntimePrefix } = require('../paths');
|
|
22
23
|
|
|
23
24
|
const IS_WINDOWS = process.platform === 'win32';
|
|
24
25
|
const OPENCLAW_STATE_DIR = path.join(
|
|
@@ -55,8 +56,13 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
55
56
|
// ------------------------------------------------------------------
|
|
56
57
|
|
|
57
58
|
_findOpenclawBinary() {
|
|
58
|
-
// We know exactly where openclaw is — installed via --prefix ~/.openagents/nodejs
|
|
59
59
|
const home = process.env.USERPROFILE || process.env.HOME || '';
|
|
60
|
+
|
|
61
|
+
// Tier 0: Isolated runtime prefix (~/.openagents/runtimes/openclaw/)
|
|
62
|
+
const runtimeMjs = path.join(getRuntimePrefix('openclaw'), 'node_modules', 'openclaw', 'openclaw.mjs');
|
|
63
|
+
if (fs.existsSync(runtimeMjs)) return runtimeMjs;
|
|
64
|
+
|
|
65
|
+
// Tier 0b: Legacy shared prefix
|
|
60
66
|
const portableDir = path.join(home, '.openagents', 'nodejs');
|
|
61
67
|
const mjs = path.join(portableDir, 'node_modules', 'openclaw', 'openclaw.mjs');
|
|
62
68
|
if (fs.existsSync(mjs)) return mjs;
|
|
@@ -194,8 +200,9 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
194
200
|
if (IS_WINDOWS) {
|
|
195
201
|
const nodeBinDir = path.dirname(process.execPath);
|
|
196
202
|
const npmBin = path.join(process.env.APPDATA || '', 'npm');
|
|
197
|
-
const
|
|
198
|
-
|
|
203
|
+
const portableDir2 = path.join(os.homedir(), '.openagents', 'nodejs');
|
|
204
|
+
const runtimeBin = path.join(getRuntimePrefix('openclaw'), 'node_modules', '.bin');
|
|
205
|
+
for (const p of [runtimeBin, nodeBinDir, npmBin, portableDir2]) {
|
|
199
206
|
if (p && !(spawnEnv.PATH || '').includes(p)) {
|
|
200
207
|
spawnEnv.PATH = p + path.delimiter + (spawnEnv.PATH || '');
|
|
201
208
|
}
|
|
@@ -243,7 +250,10 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
243
250
|
const nodeBin = IS_WINDOWS
|
|
244
251
|
? path.join(portableDir, 'node.exe')
|
|
245
252
|
: path.join(portableDir, 'bin', 'node');
|
|
246
|
-
|
|
253
|
+
// Check isolated runtime first, then legacy
|
|
254
|
+
const runtimeMjs = path.join(getRuntimePrefix('openclaw'), 'node_modules', 'openclaw', 'openclaw.mjs');
|
|
255
|
+
const legacyMjs = path.join(portableDir, 'node_modules', 'openclaw', 'openclaw.mjs');
|
|
256
|
+
const openclawMjs = fs.existsSync(runtimeMjs) ? runtimeMjs : legacyMjs;
|
|
247
257
|
|
|
248
258
|
let spawnBin, spawnArgs;
|
|
249
259
|
if (fs.existsSync(nodeBin) && fs.existsSync(openclawMjs)) {
|