@starlink-awaken/agentmesh 1.2.4 → 1.2.6
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 +17 -29
- package/dist/src/cli.js +1 -1
- package/package.json +1 -1
package/dist/src/cli/connect.js
CHANGED
|
@@ -30,33 +30,34 @@ function backupFile(originalPath) {
|
|
|
30
30
|
return backupPath;
|
|
31
31
|
}
|
|
32
32
|
// TOML 简单序列化(够用,不引入额外依赖)
|
|
33
|
-
function toToml(obj,
|
|
33
|
+
function toToml(obj, parentKey = '') {
|
|
34
34
|
const lines = [];
|
|
35
35
|
for (const [key, value] of Object.entries(obj)) {
|
|
36
36
|
if (value === null || value === undefined)
|
|
37
37
|
continue;
|
|
38
|
+
const fullKey = parentKey ? `${parentKey}.${key}` : key;
|
|
38
39
|
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
39
|
-
lines.push(
|
|
40
|
-
lines.push(toToml(value,
|
|
40
|
+
lines.push(`[${fullKey}]`);
|
|
41
|
+
lines.push(toToml(value, fullKey));
|
|
41
42
|
}
|
|
42
43
|
else if (Array.isArray(value)) {
|
|
43
44
|
for (const item of value) {
|
|
44
45
|
if (typeof item === 'string') {
|
|
45
|
-
lines.push(`${
|
|
46
|
+
lines.push(`${key} = "${item}"`);
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
lines.push(`${
|
|
49
|
+
lines.push(`${key} = ${JSON.stringify(item)}`);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
else if (typeof value === 'string') {
|
|
53
|
-
lines.push(`${
|
|
54
|
+
lines.push(`${key} = "${value}"`);
|
|
54
55
|
}
|
|
55
56
|
else if (typeof value === 'boolean') {
|
|
56
|
-
lines.push(`${
|
|
57
|
+
lines.push(`${key} = ${value}`);
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
|
-
lines.push(`${
|
|
60
|
+
lines.push(`${key} = ${value}`);
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
return lines.join('\n');
|
|
@@ -446,28 +447,15 @@ export async function interactiveConnect() {
|
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
449
|
function readStdinLine() {
|
|
449
|
-
const decoder = new TextDecoder();
|
|
450
450
|
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();
|
|
451
|
+
// 使用 process.stdin 的 data 事件,每次重新监听(支持多次调用)
|
|
452
|
+
const onData = (chunk) => {
|
|
453
|
+
process.stdin.removeListener('data', onData);
|
|
454
|
+
process.stdin.pause();
|
|
455
|
+
resolve(chunk.toString().trim());
|
|
456
|
+
};
|
|
457
|
+
process.stdin.resume();
|
|
458
|
+
process.stdin.once('data', onData);
|
|
471
459
|
});
|
|
472
460
|
}
|
|
473
461
|
// ============================================================================
|
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.6';
|
|
11
11
|
const BANNER = `
|
|
12
12
|
█████╗ ██████╗ ███████╗███╗ ██╗████████╗
|
|
13
13
|
██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
|