@starlink-awaken/agentmesh 1.2.5 → 1.2.8
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 +41 -9
- 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');
|
|
@@ -84,9 +85,11 @@ const codexDesktopAdapter = {
|
|
|
84
85
|
},
|
|
85
86
|
generateConfig(gwUrl) {
|
|
86
87
|
const path = this.getConfigPath();
|
|
88
|
+
const catalogPath = join(HOME, '.codex', 'model-catalogs', 'agentmesh-models.json');
|
|
87
89
|
const section = {
|
|
88
90
|
model: 'deepseek-v4-pro',
|
|
89
91
|
model_provider: 'agentmesh',
|
|
92
|
+
model_catalog_json: catalogPath,
|
|
90
93
|
};
|
|
91
94
|
const providerSection = {
|
|
92
95
|
name: 'Agent Mesh Gateway',
|
|
@@ -97,7 +100,12 @@ const codexDesktopAdapter = {
|
|
|
97
100
|
return {
|
|
98
101
|
path,
|
|
99
102
|
format: 'toml',
|
|
100
|
-
content: {
|
|
103
|
+
content: {
|
|
104
|
+
model: section.model,
|
|
105
|
+
model_provider: section.model_provider,
|
|
106
|
+
model_catalog_json: section.model_catalog_json,
|
|
107
|
+
model_providers: { agentmesh: providerSection },
|
|
108
|
+
},
|
|
101
109
|
};
|
|
102
110
|
},
|
|
103
111
|
hasGatewayConfig(config) {
|
|
@@ -299,6 +307,30 @@ export async function connectTools(targetTools, opts = {}) {
|
|
|
299
307
|
break;
|
|
300
308
|
}
|
|
301
309
|
}
|
|
310
|
+
// Codex Desktop: 注入模型到 models_cache.json
|
|
311
|
+
if (adapter.name === 'codex-desktop' && !opts.dryRun) {
|
|
312
|
+
try {
|
|
313
|
+
const cachePath = join(HOME, '.codex', 'models_cache.json');
|
|
314
|
+
if (existsSync(cachePath)) {
|
|
315
|
+
const cache = JSON.parse(readFileSync(cachePath, 'utf-8'));
|
|
316
|
+
const slugs = new Set(cache.models?.map((m) => m.slug) || []);
|
|
317
|
+
const newModels = [
|
|
318
|
+
{ slug: 'deepseek-v4-pro', display_name: 'DeepSeek V4 Pro', description: 'DeepSeek V4 Pro via Agent Mesh — 强推理,代码生成', default_reasoning_level: 'high', supported_reasoning_levels: [{ effort: 'low', description: '快速响应' }, { effort: 'medium', description: '平衡速度与推理' }, { effort: 'high', description: '深度推理' }], visibility: 'list', supported_in_api: true, priority: 10, service_tiers: [], additional_speed_tiers: [] },
|
|
319
|
+
{ slug: 'deepseek-v4-flash', display_name: 'DeepSeek V4 Flash', description: 'DeepSeek V4 Flash via Agent Mesh — 快速、便宜', default_reasoning_level: 'low', supported_reasoning_levels: [{ effort: 'low', description: '快速响应' }], visibility: 'list', supported_in_api: true, priority: 20, service_tiers: [], additional_speed_tiers: [] },
|
|
320
|
+
];
|
|
321
|
+
let added = 0;
|
|
322
|
+
for (const m of newModels) {
|
|
323
|
+
if (!slugs.has(m.slug)) {
|
|
324
|
+
cache.models.push(m);
|
|
325
|
+
added++;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (added > 0)
|
|
329
|
+
writeFileSync(cachePath, JSON.stringify(cache, null, 2) + '\n');
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
catch { }
|
|
333
|
+
}
|
|
302
334
|
results.push({
|
|
303
335
|
tool: adapter.name,
|
|
304
336
|
status: 'ok',
|
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.8';
|
|
11
11
|
const BANNER = `
|
|
12
12
|
█████╗ ██████╗ ███████╗███╗ ██╗████████╗
|
|
13
13
|
██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
|