open-agents-ai 0.76.0 → 0.77.0
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/dist/launcher.cjs +81 -1
- package/package.json +1 -1
package/dist/launcher.cjs
CHANGED
|
@@ -301,7 +301,87 @@ if (nodeVersion < 22) {
|
|
|
301
301
|
});
|
|
302
302
|
});
|
|
303
303
|
} else {
|
|
304
|
-
// Node >= 22 —
|
|
304
|
+
// Node >= 22 — check sub-dependencies before loading the ESM bundle
|
|
305
|
+
var _path = require("path");
|
|
306
|
+
var _fs = require("fs");
|
|
307
|
+
var _cp = require("child_process");
|
|
308
|
+
|
|
309
|
+
// Resolve the package root (where package.json lives)
|
|
310
|
+
var _pkgDir = _path.dirname(__dirname.endsWith("dist") ? _path.dirname(__dirname) : __dirname);
|
|
311
|
+
// If we're in .../lib/node_modules/open-agents-ai/dist/, go up to the package root
|
|
312
|
+
var _pkgJson = _path.join(_pkgDir, "package.json");
|
|
313
|
+
if (!_fs.existsSync(_pkgJson)) {
|
|
314
|
+
_pkgDir = _path.resolve(__dirname, "..");
|
|
315
|
+
_pkgJson = _path.join(_pkgDir, "package.json");
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Dependencies to verify — both required and optional
|
|
319
|
+
var _criticalDeps = ["better-sqlite3", "ws", "zod", "glob", "ignore"];
|
|
320
|
+
var _optionalDeps = ["open-agents-nexus", "nats.ws", "moondream", "aiwg"];
|
|
321
|
+
var _missing = [];
|
|
322
|
+
var _missingOptional = [];
|
|
323
|
+
|
|
324
|
+
function _canResolve(name) {
|
|
325
|
+
try {
|
|
326
|
+
// Check if the module exists in the package's node_modules
|
|
327
|
+
var modDir = _path.join(_pkgDir, "node_modules", name);
|
|
328
|
+
if (_fs.existsSync(modDir)) return true;
|
|
329
|
+
// Also try require.resolve from the package dir
|
|
330
|
+
require.resolve(name, { paths: [_pkgDir] });
|
|
331
|
+
return true;
|
|
332
|
+
} catch (e) {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
for (var _i = 0; _i < _criticalDeps.length; _i++) {
|
|
338
|
+
if (!_canResolve(_criticalDeps[_i])) _missing.push(_criticalDeps[_i]);
|
|
339
|
+
}
|
|
340
|
+
for (var _j = 0; _j < _optionalDeps.length; _j++) {
|
|
341
|
+
if (!_canResolve(_optionalDeps[_j])) _missingOptional.push(_optionalDeps[_j]);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
var _allMissing = _missing.concat(_missingOptional);
|
|
345
|
+
|
|
346
|
+
if (_allMissing.length > 0) {
|
|
347
|
+
var _label = _missing.length > 0 ? "required" : "optional";
|
|
348
|
+
console.log(" Installing " + _allMissing.length + " missing " + _label + " sub-dependencies...");
|
|
349
|
+
console.log(" Missing: " + _allMissing.join(", "));
|
|
350
|
+
console.log("");
|
|
351
|
+
|
|
352
|
+
// Run npm install in the package directory to restore all deps
|
|
353
|
+
try {
|
|
354
|
+
_cp.execSync("npm install --no-audit --no-fund", {
|
|
355
|
+
cwd: _pkgDir,
|
|
356
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
357
|
+
timeout: 120000,
|
|
358
|
+
env: Object.assign({}, process.env, { OA_SELF_UPGRADE: "1" }),
|
|
359
|
+
});
|
|
360
|
+
console.log(" Sub-dependencies installed.");
|
|
361
|
+
console.log("");
|
|
362
|
+
} catch (e) {
|
|
363
|
+
// If full install fails, try installing each missing dep individually
|
|
364
|
+
for (var _k = 0; _k < _allMissing.length; _k++) {
|
|
365
|
+
var _dep = _allMissing[_k];
|
|
366
|
+
try {
|
|
367
|
+
var _isOpt = _missingOptional.indexOf(_dep) !== -1;
|
|
368
|
+
console.log(" Installing " + _dep + (_isOpt ? " (optional)" : "") + "...");
|
|
369
|
+
_cp.execSync("npm install " + _dep + " --no-audit --no-fund" + (_isOpt ? " --save-optional" : ""), {
|
|
370
|
+
cwd: _pkgDir,
|
|
371
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
372
|
+
timeout: 60000,
|
|
373
|
+
});
|
|
374
|
+
} catch (e2) {
|
|
375
|
+
if (_missing.indexOf(_dep) !== -1) {
|
|
376
|
+
console.error(" WARNING: Failed to install required dep: " + _dep);
|
|
377
|
+
}
|
|
378
|
+
// Optional deps failing is fine
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// Load the ESM bundle
|
|
305
385
|
import("./index.js").catch(function(err) {
|
|
306
386
|
console.error("Failed to load open-agents:", err.message || err);
|
|
307
387
|
process.exit(1);
|
package/package.json
CHANGED