open-agents-ai 0.187.535 → 0.187.536
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/index.js +120 -15
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9457,6 +9457,45 @@ process.on('unhandledRejection', (reason) => {
|
|
|
9457
9457
|
}
|
|
9458
9458
|
connected = true;
|
|
9459
9459
|
|
|
9460
|
+
// Register this nexus dir in the global registry so the API daemon
|
|
9461
|
+
// (and any other consumer) can discover us regardless of cwd.
|
|
9462
|
+
try {
|
|
9463
|
+
var nodePath_reg = require('node:path');
|
|
9464
|
+
var nodeFs_reg = require('node:fs');
|
|
9465
|
+
var nodeOs_reg = require('node:os');
|
|
9466
|
+
var regDir = nodePath_reg.join(nodeOs_reg.homedir(), '.open-agents');
|
|
9467
|
+
if (!nodeFs_reg.existsSync(regDir)) nodeFs_reg.mkdirSync(regDir, { recursive: true });
|
|
9468
|
+
var regFile = nodePath_reg.join(regDir, 'nexus-registry.json');
|
|
9469
|
+
var existing = { dirs: [] };
|
|
9470
|
+
try {
|
|
9471
|
+
if (nodeFs_reg.existsSync(regFile)) existing = JSON.parse(nodeFs_reg.readFileSync(regFile, 'utf-8')) || { dirs: [] };
|
|
9472
|
+
if (!Array.isArray(existing.dirs)) existing.dirs = [];
|
|
9473
|
+
} catch { existing = { dirs: [] }; }
|
|
9474
|
+
// Drop entries that no longer exist on disk
|
|
9475
|
+
existing.dirs = existing.dirs.filter(function(e) {
|
|
9476
|
+
var d = typeof e === 'string' ? e : (e && e.dir);
|
|
9477
|
+
return d && nodeFs_reg.existsSync(nodePath_reg.join(d, 'status.json'));
|
|
9478
|
+
});
|
|
9479
|
+
// De-dup + prepend ourselves
|
|
9480
|
+
var meDir = nexusDir;
|
|
9481
|
+
existing.dirs = existing.dirs.filter(function(e) {
|
|
9482
|
+
var d = typeof e === 'string' ? e : (e && e.dir);
|
|
9483
|
+
return d !== meDir;
|
|
9484
|
+
});
|
|
9485
|
+
existing.dirs.unshift({
|
|
9486
|
+
dir: meDir,
|
|
9487
|
+
peerId: nexus.peerId || '',
|
|
9488
|
+
pid: process.pid,
|
|
9489
|
+
startedAt: new Date().toISOString(),
|
|
9490
|
+
});
|
|
9491
|
+
// Cap at 16 entries
|
|
9492
|
+
if (existing.dirs.length > 16) existing.dirs = existing.dirs.slice(0, 16);
|
|
9493
|
+
nodeFs_reg.writeFileSync(regFile, JSON.stringify(existing, null, 2));
|
|
9494
|
+
dlog('nexus-registry: registered ' + meDir);
|
|
9495
|
+
} catch (regErr) {
|
|
9496
|
+
dlog('nexus-registry write failed: ' + (regErr.message || regErr));
|
|
9497
|
+
}
|
|
9498
|
+
|
|
9460
9499
|
// http_tunnel capability — proxies HTTP requests from remote peers
|
|
9461
9500
|
// to the local OA API daemon. Auth is delegated to the API key store
|
|
9462
9501
|
// (remote sends share key in Authorization header). SSE streams are
|
|
@@ -587000,23 +587039,73 @@ async function handleMintKey(ctx3) {
|
|
|
587000
587039
|
}
|
|
587001
587040
|
return true;
|
|
587002
587041
|
}
|
|
587042
|
+
function _readStatusFile(p2) {
|
|
587043
|
+
if (!existsSync102(p2)) return null;
|
|
587044
|
+
try {
|
|
587045
|
+
const data = JSON.parse(readFileSync83(p2, "utf-8"));
|
|
587046
|
+
if (data?.connected && typeof data.peerId === "string" && data.peerId.length > 10) {
|
|
587047
|
+
return {
|
|
587048
|
+
peerId: data.peerId,
|
|
587049
|
+
agentName: typeof data.agentName === "string" ? data.agentName : null,
|
|
587050
|
+
source: p2
|
|
587051
|
+
};
|
|
587052
|
+
}
|
|
587053
|
+
} catch {
|
|
587054
|
+
}
|
|
587055
|
+
return null;
|
|
587056
|
+
}
|
|
587003
587057
|
function resolveLocalPeerId() {
|
|
587058
|
+
const override = process.env["OA_NEXUS_DIR"];
|
|
587059
|
+
if (override) {
|
|
587060
|
+
const r2 = _readStatusFile(join118(override, "status.json"));
|
|
587061
|
+
if (r2) return r2;
|
|
587062
|
+
}
|
|
587063
|
+
try {
|
|
587064
|
+
const regPath = join118(homedir40(), ".open-agents", "nexus-registry.json");
|
|
587065
|
+
if (existsSync102(regPath)) {
|
|
587066
|
+
const reg = JSON.parse(readFileSync83(regPath, "utf-8"));
|
|
587067
|
+
const entries = Array.isArray(reg?.dirs) ? reg.dirs : [];
|
|
587068
|
+
for (const entry of entries) {
|
|
587069
|
+
const dir = typeof entry === "string" ? entry : entry?.dir;
|
|
587070
|
+
if (typeof dir === "string") {
|
|
587071
|
+
const r2 = _readStatusFile(join118(dir, "status.json"));
|
|
587072
|
+
if (r2) return r2;
|
|
587073
|
+
}
|
|
587074
|
+
}
|
|
587075
|
+
}
|
|
587076
|
+
} catch {
|
|
587077
|
+
}
|
|
587004
587078
|
const candidates = [
|
|
587005
587079
|
join118(process.cwd(), ".oa", "nexus", "status.json"),
|
|
587006
587080
|
join118(homedir40(), ".oa", "nexus", "status.json"),
|
|
587007
587081
|
join118(homedir40(), ".open-agents", "nexus", "status.json")
|
|
587008
587082
|
];
|
|
587009
587083
|
for (const p2 of candidates) {
|
|
587010
|
-
|
|
587011
|
-
|
|
587012
|
-
|
|
587013
|
-
|
|
587014
|
-
|
|
587084
|
+
const r2 = _readStatusFile(p2);
|
|
587085
|
+
if (r2) return r2;
|
|
587086
|
+
}
|
|
587087
|
+
const now = Date.now();
|
|
587088
|
+
if (_peerIdScanCache && now - _peerIdScanCache.ts < 6e4) {
|
|
587089
|
+
return _peerIdScanCache.result;
|
|
587090
|
+
}
|
|
587091
|
+
let scanResult = null;
|
|
587092
|
+
try {
|
|
587093
|
+
const { execSync: execSync59 } = __require("node:child_process");
|
|
587094
|
+
const cmd = `find "${homedir40()}" -maxdepth 4 -path '*/.oa/nexus/status.json' -type f 2>/dev/null | head -50`;
|
|
587095
|
+
const out = execSync59(cmd, { encoding: "utf-8", timeout: 2e3 }).trim();
|
|
587096
|
+
for (const line of out.split("\n")) {
|
|
587097
|
+
const f2 = line.trim();
|
|
587098
|
+
if (!f2) continue;
|
|
587099
|
+
const r2 = _readStatusFile(f2);
|
|
587100
|
+
if (r2) {
|
|
587101
|
+
scanResult = r2;
|
|
587102
|
+
break;
|
|
587015
587103
|
}
|
|
587016
|
-
} catch {
|
|
587017
587104
|
}
|
|
587105
|
+
} catch {
|
|
587018
587106
|
}
|
|
587019
|
-
|
|
587107
|
+
_peerIdScanCache = { ts: now, result: scanResult };
|
|
587108
|
+
return scanResult;
|
|
587020
587109
|
}
|
|
587021
587110
|
async function handleGenerateShare(ctx3) {
|
|
587022
587111
|
const { req: req2, res, requestId } = ctx3;
|
|
@@ -588287,7 +588376,7 @@ async function handleAimsConfigHistory(ctx3) {
|
|
|
588287
588376
|
return true;
|
|
588288
588377
|
}
|
|
588289
588378
|
}
|
|
588290
|
-
var PROBLEM_BASE, P, mcpManagerCache, memoryStoresCache, memoryInitTried, FILE_READ_MAX_BYTES, _aimsLocks;
|
|
588379
|
+
var PROBLEM_BASE, P, mcpManagerCache, memoryStoresCache, memoryInitTried, FILE_READ_MAX_BYTES, _peerIdScanCache, _aimsLocks;
|
|
588291
588380
|
var init_routes_v1 = __esm({
|
|
588292
588381
|
"packages/cli/src/api/routes-v1.ts"() {
|
|
588293
588382
|
"use strict";
|
|
@@ -588313,6 +588402,7 @@ var init_routes_v1 = __esm({
|
|
|
588313
588402
|
memoryStoresCache = null;
|
|
588314
588403
|
memoryInitTried = false;
|
|
588315
588404
|
FILE_READ_MAX_BYTES = 2 * 1024 * 1024;
|
|
588405
|
+
_peerIdScanCache = null;
|
|
588316
588406
|
_aimsLocks = /* @__PURE__ */ new Map();
|
|
588317
588407
|
}
|
|
588318
588408
|
});
|
|
@@ -604134,7 +604224,7 @@ function startApiServer(options2 = {}) {
|
|
|
604134
604224
|
log22(` Primary: ${config.backendUrl} (${config.backendType || "ollama"})
|
|
604135
604225
|
`);
|
|
604136
604226
|
try {
|
|
604137
|
-
const { writeFileSync: writeFileSync59, mkdirSync: mkdirSync67, existsSync: _exists } = require3("node:fs");
|
|
604227
|
+
const { writeFileSync: writeFileSync59, mkdirSync: mkdirSync67, existsSync: _exists, readFileSync: _rfs } = require3("node:fs");
|
|
604138
604228
|
const { join: _join } = require3("node:path");
|
|
604139
604229
|
const { homedir: _homedir } = require3("node:os");
|
|
604140
604230
|
const apiHint = JSON.stringify({
|
|
@@ -604145,18 +604235,33 @@ function startApiServer(options2 = {}) {
|
|
|
604145
604235
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
604146
604236
|
version: version4
|
|
604147
604237
|
}, null, 2);
|
|
604148
|
-
const
|
|
604149
|
-
|
|
604150
|
-
_join(_homedir(), ".
|
|
604151
|
-
|
|
604152
|
-
|
|
604153
|
-
|
|
604238
|
+
const dirSet = /* @__PURE__ */ new Set();
|
|
604239
|
+
try {
|
|
604240
|
+
const regPath = _join(_homedir(), ".open-agents", "nexus-registry.json");
|
|
604241
|
+
if (_exists(regPath)) {
|
|
604242
|
+
const reg = JSON.parse(_rfs(regPath, "utf-8"));
|
|
604243
|
+
for (const e2 of reg?.dirs || []) {
|
|
604244
|
+
const d2 = typeof e2 === "string" ? e2 : e2?.dir;
|
|
604245
|
+
if (typeof d2 === "string") dirSet.add(d2);
|
|
604246
|
+
}
|
|
604247
|
+
}
|
|
604248
|
+
} catch {
|
|
604249
|
+
}
|
|
604250
|
+
if (process.env["OA_NEXUS_DIR"]) dirSet.add(process.env["OA_NEXUS_DIR"]);
|
|
604251
|
+
dirSet.add(_join(process.cwd(), ".oa", "nexus"));
|
|
604252
|
+
dirSet.add(_join(_homedir(), ".oa", "nexus"));
|
|
604253
|
+
dirSet.add(_join(_homedir(), ".open-agents", "nexus"));
|
|
604254
|
+
let written = 0;
|
|
604255
|
+
for (const dir of dirSet) {
|
|
604154
604256
|
try {
|
|
604155
604257
|
if (!_exists(dir)) mkdirSync67(dir, { recursive: true });
|
|
604156
604258
|
writeFileSync59(_join(dir, "api-port.json"), apiHint);
|
|
604259
|
+
written++;
|
|
604157
604260
|
} catch {
|
|
604158
604261
|
}
|
|
604159
604262
|
}
|
|
604263
|
+
if (written > 0) log22(` api-port hint: wrote to ${written} nexus dir(s)
|
|
604264
|
+
`);
|
|
604160
604265
|
} catch (e2) {
|
|
604161
604266
|
log22(` WARN: api-port hint write failed: ${e2.message}
|
|
604162
604267
|
`);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-agents-ai",
|
|
3
|
-
"version": "0.187.
|
|
3
|
+
"version": "0.187.536",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "open-agents-ai",
|
|
9
|
-
"version": "0.187.
|
|
9
|
+
"version": "0.187.536",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "CC-BY-NC-4.0",
|
|
12
12
|
"dependencies": {
|
|
@@ -4930,9 +4930,9 @@
|
|
|
4930
4930
|
}
|
|
4931
4931
|
},
|
|
4932
4932
|
"node_modules/node-abi": {
|
|
4933
|
-
"version": "3.
|
|
4934
|
-
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.
|
|
4935
|
-
"integrity": "sha512-
|
|
4933
|
+
"version": "3.91.0",
|
|
4934
|
+
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.91.0.tgz",
|
|
4935
|
+
"integrity": "sha512-B+S7X/GS3Un6wMICtnsNjQD7oSpVBQrZftHE6GZ1Fe9/k3XOOoqbM5DZZ0GO4x3YiSCQfrM28yj1ppplwgIsfg==",
|
|
4936
4936
|
"license": "MIT",
|
|
4937
4937
|
"dependencies": {
|
|
4938
4938
|
"semver": "^7.3.5"
|
package/package.json
CHANGED