engine7 7.1.44 → 7.1.46
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/cli.mjs +50 -7
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1857,6 +1857,8 @@ function getDefaultValues(stateDir) {
|
|
|
1857
1857
|
wechatEnabled: false,
|
|
1858
1858
|
wechatToken: "",
|
|
1859
1859
|
wechatAccountId: "",
|
|
1860
|
+
customBaseUrl: "",
|
|
1861
|
+
customModelId: "",
|
|
1860
1862
|
tavilyKey: "",
|
|
1861
1863
|
apiPort: 16990
|
|
1862
1864
|
};
|
|
@@ -1865,12 +1867,13 @@ async function interactiveConfig(rl, defaults) {
|
|
|
1865
1867
|
const v = { ...defaults };
|
|
1866
1868
|
console.log("\n=== \u7B2C\u4E00\u6B65\uFF1A\u5FC5\u586B\u914D\u7F6E ===\n");
|
|
1867
1869
|
v.agentName = await ask(rl, "Agent \u540D\u79F0", defaults.agentName);
|
|
1868
|
-
const providers = ["dashscope (\u901A\u4E49\u5343\u95EE)", "minimax (MiniMax)", "zhipu (\u667A\u8C31)", "deepseek (DeepSeek)"];
|
|
1870
|
+
const providers = ["dashscope (\u901A\u4E49\u5343\u95EE)", "minimax (MiniMax)", "zhipu (\u667A\u8C31)", "deepseek (DeepSeek)", "custom (\u81EA\u5B9A\u4E49/\u5176\u4ED6 Anthropic \u517C\u5BB9\u7AEF\u70B9)"];
|
|
1869
1871
|
const providerMap = {
|
|
1870
1872
|
"dashscope (\u901A\u4E49\u5343\u95EE)": "dashscope",
|
|
1871
1873
|
"minimax (MiniMax)": "minimax",
|
|
1872
1874
|
"zhipu (\u667A\u8C31)": "zhipu",
|
|
1873
|
-
"deepseek (DeepSeek)": "deepseek"
|
|
1875
|
+
"deepseek (DeepSeek)": "deepseek",
|
|
1876
|
+
"custom (\u81EA\u5B9A\u4E49/\u5176\u4ED6 Anthropic \u517C\u5BB9\u7AEF\u70B9)": "custom"
|
|
1874
1877
|
};
|
|
1875
1878
|
const chosenProvider = await askChoice(rl, "\u4E3B\u6A21\u578B Provider:", providers, 0);
|
|
1876
1879
|
v.primaryProvider = providerMap[chosenProvider] || "dashscope";
|
|
@@ -1880,21 +1883,34 @@ async function interactiveConfig(rl, defaults) {
|
|
|
1880
1883
|
const chosenPlan = await askChoice(rl, "\u667A\u8C31\u8BA2\u9605\u7C7B\u578B:", planOptions, 0);
|
|
1881
1884
|
v.zhipuPlan = chosenPlan.startsWith("coding") ? "coding" : "token";
|
|
1882
1885
|
}
|
|
1886
|
+
v.customBaseUrl = "";
|
|
1887
|
+
v.customModelId = "";
|
|
1888
|
+
if (v.primaryProvider === "custom") {
|
|
1889
|
+
v.primaryProvider = await ask(rl, "Provider ID\uFF08\u5C0F\u5199\u5B57\u6BCD\uFF0C\u5982 kimi / moonshot / openrouter\uFF09", "custom");
|
|
1890
|
+
v.customBaseUrl = await ask(rl, "Anthropic \u517C\u5BB9 baseUrl\uFF08\u5982 https://api.moonshot.cn/anthropic\uFF09");
|
|
1891
|
+
const cm = await ask(rl, "\u6A21\u578B ID\uFF08\u5982 kimi-k2-turbo-preview\uFF09");
|
|
1892
|
+
v.customModelId = cm;
|
|
1893
|
+
}
|
|
1883
1894
|
const keyMap = {
|
|
1884
1895
|
dashscope: "DashScope API Key",
|
|
1885
1896
|
minimax: "MiniMax API Key",
|
|
1886
1897
|
zhipu: "\u667A\u8C31 API Key",
|
|
1887
1898
|
deepseek: "DeepSeek API Key"
|
|
1888
1899
|
};
|
|
1889
|
-
v.primaryApiKey = await ask(rl, keyMap[v.primaryProvider] || "API Key");
|
|
1900
|
+
v.primaryApiKey = await ask(rl, keyMap[v.primaryProvider] || v.primaryProvider + " API Key");
|
|
1901
|
+
if (v.customModelId) {
|
|
1902
|
+
v.primaryModel = v.primaryProvider + "/" + v.customModelId;
|
|
1903
|
+
}
|
|
1890
1904
|
const modelMap = {
|
|
1891
1905
|
dashscope: ["dashscope/qwen3.7-max", "dashscope/qwen3.7-plus"],
|
|
1892
1906
|
minimax: ["minimax/MiniMax-M3", "minimax/MiniMax-M2.7"],
|
|
1893
1907
|
zhipu: ["zhipu/glm-5.3", "zhipu/glm-5v-turbo"],
|
|
1894
1908
|
deepseek: ["deepseek/deepseek-v4-pro", "deepseek/deepseek-v4-flash"]
|
|
1895
1909
|
};
|
|
1896
|
-
|
|
1897
|
-
|
|
1910
|
+
if (!v.customModelId) {
|
|
1911
|
+
const models = modelMap[v.primaryProvider] || ["dashscope/qwen3.7-max"];
|
|
1912
|
+
v.primaryModel = await askChoice(rl, "\u4E3B\u6A21\u578B:", models, 0);
|
|
1913
|
+
}
|
|
1898
1914
|
const visionCapableMap = {
|
|
1899
1915
|
"dashscope/qwen3.7-max": true,
|
|
1900
1916
|
"dashscope/qwen3.7-plus": true,
|
|
@@ -2123,7 +2139,7 @@ function generateConfig(v) {
|
|
|
2123
2139
|
baseUrl: "https://open.bigmodel.cn/api/coding/paas/v4",
|
|
2124
2140
|
api: "openai-completions",
|
|
2125
2141
|
models: [
|
|
2126
|
-
{ id: "glm-5.3", name: "GLM-5.3 (\u6700\u65B0\u4E3B\u529B)", reasoning: true, input: ["text"], contextWindow:
|
|
2142
|
+
{ id: "glm-5.3", name: "GLM-5.3 (\u6700\u65B0\u4E3B\u529B)", reasoning: true, input: ["text"], contextWindow: 1e6, maxTokens: 128e3 },
|
|
2127
2143
|
{ id: "glm-5v-turbo", name: "GLM-5V-Turbo (\u89C6\u89C9)", reasoning: true, input: ["text", "image"], contextWindow: 2e5, maxTokens: 128e3 }
|
|
2128
2144
|
]
|
|
2129
2145
|
},
|
|
@@ -2137,6 +2153,16 @@ function generateConfig(v) {
|
|
|
2137
2153
|
]
|
|
2138
2154
|
}
|
|
2139
2155
|
};
|
|
2156
|
+
if (!providerDefs[v.primaryProvider] && v.customModelId) {
|
|
2157
|
+
config.models.providers[v.primaryProvider] = {
|
|
2158
|
+
baseUrl: (v.customBaseUrl || "").trim(),
|
|
2159
|
+
api: "anthropic",
|
|
2160
|
+
apiKey: "env:" + v.primaryProvider.toUpperCase().replace(/[^A-Z0-9_]/g, "_") + "_API_KEY",
|
|
2161
|
+
models: [
|
|
2162
|
+
{ id: v.customModelId, name: v.customModelId, reasoning: false, input: ["text"], contextWindow: 2e5, maxTokens: 8192 }
|
|
2163
|
+
]
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2140
2166
|
if (providerDefs[v.primaryProvider]) {
|
|
2141
2167
|
const def = { ...providerDefs[v.primaryProvider] };
|
|
2142
2168
|
if (v.primaryProvider === "zhipu" && v.zhipuPlan === "token") {
|
|
@@ -2144,7 +2170,7 @@ function generateConfig(v) {
|
|
|
2144
2170
|
}
|
|
2145
2171
|
config.models.providers[v.primaryProvider] = {
|
|
2146
2172
|
...def,
|
|
2147
|
-
apiKey: v.
|
|
2173
|
+
apiKey: "env:" + v.primaryProvider.toUpperCase().replace(/[^A-Z0-9_]/g, "_") + "_API_KEY",
|
|
2148
2174
|
...def.baseUrl ? { baseUrl: def.baseUrl.trim() } : {}
|
|
2149
2175
|
};
|
|
2150
2176
|
}
|
|
@@ -3085,6 +3111,23 @@ WantedBy=default.target`;
|
|
|
3085
3111
|
} else {
|
|
3086
3112
|
console.log("\n\u{1F4E6} \u6B63\u5728\u521B\u5EFA\u76EE\u5F55\u548C\u6587\u4EF6...\n");
|
|
3087
3113
|
execute(tree);
|
|
3114
|
+
if (values.primaryApiKey && values.primaryApiKey.trim()) {
|
|
3115
|
+
const envName = values.primaryProvider.toUpperCase().replace(/[^A-Z0-9_]/g, "_") + "_API_KEY";
|
|
3116
|
+
const secretsDir = path3.join(process.env.HOME || process.env.USERPROFILE || ".", ".engine7-secrets");
|
|
3117
|
+
if (!fs3.existsSync(secretsDir)) fs3.mkdirSync(secretsDir, { recursive: true });
|
|
3118
|
+
const envFile = path3.join(secretsDir, "main7.env");
|
|
3119
|
+
let envContent = "";
|
|
3120
|
+
if (fs3.existsSync(envFile)) envContent = fs3.readFileSync(envFile, "utf8");
|
|
3121
|
+
const lines = envContent.split("\n").filter((l) => l && !l.startsWith(envName + "="));
|
|
3122
|
+
lines.push(envName + "=" + values.primaryApiKey.trim());
|
|
3123
|
+
fs3.writeFileSync(envFile, lines.join("\n") + "\n", "utf8");
|
|
3124
|
+
try {
|
|
3125
|
+
fs3.chmodSync(envFile, 384);
|
|
3126
|
+
} catch {
|
|
3127
|
+
}
|
|
3128
|
+
console.log("\u{1F511} API key \u5DF2\u5B58\u5165: " + envFile);
|
|
3129
|
+
console.log(" config \u91CC\u53EA\u6709 env:" + envName + " \u5360\u4F4D\u7B26\uFF0C\u660E\u6587\u4E0D\u843D config");
|
|
3130
|
+
}
|
|
3088
3131
|
const skillsSrc = findTemplateDir("skills");
|
|
3089
3132
|
if (skillsSrc) {
|
|
3090
3133
|
const skillsDest = path3.join(opts.stateDir, "workspace", "skills");
|