@openagents-org/agent-connector 0.2.2 → 0.2.4
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/installer.js +29 -2
- package/src/registry.js +10 -1
package/package.json
CHANGED
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) {
|
package/src/registry.js
CHANGED
|
@@ -83,7 +83,16 @@ class Registry {
|
|
|
83
83
|
*/
|
|
84
84
|
getEntry(agentType) {
|
|
85
85
|
const catalog = this.getCatalogSync();
|
|
86
|
-
|
|
86
|
+
const entry = catalog.find((e) => e.name === agentType) || null;
|
|
87
|
+
// If the cached entry is missing install info, merge with bundled
|
|
88
|
+
if (entry && !entry.install) {
|
|
89
|
+
const bundled = this._loadBundled();
|
|
90
|
+
const bundledEntry = bundled.find((e) => e.name === agentType);
|
|
91
|
+
if (bundledEntry && bundledEntry.install) {
|
|
92
|
+
return { ...entry, install: bundledEntry.install };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return entry;
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
/**
|