@starlink-awaken/agentmesh 1.2.3 → 1.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/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.3';
10
+ const VERSION = '1.2.4';
11
11
  const BANNER = `
12
12
  █████╗ ██████╗ ███████╗███╗ ██╗████████╗
13
13
  ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
@@ -22,17 +22,24 @@ export function loadConfig(configPath) {
22
22
  if (cachedConfig) {
23
23
  return cachedConfig;
24
24
  }
25
- const pkgDir = (() => {
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 < 4; i++)
29
- d = dirname(d); // 上溯到包根
30
- return d;
31
- }
32
- catch {
33
- return '';
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
- join(pkgDir, 'config', 'gateway.yaml'),
44
- join(pkgDir, 'config', 'gateway.yml'),
45
- ];
50
+ pkgConfig,
51
+ ].filter(Boolean);
46
52
  for (const path of paths) {
47
53
  try {
48
54
  if (existsSync(path)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starlink-awaken/agentmesh",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Unified Agent Gateway - Multi-Agent Scheduler and Router",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",