@renxqoo/renx-code 0.0.7 → 0.0.9
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/README.md +103 -43
- package/package.json +1 -1
- package/vendor/agent-root/src/config/__tests__/load-config-to-env.test.ts +109 -0
- package/vendor/agent-root/src/config/__tests__/loader.test.ts +114 -0
- package/vendor/agent-root/src/config/index.ts +1 -0
- package/vendor/agent-root/src/config/loader.ts +67 -4
- package/vendor/agent-root/src/config/types.ts +26 -0
- package/vendor/agent-root/src/providers/__tests__/registry.test.ts +82 -8
- package/vendor/agent-root/src/providers/index.ts +1 -1
- package/vendor/agent-root/src/providers/registry/model-config.ts +291 -44
- package/vendor/agent-root/src/providers/registry/provider-factory.ts +8 -4
- package/vendor/agent-root/src/providers/registry.ts +8 -8
- package/vendor/agent-root/src/providers/types/index.ts +1 -1
- package/vendor/agent-root/src/providers/types/registry.ts +10 -30
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { ProviderFactory } from './registry/provider-factory';
|
|
9
|
-
import { MODEL_DEFINITIONS } from './registry/model-config';
|
|
9
|
+
import { getResolvedModelDefinitions, MODEL_DEFINITIONS } from './registry/model-config';
|
|
10
10
|
import type { ModelConfig, ModelId, ProviderType } from './types';
|
|
11
11
|
|
|
12
12
|
// 导出类型
|
|
13
|
-
export type { ProviderType, ModelId, ModelConfig } from './types';
|
|
13
|
+
export type { ProviderType, BuiltinModelId, ModelId, ModelConfig } from './types';
|
|
14
14
|
|
|
15
15
|
// 导出模型配置
|
|
16
16
|
export { MODEL_DEFINITIONS as MODEL_CONFIGS } from './registry/model-config';
|
|
@@ -47,7 +47,7 @@ export class ProviderRegistry {
|
|
|
47
47
|
* 获取所有模型配置
|
|
48
48
|
*/
|
|
49
49
|
static listModels(): ModelConfig[] {
|
|
50
|
-
return Object.values(
|
|
50
|
+
return Object.values(getResolvedModelDefinitions()).map((config) => ({
|
|
51
51
|
...config,
|
|
52
52
|
apiKey: undefined,
|
|
53
53
|
}));
|
|
@@ -57,7 +57,7 @@ export class ProviderRegistry {
|
|
|
57
57
|
* 获取指定厂商的所有模型
|
|
58
58
|
*/
|
|
59
59
|
static listModelsByProvider(provider: ProviderType): ModelConfig[] {
|
|
60
|
-
return Object.values(
|
|
60
|
+
return Object.values(getResolvedModelDefinitions())
|
|
61
61
|
.filter((m) => m.provider === provider)
|
|
62
62
|
.map((config) => ({
|
|
63
63
|
...config,
|
|
@@ -69,14 +69,14 @@ export class ProviderRegistry {
|
|
|
69
69
|
* 获取所有模型 ID
|
|
70
70
|
*/
|
|
71
71
|
static getModelIds(): ModelId[] {
|
|
72
|
-
return Object.keys(
|
|
72
|
+
return Object.keys(getResolvedModelDefinitions()) as ModelId[];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* 获取指定模型的配置
|
|
77
77
|
*/
|
|
78
78
|
static getModelConfig(modelId: ModelId): ModelConfig {
|
|
79
|
-
const config =
|
|
79
|
+
const config = getResolvedModelDefinitions()[modelId];
|
|
80
80
|
if (!config) {
|
|
81
81
|
throw new Error(`Unknown model: ${modelId}`);
|
|
82
82
|
}
|
|
@@ -87,7 +87,7 @@ export class ProviderRegistry {
|
|
|
87
87
|
* 获取模型显示名称
|
|
88
88
|
*/
|
|
89
89
|
static getModelName(modelId: ModelId): string {
|
|
90
|
-
return
|
|
90
|
+
return getResolvedModelDefinitions()[modelId]?.name || modelId;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -95,7 +95,7 @@ export class ProviderRegistry {
|
|
|
95
95
|
*/
|
|
96
96
|
static getProviders(): ProviderType[] {
|
|
97
97
|
const providers = new Set<ProviderType>();
|
|
98
|
-
Object.values(
|
|
98
|
+
Object.values(getResolvedModelDefinitions()).forEach((m) => providers.add(m.provider));
|
|
99
99
|
return Array.from(providers);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Registry
|
|
3
|
-
*
|
|
4
|
-
* Provider Registry 相关的类型定义
|
|
2
|
+
* Registry related type definitions.
|
|
5
3
|
*/
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
6
|
+
* Supported provider types.
|
|
9
7
|
*/
|
|
10
8
|
export type ProviderType =
|
|
11
9
|
| 'anthropic'
|
|
@@ -18,22 +16,14 @@ export type ProviderType =
|
|
|
18
16
|
| 'qwen';
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
|
-
*
|
|
19
|
+
* Built-in model IDs shipped with the CLI.
|
|
22
20
|
*/
|
|
23
|
-
export type
|
|
24
|
-
// Anthropic 系列
|
|
21
|
+
export type BuiltinModelId =
|
|
25
22
|
| 'claude-opus-4.6'
|
|
26
|
-
// GLM 系列
|
|
27
23
|
| 'glm-4.7'
|
|
28
|
-
// MiniMax 系列
|
|
29
24
|
| 'minimax-2.5'
|
|
30
|
-
// Kimi 系列
|
|
31
25
|
| 'kimi-k2.5'
|
|
32
|
-
// DeepSeek 系列
|
|
33
|
-
// | 'deepseek-chat'
|
|
34
|
-
// GLM 5.0 系列
|
|
35
26
|
| 'glm-5'
|
|
36
|
-
// Qwen 系列
|
|
37
27
|
| 'qwen3.5-plus'
|
|
38
28
|
| 'qwen-kimi-k2.5'
|
|
39
29
|
| 'qwen-glm-5'
|
|
@@ -45,42 +35,32 @@ export type ModelId =
|
|
|
45
35
|
| 'openrouter/hunter-alpha';
|
|
46
36
|
|
|
47
37
|
/**
|
|
48
|
-
*
|
|
38
|
+
* Model IDs can include built-ins and user-defined config.json entries.
|
|
39
|
+
*/
|
|
40
|
+
export type ModelId = BuiltinModelId | (string & {});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Model configuration.
|
|
49
44
|
*/
|
|
50
45
|
export interface ModelConfig {
|
|
51
|
-
/** 模型唯一标识 */
|
|
52
46
|
id: ModelId;
|
|
53
|
-
/** 所属厂商 */
|
|
54
47
|
provider: ProviderType;
|
|
55
|
-
/** 显示名称 */
|
|
56
48
|
name: string;
|
|
57
|
-
/** API 端点路径 */
|
|
58
49
|
endpointPath: string;
|
|
59
|
-
/** API Key 环境变量名 */
|
|
60
50
|
envApiKey: string;
|
|
61
|
-
/** Base URL 环境变量名 */
|
|
62
51
|
envBaseURL: string;
|
|
63
|
-
/** API 基础 URL */
|
|
64
52
|
baseURL: string;
|
|
65
|
-
/** API 模型名称 */
|
|
66
53
|
model: string;
|
|
67
|
-
/** 最大输出 token 数 */
|
|
68
54
|
max_tokens: number;
|
|
69
|
-
/** 最大上下文 token 数 */
|
|
70
55
|
LLMMAX_TOKENS: number;
|
|
71
|
-
/** 支持的特性 */
|
|
72
56
|
features: string[];
|
|
73
|
-
/** 多模态输入能力 */
|
|
74
57
|
modalities?: {
|
|
75
58
|
image?: boolean;
|
|
76
59
|
audio?: boolean;
|
|
77
60
|
video?: boolean;
|
|
78
61
|
};
|
|
79
|
-
/** API 密钥(可选) */
|
|
80
62
|
apiKey?: string;
|
|
81
|
-
/** 温度(可选) */
|
|
82
63
|
temperature?: number;
|
|
83
|
-
/** 默认工具流式输出(可选) */
|
|
84
64
|
tool_stream?: boolean;
|
|
85
65
|
thinking?: boolean;
|
|
86
66
|
timeout?: number;
|