@openagents-org/agent-connector 0.2.1 → 0.2.3
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 +7 -2
- package/src/installer.js +29 -2
package/package.json
CHANGED
package/src/adapters/openclaw.js
CHANGED
|
@@ -194,9 +194,14 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
194
194
|
|
|
195
195
|
const spawnEnv = { ...process.env };
|
|
196
196
|
if (IS_WINDOWS) {
|
|
197
|
+
// Ensure node and npm global bin are on PATH
|
|
198
|
+
const nodeBinDir = path.dirname(process.execPath);
|
|
197
199
|
const npmBin = path.join(process.env.APPDATA || '', 'npm');
|
|
198
|
-
|
|
199
|
-
|
|
200
|
+
const extraPaths = [nodeBinDir, npmBin].filter(Boolean);
|
|
201
|
+
for (const p of extraPaths) {
|
|
202
|
+
if (p && !(spawnEnv.PATH || '').includes(p)) {
|
|
203
|
+
spawnEnv.PATH = p + ';' + (spawnEnv.PATH || '');
|
|
204
|
+
}
|
|
200
205
|
}
|
|
201
206
|
}
|
|
202
207
|
|
package/src/installer.js
CHANGED
|
@@ -134,7 +134,18 @@ class Installer {
|
|
|
134
134
|
|
|
135
135
|
try {
|
|
136
136
|
const cmd = process.platform === 'win32' ? `where ${binary}` : `which ${binary}`;
|
|
137
|
-
const
|
|
137
|
+
const env = { ...process.env };
|
|
138
|
+
const extraPaths = ['/usr/local/bin', '/opt/homebrew/bin'];
|
|
139
|
+
if (process.platform === 'win32') {
|
|
140
|
+
const npmBin = path.join(process.env.APPDATA || '', 'npm');
|
|
141
|
+
if (npmBin) extraPaths.push(npmBin);
|
|
142
|
+
}
|
|
143
|
+
for (const p of extraPaths) {
|
|
144
|
+
if (p && !(env.PATH || '').includes(p)) {
|
|
145
|
+
env.PATH = p + (process.platform === 'win32' ? ';' : ':') + (env.PATH || '');
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const result = execSync(cmd, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], env }).trim();
|
|
138
149
|
return result.split('\n')[0] || null;
|
|
139
150
|
} catch {
|
|
140
151
|
return null;
|
|
@@ -206,11 +217,27 @@ class Installer {
|
|
|
206
217
|
|
|
207
218
|
_execShell(cmd, timeoutMs = 300000) {
|
|
208
219
|
return new Promise((resolve, reject) => {
|
|
220
|
+
// Ensure common binary paths are available (Electron may not inherit full PATH)
|
|
221
|
+
const env = { ...process.env };
|
|
222
|
+
const extraPaths = [
|
|
223
|
+
'/usr/local/bin', '/opt/homebrew/bin',
|
|
224
|
+
path.dirname(process.execPath),
|
|
225
|
+
];
|
|
226
|
+
if (process.platform === 'win32') {
|
|
227
|
+
const npmBin = path.join(process.env.APPDATA || '', 'npm');
|
|
228
|
+
if (npmBin) extraPaths.push(npmBin);
|
|
229
|
+
}
|
|
230
|
+
for (const p of extraPaths) {
|
|
231
|
+
if (p && !(env.PATH || '').includes(p)) {
|
|
232
|
+
env.PATH = p + (process.platform === 'win32' ? ';' : ':') + (env.PATH || '');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
209
236
|
exec(cmd, {
|
|
210
237
|
encoding: 'utf-8',
|
|
211
238
|
timeout: timeoutMs,
|
|
212
239
|
shell: true,
|
|
213
|
-
env
|
|
240
|
+
env,
|
|
214
241
|
}, (error, stdout, stderr) => {
|
|
215
242
|
const output = ((stdout || '') + '\n' + (stderr || '')).trim();
|
|
216
243
|
if (error) {
|