@starlink-awaken/agentmesh 1.2.3 → 1.2.5
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/src/cli/connect.js +8 -21
- package/dist/src/cli.js +1 -1
- package/dist/src/core/config.js +17 -11
- package/package.json +1 -1
package/dist/src/cli/connect.js
CHANGED
|
@@ -446,28 +446,15 @@ export async function interactiveConnect() {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
function readStdinLine() {
|
|
449
|
-
const decoder = new TextDecoder();
|
|
450
449
|
return new Promise((resolve) => {
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
const text = decoder.decode(value);
|
|
461
|
-
if (text.includes('\n')) {
|
|
462
|
-
chunks.push(value);
|
|
463
|
-
resolve(decoder.decode(Bun.concatArrayBuffers(chunks.map(c => c.buffer))).trim());
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
chunks.push(value);
|
|
467
|
-
pump();
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
pump();
|
|
450
|
+
// 使用 process.stdin 的 data 事件,每次重新监听(支持多次调用)
|
|
451
|
+
const onData = (chunk) => {
|
|
452
|
+
process.stdin.removeListener('data', onData);
|
|
453
|
+
process.stdin.pause();
|
|
454
|
+
resolve(chunk.toString().trim());
|
|
455
|
+
};
|
|
456
|
+
process.stdin.resume();
|
|
457
|
+
process.stdin.once('data', onData);
|
|
471
458
|
});
|
|
472
459
|
}
|
|
473
460
|
// ============================================================================
|
package/dist/src/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
7
7
|
import { resolve, dirname, join } from 'node:path';
|
|
8
8
|
import { initLogger } from './core/logger.js';
|
|
9
9
|
const PROJECT_ROOT = resolve(dirname(import.meta.dir), '..');
|
|
10
|
-
const VERSION = '1.2.
|
|
10
|
+
const VERSION = '1.2.5';
|
|
11
11
|
const BANNER = `
|
|
12
12
|
█████╗ ██████╗ ███████╗███╗ ██╗████████╗
|
|
13
13
|
██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
|
package/dist/src/core/config.js
CHANGED
|
@@ -22,17 +22,24 @@ export function loadConfig(configPath) {
|
|
|
22
22
|
if (cachedConfig) {
|
|
23
23
|
return cachedConfig;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
// 从当前文件位置向上搜索 config/gateway.yaml(兼容 src/ 和 dist/)
|
|
26
|
+
function findConfigUpward() {
|
|
26
27
|
try {
|
|
27
28
|
let d = import.meta.dir || import.meta.dirname || '';
|
|
28
|
-
for (let i = 0; i <
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
for (let i = 0; i < 10; i++) {
|
|
30
|
+
const candidate = join(d, 'config', 'gateway.yaml');
|
|
31
|
+
if (existsSync(candidate))
|
|
32
|
+
return candidate;
|
|
33
|
+
const ymlCandidate = join(d, 'config', 'gateway.yml');
|
|
34
|
+
if (existsSync(ymlCandidate))
|
|
35
|
+
return ymlCandidate;
|
|
36
|
+
d = dirname(d);
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
|
-
|
|
39
|
+
catch { }
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
const pkgConfig = findConfigUpward();
|
|
36
43
|
const paths = configPath
|
|
37
44
|
? [configPath]
|
|
38
45
|
: [
|
|
@@ -40,9 +47,8 @@ export function loadConfig(configPath) {
|
|
|
40
47
|
'./config/gateway.yml',
|
|
41
48
|
join(process.cwd(), 'config/gateway.yaml'),
|
|
42
49
|
join(process.cwd(), 'config/gateway.yml'),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
];
|
|
50
|
+
pkgConfig,
|
|
51
|
+
].filter(Boolean);
|
|
46
52
|
for (const path of paths) {
|
|
47
53
|
try {
|
|
48
54
|
if (existsSync(path)) {
|